001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * Portions Copyrighted 2007 Sun Microsystems, Inc.
027: */
028: package org.netbeans.modules.visualweb.insync.models;
029:
030: import com.sun.rave.designtime.DesignContext;
031: import junit.framework.Test;
032: import junit.framework.TestSuite;
033: import org.netbeans.api.project.Project;
034: import org.netbeans.junit.NbTestSuite;
035: import org.netbeans.modules.visualweb.insync.InsyncTestBase;
036: import org.netbeans.modules.visualweb.insync.Model;
037: import org.netbeans.modules.visualweb.insync.ModelSet;
038: import org.netbeans.modules.visualweb.insync.ModelSetsListener;
039: import org.netbeans.modules.visualweb.insync.live.LiveUnit;
040: import org.netbeans.modules.visualweb.jsfsupport.container.FacesContainer;
041: import org.openide.filesystems.FileObject;
042: import org.openide.util.Exceptions;
043:
044: /**
045: *
046: * @author sc32560, jdeva
047: */
048: public class FacesModelSetTest extends InsyncTestBase {
049: public FacesModelSetTest(String testName) {
050: super (testName);
051: }
052:
053: public static void main(java.lang.String[] args) {
054: junit.textui.TestRunner.run(suite());
055: }
056:
057: public static Test suite() {
058: TestSuite suite = new NbTestSuite(FacesModelSetTest.class);
059: return suite;
060: }
061:
062: @Override
063: protected void setUp() throws Exception {
064: super .setUp();
065: }
066:
067: @Override
068: protected void tearDown() throws Exception {
069: super .tearDown();
070: }
071:
072: /**
073: * Test of startModeling method, of class FacesModelSet.
074: */
075: public void testStartModeling() {
076: System.out.println("startModeling");
077: FileObject f = getProject().getProjectDirectory();
078: final Object syncObject = new Object();
079: ModelSet.addModelSetsListener(new ModelSetsListener() {
080: public void modelSetAdded(ModelSet modelSet) {
081: Project project = modelSet.getProject();
082: if (project == getProject()) {
083: ModelSet.removeModelSetsListener(this );
084: synchronized (syncObject) {
085: syncObject.notify();
086: }
087: }
088: }
089:
090: public void modelSetRemoved(ModelSet modelSet) {
091: }
092: });
093:
094: FacesModelSet result = null;
095: synchronized (syncObject) {
096: result = FacesModelSet.startModeling(f);
097: assertNull(result);
098: try {
099: syncObject.wait();
100: } catch (InterruptedException ex) {
101: Exceptions.printStackTrace(ex);
102: }
103: //Try again, it should work
104: result = FacesModelSet.startModeling(f);
105: assertNotNull(result);
106: }
107: }
108:
109: /**
110: * Test of getInstance method, of class FacesModelSet.
111: */
112:
113: public void testGetInstance() {
114: System.out.println("getInstance");
115: FileObject file = getProject().getProjectDirectory();
116: FacesModelSet result = FacesModelSet.getInstance(file);
117: assertNotNull(result);
118: //Test subsequent get instance returns the same object reference
119: FacesModelSet result1 = FacesModelSet.getInstance(file);
120: assertSame(result, result1);
121: }
122:
123: /**
124: * Test of getFacesModels method, of class FacesModelSet.
125: */
126: public void testGetFacesModels() {
127: System.out.println("getFacesModels");
128: FacesModelSet instance = createFacesModelSet();
129: FacesModel[] result = instance.getFacesModels();
130: assertNotNull(result);
131: assertEquals(getBeansCount(), result.length);
132: }
133:
134: /**
135: * Test of findDesignContext method, of class FacesModelSet.
136: */
137: public void testFindDesignContext() {
138: System.out.println("findDesignContext");
139: FacesModelSet instance = createFacesModelSet();
140: for (String beanName : getBeanNames()) {
141: DesignContext dc = instance.findDesignContext(beanName);
142: assertNotNull(dc);
143: }
144: }
145:
146: /**
147: * Test of getDesignContexts method, of class FacesModelSet.
148: */
149: public void testGetDesignContexts() {
150: System.out.println("getDesignContexts");
151: FacesModelSet instance = createFacesModelSet();
152: DesignContext[] dcs = instance.getDesignContexts();
153: assertNotNull(dcs);
154: assertEquals(dcs.length, getBeansCount());
155: }
156:
157: /**
158: * Test of getFacesModelIfAvailable method, of class FacesModelSet.
159: */
160: public void testGetFacesModelIfAvailable() {
161: System.out.println("getFacesModelIfAvailable");
162: FileObject f = getJavaFile(getPageBeans()[0]);
163: FacesModel result = FacesModelSet.getFacesModelIfAvailable(f);
164: assertNull(result);
165: FacesModelSet instance = createFacesModelSet();
166: instance.syncAll();
167: result = FacesModelSet.getFacesModelIfAvailable(f);
168: assertNotNull(result);
169: }
170:
171: /**
172: * Test of destroy method, of class FacesModelSet.
173: */
174: public void testDestroy() {
175: System.out.println("destroy");
176: FacesModelSet instance = createFacesModelSet();
177: instance.syncAll();
178: assertEquals(instance.getFacesModels().length, getBeansCount());
179: assertEquals(instance.getDesignContexts().length,
180: getBeansCount());
181: instance.destroy();
182: assertEquals(instance.getFacesModels().length, 0);
183: assertEquals(instance.getDesignContexts().length, 0);
184: }
185:
186: /**
187: * Test of getFacesContainer method, of class FacesModelSet.
188: */
189: public void testGetFacesContainer() {
190: System.out.println("getFacesContainer");
191: FacesModelSet instance = createFacesModelSet();
192: FacesContainer result = instance.getFacesContainer();
193: assertNotNull(result);
194: }
195:
196: /**
197: * Test of getFacesConfigModel method, of class FacesModelSet.
198: */
199: public void testGetFacesConfigModel() {
200: System.out.println("getFacesConfigModel");
201: FacesModelSet instance = createFacesModelSet();
202: FacesConfigModel result = instance.getFacesConfigModel();
203: assertNotNull(result);
204: //result.getFile() should return the default config file
205: assertEquals(result.getFile().getName(), getFacesConfigs()[0]);
206: }
207:
208: /**
209: * Test of findDesignContexts method, of class FacesModelSet.
210: */
211: public void testFindDesignContexts() {
212: System.out.println("findDesignContexts");
213: FacesModelSet instance = createFacesModelSet();
214: String[] scopes = { "request", "session", "application" };
215: DesignContext[] result = instance.findDesignContexts(scopes);
216: assertEquals(result.length, getNonPageBeansCount());
217: }
218:
219: /**
220: * Test of getModel method, of class FacesModelSet.
221: */
222: public void testGetModel() {
223: System.out.println("getModel");
224: FacesModelSet instance = createFacesModelSet();
225: FacesModel[] models = instance.getFacesModels();
226: FileObject file = models[0].getFile();
227:
228: Model result = instance.getModel(file);
229: assertEquals(models[0], result);
230:
231: file = models[0].getJavaFile();
232: if (file != null) {
233: result = instance.getModel(file);
234: assertEquals(models[0], result);
235: }
236:
237: file = models[0].getMarkupFile();
238: if (file != null) {
239: result = instance.getModel(file);
240: assertEquals(models[0], result);
241: }
242: }
243:
244: /**
245: * Test of getFacesModel method, of class FacesModelSet.
246: */
247: public void testGetFacesModel() {
248: System.out.println("getFacesModel");
249: FacesModelSet instance = createFacesModelSet();
250: FacesModel[] models = instance.getFacesModels();
251: FileObject file = models[0].getFile();
252:
253: Model result = instance.getFacesModel(file);
254: assertEquals(models[0], result);
255:
256: file = models[0].getJavaFile();
257: if (file != null) {
258: result = instance.getFacesModel(file);
259: assertEquals(models[0], result);
260: }
261:
262: file = models[0].getMarkupFile();
263: if (file != null) {
264: result = instance.getFacesModel(file);
265: assertEquals(models[0], result);
266: }
267: }
268:
269: // /**
270: // * Test of updateBeanElReferences method, of class FacesModelSet.
271: // */
272: // public void testUpdateBeanElReferences() {
273: // System.out.println("updateBeanElReferences");
274: // String oldname = "";
275: // String newname = "";
276: // FacesModelSet instance = null;
277: // instance.updateBeanElReferences(oldname, newname);
278: // // TODO review the generated test code and remove the default call to fail.
279: // fail("The test case is a prototype.");
280: // }
281: //
282: // /**
283: // * Test of removeBeanElReferences method, of class FacesModelSet.
284: // */
285: // public void testRemoveBeanElReferences() {
286: // System.out.println("removeBeanElReferences");
287: // String oldname = "";
288: // FacesModelSet instance = null;
289: // instance.removeBeanElReferences(oldname);
290: // // TODO review the generated test code and remove the default call to fail.
291: // fail("The test case is a prototype.");
292: // }
293: //
294: // /**
295: // * Test of getBeanNamesToXRef method, of class FacesModelSet.
296: // */
297: // public void testGetBeanNamesToXRef() {
298: // System.out.println("getBeanNamesToXRef");
299: // Scope scope = null;
300: // FacesModel facesModel = null;
301: // FacesModelSet instance = null;
302: // Collection expResult = null;
303: // Collection result = instance.getBeanNamesToXRef(scope, facesModel);
304: // assertEquals(expResult, result);
305: // // TODO review the generated test code and remove the default call to fail.
306: // fail("The test case is a prototype.");
307: // }
308: //
309: // /**
310: // * Test of addPropertyChangeListener method, of class FacesModelSet.
311: // */
312: // public void testAddPropertyChangeListener() {
313: // System.out.println("addPropertyChangeListener");
314: // PropertyChangeListener propChangeListener = null;
315: // FacesModelSet instance = null;
316: // instance.addPropertyChangeListener(propChangeListener);
317: // // TODO review the generated test code and remove the default call to fail.
318: // fail("The test case is a prototype.");
319: // }
320: //
321: // /**
322: // * Test of removePropertyChangeListener method, of class FacesModelSet.
323: // */
324: // public void testRemovePropertyChangeListener() {
325: // System.out.println("removePropertyChangeListener");
326: // PropertyChangeListener propChangeListener = null;
327: // FacesModelSet instance = null;
328: // instance.removePropertyChangeListener(propChangeListener);
329: // // TODO review the generated test code and remove the default call to fail.
330: // fail("The test case is a prototype.");
331: // }
332: //
333: /**
334: * Test of getContextClassLoader method, of class FacesModelSet.
335: */
336: public void testGetContextClassLoader() {
337: System.out.println("getContextClassLoader");
338: FacesModelSet instance = createFacesModelSet();
339: ClassLoader result = instance.getContextClassLoader();
340: assertNotNull(result);
341: }
342:
343: //
344: //
345: //
346: // /**
347: // * Test of createDesignContext method, of class FacesModelSet.
348: // */
349: // public void testCreateDesignContext() {
350: // System.out.println("createDesignContext");
351: // String className = "";
352: // Class baseClass = null;
353: // Map contextData = null;
354: // FacesModelSet instance = null;
355: // DesignContext expResult = null;
356: // DesignContext result = instance.createDesignContext(className, baseClass, contextData);
357: // assertEquals(expResult, result);
358: // // TODO review the generated test code and remove the default call to fail.
359: // fail("The test case is a prototype.");
360: // }
361: //
362: /**
363: * Test of removeDesignContext method, of class FacesModelSet.
364: */
365: public void testRemoveDesignContext() {
366: System.out.println("removeDesignContext");
367: FacesModelSet instance = createFacesModelSet();
368: DesignContext[] contexts = instance.getDesignContexts();
369: LiveUnit lu = (LiveUnit) contexts[0];
370: String beanName = lu.getModel().getBeanName();
371: instance.syncAll();
372: assertNotNull(instance.facesConfigModel
373: .getManagedBean(beanName));
374: instance.removeDesignContext(lu);
375: assertEquals(contexts.length - 1,
376: instance.getDesignContexts().length);
377: assertNull(instance.facesConfigModel.getManagedBean(beanName));
378:
379: }
380:
381: // /**
382: // * Test of getResources method, of class FacesModelSet.
383: // */
384: // public void testGetResources() {
385: // System.out.println("getResources");
386: // URI folderUri = null;
387: // boolean recurseFolders = false;
388: // FacesModelSet instance = null;
389: // URI[] expResult = null;
390: // URI[] result = instance.getResources(folderUri, recurseFolders);
391: // assertEquals(expResult, result);
392: // // TODO review the generated test code and remove the default call to fail.
393: // fail("The test case is a prototype.");
394: // }
395: //
396: // /**
397: // * Test of getResourceFile method, of class FacesModelSet.
398: // */
399: // public void testGetResourceFile() {
400: // System.out.println("getResourceFile");
401: // URI resourceUri = null;
402: // FacesModelSet instance = null;
403: // File expResult = null;
404: // File result = instance.getResourceFile(resourceUri);
405: // assertEquals(expResult, result);
406: // // TODO review the generated test code and remove the default call to fail.
407: // fail("The test case is a prototype.");
408: // }
409: //
410: // /**
411: // * Test of addResource method, of class FacesModelSet.
412: // */
413: // public void testAddResource() throws Exception {
414: // System.out.println("addResource");
415: // URL sourceUrl = null;
416: // URI targetUri = null;
417: // FacesModelSet instance = null;
418: // URI expResult = null;
419: // URI result = instance.addResource(sourceUrl, targetUri);
420: // assertEquals(expResult, result);
421: // // TODO review the generated test code and remove the default call to fail.
422: // fail("The test case is a prototype.");
423: // }
424: //
425: /**
426: * Test of getProjectDirectory method, of class FacesModelSet.
427: */
428: public void testGetProjectDirectory() {
429: System.out.println("getProjectDirectory");
430: FacesModelSet instance = createFacesModelSet();
431: FileObject result = instance.getProjectDirectory();
432: assertEquals(result, getProject().getProjectDirectory());
433: }
434:
435: //
436: // /**
437: // * Test of getDocumentDirectory method, of class FacesModelSet.
438: // */
439: // public void testGetDocumentDirectory() {
440: // System.out.println("getDocumentDirectory");
441: // FacesModelSet instance = null;
442: // FileObject expResult = null;
443: // FileObject result = instance.getDocumentDirectory();
444: // assertEquals(expResult, result);
445: // // TODO review the generated test code and remove the default call to fail.
446: // fail("The test case is a prototype.");
447: // }
448: //
449: // /**
450: // * Test of getProjectDirectoryUri method, of class FacesModelSet.
451: // */
452: // public void testGetProjectDirectoryUri() {
453: // System.out.println("getProjectDirectoryUri");
454: // FacesModelSet instance = null;
455: // URI expResult = null;
456: // URI result = instance.getProjectDirectoryUri();
457: // assertEquals(expResult, result);
458: // // TODO review the generated test code and remove the default call to fail.
459: // fail("The test case is a prototype.");
460: // }
461: //
462: // /**
463: // * Test of relativize method, of class FacesModelSet.
464: // */
465: // public void testRelativize() {
466: // System.out.println("relativize");
467: // FileObject file = null;
468: // FacesModelSet instance = null;
469: // URI expResult = null;
470: // URI result = instance.relativize(file);
471: // assertEquals(expResult, result);
472: // // TODO review the generated test code and remove the default call to fail.
473: // fail("The test case is a prototype.");
474: // }
475: //
476: // /**
477: // * Test of resolveToFileObject method, of class FacesModelSet.
478: // */
479: // public void testResolveToFileObject() {
480: // System.out.println("resolveToFileObject");
481: // URI uri = null;
482: // FacesModelSet instance = null;
483: // FileObject expResult = null;
484: // FileObject result = instance.resolveToFileObject(uri);
485: // assertEquals(expResult, result);
486: // // TODO review the generated test code and remove the default call to fail.
487: // fail("The test case is a prototype.");
488: // }
489: //
490: // /**
491: // * Test of resolveToUri method, of class FacesModelSet.
492: // */
493: // public void testResolveToUri() {
494: // System.out.println("resolveToUri");
495: // URI uri = null;
496: // FacesModelSet instance = null;
497: // URI expResult = null;
498: // URI result = instance.resolveToUri(uri);
499: // assertEquals(expResult, result);
500: // // TODO review the generated test code and remove the default call to fail.
501: // fail("The test case is a prototype.");
502: // }
503: //
504: // /**
505: // * Test of resolveToUrl method, of class FacesModelSet.
506: // */
507: // public void testResolveToUrl() {
508: // System.out.println("resolveToUrl");
509: // URI uri = null;
510: // FacesModelSet instance = null;
511: // URL expResult = null;
512: // URL result = instance.resolveToUrl(uri);
513: // assertEquals(expResult, result);
514: // // TODO review the generated test code and remove the default call to fail.
515: // fail("The test case is a prototype.");
516: // }
517: //
518: // /**
519: // * Test of removeResource method, of class FacesModelSet.
520: // */
521: // public void testRemoveResource() {
522: // System.out.println("removeResource");
523: // URI resourceUri = null;
524: // FacesModelSet instance = null;
525: // boolean expResult = false;
526: // boolean result = instance.removeResource(resourceUri);
527: // assertEquals(expResult, result);
528: // // TODO review the generated test code and remove the default call to fail.
529: // fail("The test case is a prototype.");
530: // }
531: //
532: // /**
533: // * Test of setProjectData method, of class FacesModelSet.
534: // */
535: // public void testSetProjectData() {
536: // System.out.println("setProjectData");
537: // String key = "";
538: // Object data = null;
539: // FacesModelSet instance = null;
540: // instance.setProjectData(key, data);
541: // // TODO review the generated test code and remove the default call to fail.
542: // fail("The test case is a prototype.");
543: // }
544: //
545: // /**
546: // * Test of getProjectData method, of class FacesModelSet.
547: // */
548: // public void testGetProjectData() {
549: // System.out.println("getProjectData");
550: // String key = "";
551: // FacesModelSet instance = null;
552: // Object expResult = null;
553: // Object result = instance.getProjectData(key);
554: // assertEquals(expResult, result);
555: // // TODO review the generated test code and remove the default call to fail.
556: // fail("The test case is a prototype.");
557: // }
558: //
559: // /**
560: // * Test of flushProjectData method, of class FacesModelSet.
561: // */
562: // public void testFlushProjectData() {
563: // System.out.println("flushProjectData");
564: // FacesModelSet instance = null;
565: // instance.flushProjectData();
566: // // TODO review the generated test code and remove the default call to fail.
567: // fail("The test case is a prototype.");
568: // }
569: //
570: // /**
571: // * Test of setGlobalData method, of class FacesModelSet.
572: // */
573: // public void testSetGlobalData() {
574: // System.out.println("setGlobalData");
575: // String key = "";
576: // Object data = null;
577: // FacesModelSet instance = null;
578: // instance.setGlobalData(key, data);
579: // // TODO review the generated test code and remove the default call to fail.
580: // fail("The test case is a prototype.");
581: // }
582: //
583: // /**
584: // * Test of getGlobalData method, of class FacesModelSet.
585: // */
586: // public void testGetGlobalData() {
587: // System.out.println("getGlobalData");
588: // String key = "";
589: // FacesModelSet instance = null;
590: // Object expResult = null;
591: // Object result = instance.getGlobalData(key);
592: // assertEquals(expResult, result);
593: // // TODO review the generated test code and remove the default call to fail.
594: // fail("The test case is a prototype.");
595: // }
596: //
597: // /**
598: // * Test of getDisplayName method, of class FacesModelSet.
599: // */
600: // public void testGetDisplayName() {
601: // System.out.println("getDisplayName");
602: // FacesModelSet instance = null;
603: // String expResult = "";
604: // String result = instance.getDisplayName();
605: // assertEquals(expResult, result);
606: // // TODO review the generated test code and remove the default call to fail.
607: // fail("The test case is a prototype.");
608: // }
609: //
610: // /**
611: // * Test of getDescription method, of class FacesModelSet.
612: // */
613: // public void testGetDescription() {
614: // System.out.println("getDescription");
615: // FacesModelSet instance = null;
616: // String expResult = "";
617: // String result = instance.getDescription();
618: // assertEquals(expResult, result);
619: // // TODO review the generated test code and remove the default call to fail.
620: // fail("The test case is a prototype.");
621: // }
622: //
623: // /**
624: // * Test of getLargeIcon method, of class FacesModelSet.
625: // */
626: // public void testGetLargeIcon() {
627: // System.out.println("getLargeIcon");
628: // FacesModelSet instance = null;
629: // Image expResult = null;
630: // Image result = instance.getLargeIcon();
631: // assertEquals(expResult, result);
632: // // TODO review the generated test code and remove the default call to fail.
633: // fail("The test case is a prototype.");
634: // }
635: //
636: // /**
637: // * Test of getSmallIcon method, of class FacesModelSet.
638: // */
639: // public void testGetSmallIcon() {
640: // System.out.println("getSmallIcon");
641: // FacesModelSet instance = null;
642: // Image expResult = null;
643: // Image result = instance.getSmallIcon();
644: // assertEquals(expResult, result);
645: // // TODO review the generated test code and remove the default call to fail.
646: // fail("The test case is a prototype.");
647: // }
648: //
649: // /**
650: // * Test of getHelpKey method, of class FacesModelSet.
651: // */
652: // public void testGetHelpKey() {
653: // System.out.println("getHelpKey");
654: // FacesModelSet instance = null;
655: // String expResult = "";
656: // String result = instance.getHelpKey();
657: // assertEquals(expResult, result);
658: // // TODO review the generated test code and remove the default call to fail.
659: // fail("The test case is a prototype.");
660: // }
661: //
662: // /**
663: // * Test of classPathChanged method, of class FacesModelSet.
664: // */
665: // public void testClassPathChanged() {
666: // System.out.println("classPathChanged");
667: // FacesModelSet instance = null;
668: // instance.classPathChanged();
669: // // TODO review the generated test code and remove the default call to fail.
670: // fail("The test case is a prototype.");
671: // }
672: //
673: // /**
674: // * Test of addDesignProjectListener method, of class FacesModelSet.
675: // */
676: // public void testAddDesignProjectListener() {
677: // System.out.println("addDesignProjectListener");
678: // DesignProjectListener listener = null;
679: // FacesModelSet instance = null;
680: // instance.addDesignProjectListener(listener);
681: // // TODO review the generated test code and remove the default call to fail.
682: // fail("The test case is a prototype.");
683: // }
684: //
685: // /**
686: // * Test of removeDesignProjectListener method, of class FacesModelSet.
687: // */
688: // public void testRemoveDesignProjectListener() {
689: // System.out.println("removeDesignProjectListener");
690: // DesignProjectListener listener = null;
691: // FacesModelSet instance = null;
692: // instance.removeDesignProjectListener(listener);
693: // // TODO review the generated test code and remove the default call to fail.
694: // fail("The test case is a prototype.");
695: // }
696: //
697: // /**
698: // * Test of getDesignProjectListeners method, of class FacesModelSet.
699: // */
700: // public void testGetDesignProjectListeners() {
701: // System.out.println("getDesignProjectListeners");
702: // FacesModelSet instance = null;
703: // DesignProjectListener[] expResult = null;
704: // DesignProjectListener[] result = instance.getDesignProjectListeners();
705: // assertEquals(expResult, result);
706: // // TODO review the generated test code and remove the default call to fail.
707: // fail("The test case is a prototype.");
708: // }
709: //
710: // /**
711: // * Test of hasDesignProjectListeners method, of class FacesModelSet.
712: // */
713: // public void testHasDesignProjectListeners() {
714: // System.out.println("hasDesignProjectListeners");
715: // FacesModelSet instance = null;
716: // boolean expResult = false;
717: // boolean result = instance.hasDesignProjectListeners();
718: // assertEquals(expResult, result);
719: // // TODO review the generated test code and remove the default call to fail.
720: // fail("The test case is a prototype.");
721: // }
722: //
723: // /**
724: // * Test of fireContextOpened method, of class FacesModelSet.
725: // */
726: // public void testFireContextOpened() {
727: // System.out.println("fireContextOpened");
728: // DesignContext context = null;
729: // FacesModelSet instance = null;
730: // instance.fireContextOpened(context);
731: // // TODO review the generated test code and remove the default call to fail.
732: // fail("The test case is a prototype.");
733: // }
734: //
735: // /**
736: // * Test of fireContextClosed method, of class FacesModelSet.
737: // */
738: // public void testFireContextClosed() {
739: // System.out.println("fireContextClosed");
740: // DesignContext context = null;
741: // FacesModelSet instance = null;
742: // instance.fireContextClosed(context);
743: // // TODO review the generated test code and remove the default call to fail.
744: // fail("The test case is a prototype.");
745: // }
746: //
747: // /**
748: // * Test of evalOrderModels method, of class FacesModelSet.
749: // */
750: // public void testEvalOrderModels() {
751: // System.out.println("evalOrderModels");
752: // Collection modelsToOrder = null;
753: // FacesModelSet instance = null;
754: // Collection expResult = null;
755: // Collection result = instance.evalOrderModels(modelsToOrder);
756: // assertEquals(expResult, result);
757: // // TODO review the generated test code and remove the default call to fail.
758: // fail("The test case is a prototype.");
759: // }
760: //
761: /**
762: * Test of removeModel method, of class FacesModelSet.
763: */
764: public void testRemoveModel() {
765: System.out.println("removeModel");
766: FacesModelSet instance = createFacesModelSet();
767: FacesModel[] models = instance.getFacesModels();
768: instance.removeModel(models[0]);
769: assertEquals(models.length - 1,
770: instance.getFacesModels().length);
771: }
772:
773: //
774: // /**
775: // * Test of getJavaRootFolder method, of class FacesModelSet.
776: // */
777: // public void testGetJavaRootFolder() {
778: // System.out.println("getJavaRootFolder");
779: // FacesModelSet instance = null;
780: // FileObject expResult = null;
781: // FileObject result = instance.getJavaRootFolder();
782: // assertEquals(expResult, result);
783: // // TODO review the generated test code and remove the default call to fail.
784: // fail("The test case is a prototype.");
785: // }
786: //
787: // /**
788: // * Test of getPageJavaRootFolder method, of class FacesModelSet.
789: // */
790: // public void testGetPageJavaRootFolder() {
791: // System.out.println("getPageJavaRootFolder");
792: // FacesModelSet instance = null;
793: // FileObject expResult = null;
794: // FileObject result = instance.getPageJavaRootFolder();
795: // assertEquals(expResult, result);
796: // // TODO review the generated test code and remove the default call to fail.
797: // fail("The test case is a prototype.");
798: // }
799: //
800: // /**
801: // * Test of getPageJspRootFolder method, of class FacesModelSet.
802: // */
803: // public void testGetPageJspRootFolder() {
804: // System.out.println("getPageJspRootFolder");
805: // FacesModelSet instance = null;
806: // FileObject expResult = null;
807: // FileObject result = instance.getPageJspRootFolder();
808: // assertEquals(expResult, result);
809: // // TODO review the generated test code and remove the default call to fail.
810: // fail("The test case is a prototype.");
811: // }
812: //
813: // /**
814: // * Test of getJavaFolderFor method, of class FacesModelSet.
815: // */
816: // public void testGetJavaFolderFor() {
817: // System.out.println("getJavaFolderFor");
818: // FileObject other = null;
819: // boolean tryHard = false;
820: // FacesModelSet instance = null;
821: // FileObject expResult = null;
822: // FileObject result = instance.getJavaFolderFor(other, tryHard);
823: // assertEquals(expResult, result);
824: // // TODO review the generated test code and remove the default call to fail.
825: // fail("The test case is a prototype.");
826: // }
827: //
828: /**
829: * Test of syncAll method, of class FacesModelSet.
830: */
831: public void testSyncAll() {
832: System.out.println("syncAll");
833: FacesModelSet instance = createFacesModelSet();
834: FacesModel[] models = instance.getFacesModels();
835: for (FacesModel model : models) {
836: assertNull(model.getLiveUnit());
837: }
838: instance.syncAll();
839: for (FacesModel model : models) {
840: assertNotNull(model.getLiveUnit());
841: }
842: }
843:
844: }
|