001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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:
017: package org.kuali.core.datadictionary;
018:
019: import org.apache.commons.beanutils.ConversionException;
020: import org.apache.log4j.Level;
021: import org.junit.After;
022: import org.junit.Before;
023: import org.junit.Test;
024: import org.kuali.rice.KNSServiceLocator;
025: import org.kuali.test.KNSTestBase;
026: import org.kuali.test.KNSWithTestSpringContext;
027:
028: /**
029: * This class is used to test the DataDictionaryBuilder Business Object.
030: *
031: *
032: */
033: @KNSWithTestSpringContext
034: public class DataDictionaryBuilder_BusinessObjectTest extends
035: KNSTestBase {
036:
037: DataDictionaryBuilder builder = null;
038:
039: Level oldDigesterLogLevel;
040:
041: Level oldXmlLogLevel;
042:
043: @Before
044: public void setUp() throws Exception {
045: super .setUp();
046:
047: // String INPUT_FILE = "classpath:org/kuali/core/bo/datadictionary/" +
048: // "AttributeReferenceDummy.xml";
049: builder = new DataDictionaryBuilder(KNSServiceLocator
050: .getValidationCompletionUtils());
051: builder
052: .addUniqueEntries(
053: "classpath:org/kuali/core/bo/datadictionary/AdHocRoutePerson.xml",
054: true);
055: builder
056: .addUniqueEntries(
057: "classpath:org/kuali/core/bo/datadictionary/AdHocRouteWorkgroup.xml",
058: true);
059: builder
060: .addUniqueEntries(
061: "classpath:org/kuali/core/bo/datadictionary/Attachment.xml",
062: true);
063: builder
064: .addUniqueEntries(
065: "classpath:org/kuali/core/bo/datadictionary/AttributeReferenceDummy.xml",
066: true);
067: builder
068: .addUniqueEntries(
069: "classpath:org/kuali/core/bo/datadictionary/BusinessObjectAttributeEntry.xml",
070: true);
071: //builder.addUniqueEntries("classpath:org/kuali/core/bo/datadictionary/BusinessRule.xml", true);
072: //builder.addUniqueEntries("classpath:org/kuali/core/bo/datadictionary/BusinessRuleSecurity.xml", true);
073: builder
074: .addUniqueEntries(
075: "classpath:org/kuali/core/bo/datadictionary/Campus.xml",
076: true);
077: builder
078: .addUniqueEntries(
079: "classpath:org/kuali/core/bo/datadictionary/CampusType.xml",
080: true);
081: builder
082: .addUniqueEntries(
083: "classpath:org/kuali/core/bo/datadictionary/DocumentGroup.xml",
084: true);
085: builder
086: .addUniqueEntries(
087: "classpath:org/kuali/core/bo/datadictionary/DocumentHeader.xml",
088: true);
089: builder
090: .addUniqueEntries(
091: "classpath:org/kuali/core/bo/datadictionary/DocumentStatus.xml",
092: true);
093: builder
094: .addUniqueEntries(
095: "classpath:org/kuali/core/bo/datadictionary/DocumentType.xml",
096: true);
097: builder
098: .addUniqueEntries(
099: "classpath:org/kuali/core/bo/datadictionary/EmployeeStatus.xml",
100: true);
101: builder
102: .addUniqueEntries(
103: "classpath:org/kuali/core/bo/datadictionary/EmployeeType.xml",
104: true);
105: //builder.addUniqueEntries("classpath:org/kuali/core/bo/datadictionary/FinancialSystemParameter.xml", true);
106: //builder.addUniqueEntries("classpath:org/kuali/core/bo/datadictionary/FinancialSystemParameterSecurity.xml", true);
107: builder.addUniqueEntries(
108: "classpath:org/kuali/core/bo/datadictionary/Note.xml",
109: true);
110: builder
111: .addUniqueEntries(
112: "classpath:org/kuali/core/bo/datadictionary/NoteType.xml",
113: true);
114: builder
115: .addUniqueEntries(
116: "classpath:org/kuali/core/bo/datadictionary/UniversalUser.xml",
117: true);
118: //builder.addUniqueEntries("classpath:org/kuali/core/document/datadictionary/BusinessRuleMaintenanceDocument.xml", true);
119: //builder.addUniqueEntries("classpath:org/kuali/core/document/datadictionary/BusinessRuleSecurityMaintenanceDocument.xml", true);
120: builder
121: .addUniqueEntries(
122: "classpath:org/kuali/core/document/datadictionary/CampusMaintenanceDocument.xml",
123: true);
124: builder
125: .addUniqueEntries(
126: "classpath:org/kuali/core/document/datadictionary/CampusTypeMaintenanceDocument.xml",
127: true);
128: builder
129: .addUniqueEntries(
130: "classpath:org/kuali/core/document/datadictionary/DocumentTypeMaintenanceDocument.xml",
131: true);
132: builder
133: .addUniqueEntries(
134: "classpath:org/kuali/core/document/datadictionary/EmployeeStatusMaintenanceDocument.xml",
135: true);
136: builder
137: .addUniqueEntries(
138: "classpath:org/kuali/core/document/datadictionary/EmployeeTypeMaintenanceDocument.xml",
139: true);
140: //builder.addUniqueEntries("classpath:org/kuali/core/document/datadictionary/FinancialSystemParameterSecurityMaintenanceDocument.xml", true);
141: //builder.addUniqueEntries("classpath:org/kuali/core/document/datadictionary/FinancialSystemParameterMaintenanceDocument.xml", true);
142: builder
143: .addUniqueEntries(
144: "classpath:org/kuali/core/document/datadictionary/UniversalUserMaintenanceDocument.xml",
145: true);
146: builder
147: .addUniqueEntries(
148: "classpath:edu/sampleu/travel/datadictionary/TravelAccount.xml",
149: true);
150: builder
151: .addUniqueEntries(
152: "classpath:edu/sampleu/travel/datadictionary/TravelAccountType.xml",
153: true);
154: builder
155: .addUniqueEntries(
156: "classpath:edu/sampleu/travel/datadictionary/TravelAccountMaintenanceDocument.xml",
157: true);
158: builder
159: .addUniqueEntries(
160: "classpath:edu/sampleu/travel/datadictionary/TravelAccountExtension.xml",
161: true);
162: builder
163: .addUniqueEntries(
164: "classpath:edu/sampleu/travel/datadictionary/FiscalOfficer.xml",
165: true);
166: builder
167: .addUniqueEntries(
168: "classpath:edu/sampleu/travel/datadictionary/FiscalOfficerMaintenanceDocument.xml",
169: true);
170:
171: // quieten things down a bit
172: setLogLevel("org.apache.commons.digester", Level.FATAL);
173: setLogLevel("org.kuali.core.datadictionary.XmlErrorHandler",
174: Level.FATAL);
175: }
176:
177: @After
178: public void tearDown() throws Exception {
179: super .tearDown();
180: builder = null;
181: }
182:
183: @Test
184: public final void testDataDictionaryBuilder_businessObject_attribute_blankFormatterClass() {
185: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
186: + "bo/BlankFormatterClass.xml";
187:
188: boolean failedAsExpected = false;
189:
190: try {
191: builder.addUniqueEntries(INPUT_FILE, true);
192: builder.parseBO("BlankFormatterClass", true);
193: } catch (DataDictionaryException e) {
194: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
195: failedAsExpected = true;
196: }
197: }
198:
199: assertTrue(failedAsExpected);
200: }
201:
202: @Test
203: public final void testDataDictionaryBuilder_businessObject_attribute_blankValidatingRegex() {
204: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
205: + "bo/BlankValidatingRegex.xml";
206:
207: boolean failedAsExpected = false;
208:
209: try {
210: builder.addUniqueEntries(INPUT_FILE, true);
211: builder.parseBO("BlankValidatingRegex", true);
212: } catch (DataDictionaryException e) {
213: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
214: failedAsExpected = true;
215: }
216: }
217:
218: assertTrue(failedAsExpected);
219: }
220:
221: @Test
222: public final void testDataDictionaryBuilder_businessObject_attribute_invalidFormatterClass() {
223: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
224: + "bo/InvalidFormatterClass.xml";
225:
226: boolean failedAsExpected = false;
227:
228: try {
229: builder.getDataDictionary().setAllowOverrides(true);
230: builder.addOverrideEntries(INPUT_FILE, true);
231: builder.parseBO("InvalidFormatterClass", true);
232: } catch (DataDictionaryException e) {
233: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
234: failedAsExpected = true;
235: }
236: }
237:
238: assertTrue(failedAsExpected);
239: }
240:
241: @Test
242: public final void testDataDictionaryBuilder_businessObject_attribute_invalidValidatingRegex() {
243: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
244: + "bo/InvalidValidatingRegex.xml";
245:
246: boolean failedAsExpected = false;
247:
248: try {
249: builder.getDataDictionary().setAllowOverrides(true);
250: builder.addOverrideEntries(INPUT_FILE, true);
251: builder.parseBO("InvalidValidatingRegex", true);
252: } catch (DataDictionaryException e) {
253: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
254: failedAsExpected = true;
255: }
256: }
257:
258: assertTrue(failedAsExpected);
259: }
260:
261: @Test
262: public final void testDataDictionaryBuilder_businessObject_attribute_unknownFormatterClass() {
263: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
264: + "bo/UnknownFormatterClass.xml";
265:
266: boolean failedAsExpected = false;
267:
268: try {
269: builder.addUniqueEntries(INPUT_FILE, true);
270: builder.parseBO("UnknownFormatterClass", true);
271: } catch (DataDictionaryException e) {
272: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
273: failedAsExpected = true;
274: }
275: }
276:
277: assertTrue(failedAsExpected);
278: }
279:
280: @Test
281: public final void testDataDictionaryBuilder_businessObject_attributeReference_blankAttributeName() {
282: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
283: + "bo/ARBlankAttributeName.xml";
284:
285: boolean failedAsExpected = false;
286:
287: try {
288: builder.addUniqueEntries(INPUT_FILE, true);
289: builder.parseBO("ARBlankAttributeName", true);
290: } catch (DataDictionaryException e) {
291: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
292: failedAsExpected = true;
293: }
294: }
295:
296: assertTrue(failedAsExpected);
297: }
298:
299: @Test
300: public final void testDataDictionaryBuilder_businessObject_attributeReference_blankSourceAttribute() {
301: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
302: + "bo/ARBlankSourceAttribute.xml";
303:
304: boolean failedAsExpected = false;
305:
306: try {
307: builder.addUniqueEntries(INPUT_FILE, true);
308: builder.parseBO("ARBlankSourceAttribute", true);
309: } catch (DataDictionaryException e) {
310: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
311: failedAsExpected = true;
312: }
313: }
314:
315: assertTrue(failedAsExpected);
316: }
317:
318: @Test
319: public final void testDataDictionaryBuilder_businessObject_attributeReference_blankSourceClass() {
320: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
321: + "bo/ARBlankSourceClass.xml";
322:
323: boolean failedAsExpected = false;
324:
325: try {
326: builder.addUniqueEntries(INPUT_FILE, true);
327: builder.parseBO("ARBlankSourceClass", true);
328: } catch (DataDictionaryException e) {
329: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
330: failedAsExpected = true;
331: }
332: }
333:
334: assertTrue(failedAsExpected);
335: }
336:
337: @Test
338: public final void testDataDictionaryBuilder_businessObject_attributeReference_duplicateAttributeName() {
339: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
340: + "bo/ARDuplicateAttributeName.xml";
341:
342: boolean failedAsExpected = false;
343:
344: try {
345: builder.addUniqueEntries(INPUT_FILE, true);
346: builder.parseBO("ARDuplicateAttributeName", true);
347: } catch (DataDictionaryException e) {
348: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
349: failedAsExpected = true;
350: }
351: }
352:
353: assertTrue(failedAsExpected);
354: }
355:
356: @Test
357: public final void testDataDictionaryBuilder_businessObject_attributeReference_invalidAttributeReference() {
358: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
359: + "bo/ARInvalidAttributeReference.xml";
360:
361: boolean failedAsExpected = false;
362:
363: try {
364: builder.getDataDictionary().setAllowOverrides(true);
365: builder.addOverrideEntries(INPUT_FILE, true);
366: builder.parseBO("ARInvalidAttributeReference", true);
367: } catch (DataDictionaryException e) {
368: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
369: failedAsExpected = true;
370: }
371: }
372:
373: assertTrue(failedAsExpected);
374: }
375:
376: @Test
377: public final void testDataDictionaryBuilder_businessObject_attributeReference_missingSourceAttribute() {
378: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
379: + "bo/ARMissingSourceAttribute.xml";
380:
381: boolean failedAsExpected = false;
382:
383: try {
384: builder.getDataDictionary().setAllowOverrides(true);
385: builder.addOverrideEntries(INPUT_FILE, true);
386: builder.parseBO("ARMissingSourceAttribute", true);
387: } catch (DataDictionaryException e) {
388: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
389: failedAsExpected = true;
390: }
391: }
392:
393: assertTrue(failedAsExpected);
394: }
395:
396: @Test
397: public final void testDataDictionaryBuilder_businessObject_attributeReference_missingSourceClass() {
398: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
399: + "bo/ARMissingSourceClass.xml";
400:
401: boolean failedAsExpected = false;
402:
403: try {
404: builder.addUniqueEntries(INPUT_FILE, true);
405: builder.parseBO("ARMissingSourceClass", true);
406: } catch (DataDictionaryException e) {
407: failedAsExpected = true;
408: }
409:
410: assertTrue(failedAsExpected);
411: }
412:
413: @Test
414: public final void testDataDictionaryBuilder_businessObject_attributeReference_unknownAttributeName() {
415: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
416: + "bo/ARUnknownAttributeName.xml";
417:
418: boolean failedAsExpected = false;
419:
420: try {
421: builder.getDataDictionary().setAllowOverrides(true);
422: builder.addOverrideEntries(INPUT_FILE, true);
423: builder.parseBO("ARUnknownAttributeName", true);
424: } catch (DataDictionaryException e) {
425: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
426: failedAsExpected = true;
427: }
428: }
429:
430: assertTrue(failedAsExpected);
431: }
432:
433: @Test
434: public final void testDataDictionaryBuilder_businessObject_attributeReference_unknownSourceAttribute() {
435: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
436: + "bo/ARUnknownSourceAttribute.xml";
437:
438: boolean failedAsExpected = false;
439:
440: try {
441: builder.getDataDictionary().setAllowOverrides(true);
442: builder.addOverrideEntries(INPUT_FILE, true);
443: builder.parseBO("ARUnknownSourceAttribute", true);
444: } catch (DataDictionaryException e) {
445: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
446: failedAsExpected = true;
447: }
448: }
449:
450: assertTrue(failedAsExpected);
451: }
452:
453: @Test
454: public final void testDataDictionaryBuilder_businessObject_attributeReference_unknownSourceClass() {
455: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
456: + "bo/ARUnknownSourceClass.xml";
457:
458: boolean failedAsExpected = false;
459:
460: try {
461: builder.getDataDictionary().setAllowOverrides(true);
462: builder.addOverrideEntries(INPUT_FILE, true);
463: builder.parseBO("ARUnknownSourceClass", true);
464: } catch (DataDictionaryException e) {
465: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
466: failedAsExpected = true;
467: }
468: }
469:
470: assertTrue(failedAsExpected);
471: }
472:
473: @Test
474: public final void testDataDictionaryBuilder_businessObject_blankAttributeName() {
475: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
476: + "bo/BlankAttributeName.xml";
477:
478: boolean failedAsExpected = false;
479:
480: try {
481: builder.addUniqueEntries(INPUT_FILE, true);
482: builder.parseBO("BlankAttributeName", true);
483: } catch (DataDictionaryException e) {
484: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
485: failedAsExpected = true;
486: }
487: }
488:
489: assertTrue(failedAsExpected);
490: }
491:
492: @Test
493: public final void testDataDictionaryBuilder_businessObject_blankBusinessObjectClass() {
494: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
495: + "bo/BlankBusinessObjectClass.xml";
496:
497: boolean failedAsExpected = false;
498:
499: try {
500: builder.addUniqueEntries(INPUT_FILE, true);
501: builder.parseBO("BlankBusinessObjectClass", true);
502: } catch (DataDictionaryException e) {
503: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
504: failedAsExpected = true;
505: }
506: }
507:
508: assertTrue(failedAsExpected);
509: }
510:
511: @Test
512: public final void testDataDictionaryBuilder_businessObject_blankCollectionName() {
513: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
514: + "bo/BlankCollectionName.xml";
515:
516: boolean failedAsExpected = false;
517:
518: try {
519: builder.addUniqueEntries(INPUT_FILE, true);
520: builder.parseBO("BlankCollectionName", true);
521: } catch (DataDictionaryException e) {
522: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
523: failedAsExpected = true;
524: }
525: }
526:
527: assertTrue(failedAsExpected);
528: }
529:
530: @Test
531: public final void testDataDictionaryBuilder_businessObject_defaultSort_blankAttributeName() {
532: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
533: + "bo/DefaultSortBlankAttributeName.xml";
534:
535: boolean failedAsExpected = false;
536:
537: try {
538: builder.addUniqueEntries(INPUT_FILE, true);
539: builder.parseBO("DefaultSortBlankAttributeName", true);
540: } catch (DataDictionaryException e) {
541: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
542: failedAsExpected = true;
543: }
544: }
545:
546: assertTrue(failedAsExpected);
547: }
548:
549: @Test
550: public final void testDataDictionaryBuilder_businessObject_defaultSort_unknownAttributeName() {
551: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
552: + "bo/DefaultSortUnknownAttributeName.xml";
553:
554: boolean failedAsExpected = false;
555:
556: try {
557: builder.getDataDictionary().setAllowOverrides(true);
558: builder.addOverrideEntries(INPUT_FILE, true);
559: builder.parseBO("DefaultSortUnknownAttributeName", true);
560: } catch (DataDictionaryException e) {
561: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
562: failedAsExpected = true;
563: }
564: }
565:
566: assertTrue(failedAsExpected);
567: }
568:
569: @Test
570: public final void testDataDictionaryBuilder_businessObject_duplicateAttributeName() {
571: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
572: + "bo/DuplicateAttributeName.xml";
573:
574: boolean failedAsExpected = false;
575:
576: try {
577: builder.addUniqueEntries(INPUT_FILE, true);
578: builder.parseBO("DuplicateAttributeName", true);
579: } catch (DataDictionaryException e) {
580: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
581: failedAsExpected = true;
582: }
583: }
584:
585: assertTrue(failedAsExpected);
586: }
587:
588: @Test
589: public final void testDataDictionaryBuilder_businessObject_inquiryField_blankAttributeName() {
590: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
591: + "bo/IFBlankAttributeName.xml";
592:
593: boolean failedAsExpected = false;
594:
595: try {
596: builder.addUniqueEntries(INPUT_FILE, true);
597: builder.parseBO("IFBlankAttributeName", true);
598: } catch (DataDictionaryException e) {
599: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
600: failedAsExpected = true;
601: }
602: }
603:
604: assertTrue(failedAsExpected);
605: }
606:
607: @Test
608: public final void testDataDictionaryBuilder_businessObject_inquiryField_duplicateAttributeName() {
609: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
610: + "bo/IFDuplicateAttributeName.xml";
611:
612: boolean failedAsExpected = false;
613:
614: try {
615: builder.addUniqueEntries(INPUT_FILE, true);
616: builder.parseBO("IFDuplicateAttributeName", true);
617: } catch (DataDictionaryException e) {
618: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
619: failedAsExpected = true;
620: }
621: }
622:
623: assertTrue(failedAsExpected);
624: }
625:
626: @Test
627: public final void testDataDictionaryBuilder_businessObject_inquiryField_unknownAttributeName() {
628: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
629: + "bo/IFUnknownAttributeName.xml";
630:
631: boolean failedAsExpected = false;
632:
633: try {
634: builder.getDataDictionary().setAllowOverrides(true);
635: builder.addOverrideEntries(INPUT_FILE, true);
636: builder.parseBO("IFUnknownAttributeName", true);
637: } catch (DataDictionaryException e) {
638: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
639: failedAsExpected = true;
640: }
641: }
642:
643: assertTrue(failedAsExpected);
644: }
645:
646: @Test
647: public final void testDataDictionaryBuilder_businessObject_invalid() {
648: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
649: + "bo/InvalidBusinessObject.xml";
650:
651: boolean failedAsExpected = false;
652:
653: try {
654: builder.getDataDictionary().setAllowOverrides(true);
655: builder.addOverrideEntries(INPUT_FILE, true);
656: builder.parseBO("InvalidBusinessObject", true);
657: } catch (DataDictionaryException e) {
658: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
659: failedAsExpected = true;
660: }
661: }
662:
663: assertTrue(failedAsExpected);
664: }
665:
666: @Test
667: public final void testDataDictionaryBuilder_businessObject_lookupField_blankAttributeName() {
668: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
669: + "bo/LFBlankAttributeName.xml";
670:
671: boolean failedAsExpected = false;
672:
673: try {
674: builder.addUniqueEntries(INPUT_FILE, true);
675: builder.parseBO("LFBlankAttributeName", true);
676: } catch (DataDictionaryException e) {
677: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
678: failedAsExpected = true;
679: }
680: }
681:
682: assertTrue(failedAsExpected);
683: }
684:
685: @Test
686: public final void testDataDictionaryBuilder_businessObject_lookupField_duplicateAttributeName() {
687: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
688: + "bo/LFDuplicateAttributeName.xml";
689:
690: boolean failedAsExpected = false;
691:
692: try {
693: builder.addUniqueEntries(INPUT_FILE, true);
694: builder.parseBO("LFDuplicateAttributeName", true);
695: } catch (DataDictionaryException e) {
696: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
697: failedAsExpected = true;
698: }
699: }
700:
701: assertTrue(failedAsExpected);
702: }
703:
704: @Test
705: public final void testDataDictionaryBuilder_businessObject_lookupField_unknownAttributeName() {
706: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
707: + "bo/LFUnknownAttributeName.xml";
708:
709: boolean failedAsExpected = false;
710:
711: try {
712: builder.getDataDictionary().setAllowOverrides(true);
713: builder.addOverrideEntries(INPUT_FILE, true);
714: builder.parseBO("LFUnknownAttributeName", true);
715: } catch (DataDictionaryException e) {
716: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
717: failedAsExpected = true;
718: }
719: }
720:
721: assertTrue(failedAsExpected);
722: }
723:
724: @Test
725: public final void testDataDictionaryBuilder_businessObject_returnKey_blankAttributeName() {
726: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
727: + "bo/RKBlankAttributeName.xml";
728:
729: boolean failedAsExpected = false;
730:
731: try {
732: builder.addUniqueEntries(INPUT_FILE, true);
733: builder.parseBO("RKBlankAttributeName", true);
734: } catch (DataDictionaryException e) {
735: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
736: failedAsExpected = true;
737: }
738: }
739:
740: assertTrue(failedAsExpected);
741: }
742:
743: @Test
744: public final void testDataDictionaryBuilder_businessObject_returnKey_duplicateAttributeName() {
745: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
746: + "bo/RKDuplicateAttributeName.xml";
747:
748: boolean failedAsExpected = false;
749:
750: try {
751: builder.addUniqueEntries(INPUT_FILE, true);
752: builder.parseBO("RKDuplicateAttributeName", true);
753: } catch (DataDictionaryException e) {
754: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
755: failedAsExpected = true;
756: }
757: }
758:
759: assertTrue(failedAsExpected);
760: }
761:
762: @Test
763: public final void testDataDictionaryBuilder_businessObject_returnKey_unknownAttributeName() {
764: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
765: + "bo/RKUnknownAttributeName.xml";
766:
767: boolean failedAsExpected = false;
768:
769: try {
770: builder.getDataDictionary().setAllowOverrides(true);
771: builder.addOverrideEntries(INPUT_FILE, true);
772: builder.parseBO("RKUnknownAttributeName", true);
773: } catch (DataDictionaryException e) {
774: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
775: failedAsExpected = true;
776: }
777: }
778:
779: assertTrue(failedAsExpected);
780: }
781:
782: @Test
783: public final void testDataDictionaryBuilder_businessObject_unknownAttributeName() {
784: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
785: + "bo/UnknownAttributeName.xml";
786:
787: boolean failedAsExpected = false;
788:
789: try {
790: builder.getDataDictionary().setAllowOverrides(true);
791: builder.addOverrideEntries(INPUT_FILE, true);
792: builder.parseBO("UnknownAttributeName", true);
793: } catch (DataDictionaryException e) {
794: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
795: failedAsExpected = true;
796: }
797: }
798:
799: assertTrue(failedAsExpected);
800: }
801:
802: @Test
803: public final void testDataDictionaryBuilder_businessObject_unknownBusinessObjectClass() {
804: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
805: + "bo/UnknownBusinessObjectClass.xml";
806:
807: boolean failedAsExpected = false;
808:
809: try {
810: builder.addUniqueEntries(INPUT_FILE, true);
811: builder.parseBO("UnknownBusinessObjectClass", true);
812: } catch (DataDictionaryException e) {
813: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
814: failedAsExpected = true;
815: }
816: }
817:
818: assertTrue(failedAsExpected);
819: }
820:
821: @Test
822: public final void testDataDictionaryBuilder_businessObject_unknownCollectionName() {
823: String INPUT_FILE = DataDictionaryBuilderTest.TESTPACKAGE_INVALID
824: + "bo/UnknownCollectionName.xml";
825:
826: boolean failedAsExpected = false;
827:
828: try {
829: builder.getDataDictionary().setAllowOverrides(true);
830: builder.addOverrideEntries(INPUT_FILE, true);
831: builder.parseBO("UnknownCollectionName", true);
832: } catch (DataDictionaryException e) {
833: if (DataDictionaryUtils.saxCause(e) instanceof ConversionException) {
834: failedAsExpected = true;
835: }
836: }
837:
838: assertTrue(failedAsExpected);
839: }
840:
841: }
|