Source Code Cross Referenced for JsfJspDataObjectTest.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » project » jsfloader » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.project.jsfloader 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:         * If you wish your version of this file to be governed by only the CDDL
025:         * or only the GPL Version 2, indicate your decision by adding
026:         * "[Contributor] elects to include this software in this distribution
027:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
028:         * single choice of license, a recipient has the option to distribute
029:         * your version of this file under either the CDDL, the GPL Version 2 or
030:         * to extend the choice of license to its licensees as provided above.
031:         * However, if you add GPL Version 2 code and therefore, elected the GPL
032:         * Version 2 license, then the option applies only if the new code is
033:         * made subject to such option by the copyright holder.
034:         * 
035:         * Contributor(s):
036:         * 
037:         * Portions Copyrighted 2007 Sun Microsystems, Inc.
038:         */
039:
040:        package org.netbeans.modules.visualweb.project.jsfloader;
041:
042:        import org.netbeans.api.project.Project;
043:        import org.netbeans.junit.NbTestCase;
044:        import org.netbeans.modules.visualweb.project.jsfloader.test.SetupUtils;
045:        import org.netbeans.modules.web.core.jsploader.api.TagLibParseCookie;
046:        import org.openide.cookies.EditCookie;
047:        import org.openide.cookies.EditorCookie;
048:        import org.openide.cookies.OpenCookie;
049:        import org.openide.filesystems.FileObject;
050:        import org.openide.filesystems.FileUtil;
051:        import org.openide.loaders.DataObject;
052:        import org.openide.util.Lookup;
053:        import org.openide.util.test.MockLookup;
054:
055:        /**
056:         *
057:         * @author quynguyen
058:         */
059:        public class JsfJspDataObjectTest extends NbTestCase {
060:            private Project project;
061:            private FileObject projectRoot;
062:
063:            public JsfJspDataObjectTest(String testName) {
064:                super (testName);
065:            }
066:
067:            @Override
068:            protected void setUp() throws Exception {
069:                super .setUp();
070:
071:                project = SetupUtils.setup(getWorkDir());
072:                projectRoot = FileUtil.toFileObject(getWorkDir())
073:                        .getFileObject("VWJavaEE5");
074:
075:                assertNotNull("Project should not be null", project);
076:                assertNotNull("Project root folder should not be null",
077:                        projectRoot);
078:            }
079:
080:            @Override
081:            protected void tearDown() throws Exception {
082:                super .tearDown();
083:                project = null;
084:                projectRoot = null;
085:
086:                MockLookup.setInstances();
087:            }
088:
089:            public void testFindPrimaryFile() throws Exception {
090:                System.out.println("JsfJspDataLoader.findPrimaryFile");
091:                FileObject webFolder = projectRoot.getFileObject("web");
092:                FileObject pageBean = projectRoot
093:                        .getFileObject("web/Page1.jsp");
094:                FileObject plainJsp = projectRoot
095:                        .getFileObject("web/index.jsp");
096:
097:                assertNotNull("webFolder FileObject should not be null",
098:                        webFolder);
099:                assertNotNull("pageBean FileObject should not be null",
100:                        pageBean);
101:                assertNotNull("plainJsp FileObject should not be null",
102:                        plainJsp);
103:
104:                JsfJspDataLoader loader = SetupUtils.getJspLoader();
105:
106:                FileObject result1 = loader.findPrimaryFile(pageBean);
107:                assertEquals("findPrimaryFile() on web/Page1.jsp did not work",
108:                        result1, pageBean);
109:
110:                FileObject result2 = loader.findPrimaryFile(webFolder);
111:                assertNull(
112:                        "findPrimaryFile() should not accept folder objects",
113:                        result2);
114:
115:                FileObject result3 = loader.findPrimaryFile(plainJsp);
116:                assertNull(
117:                        "FindPrimaryFile() should not accept non-visual web JSP files",
118:                        result3);
119:            }
120:
121:            /**
122:             * Test of getLookup method, of class JsfJspDataObject.
123:             */
124:            public void testGetLookup() throws Exception {
125:                System.out.println("getLookup");
126:                FileObject jspPage = projectRoot.getFileObject("web/Page1.jsp");
127:                JsfJspDataObject instance = (JsfJspDataObject) DataObject
128:                        .find(jspPage);
129:
130:                // test validity of lookup results
131:                Lookup result = instance.getLookup();
132:                JsfJspEditorSupport support = result
133:                        .lookup(JsfJspEditorSupport.class);
134:                OpenCookie openCookie = result.lookup(OpenCookie.class);
135:                EditCookie editCookie = result.lookup(EditCookie.class);
136:                EditorCookie editorCookie = result.lookup(EditorCookie.class);
137:                TagLibParseCookie tagLibParseCookie = result
138:                        .lookup(TagLibParseCookie.class);
139:
140:                assertNotNull("OpenCookie is null", openCookie);
141:                assertNotNull("EditCookie is null", editCookie);
142:                assertNotNull("EditorCookie is null", editorCookie);
143:                assertNotNull("TagLibParseCookie is null", tagLibParseCookie);
144:                assertNotNull("JsfJspEditorSupport is null", support);
145:
146:                assertEquals(
147:                        "getLookup and getCookie should return the same OpenCookie",
148:                        openCookie, instance.getCookie(OpenCookie.class));
149:                assertEquals(
150:                        "getLookup and getCookie should return the same EditCookie",
151:                        editCookie, instance.getCookie(EditCookie.class));
152:                assertEquals(
153:                        "getLookup and getCookie should return the same EditorCookie",
154:                        editorCookie, instance.getCookie(EditorCookie.class));
155:                assertEquals(
156:                        "getLookup and getCookie should return the same TagLibParseCookie",
157:                        tagLibParseCookie, instance
158:                                .getCookie(TagLibParseCookie.class));
159:                assertEquals(
160:                        "getLookup and getCookie should return the same JsfJspEditorSupport",
161:                        support, instance.getCookie(JsfJspEditorSupport.class));
162:            }
163:
164:            public void testGetCookie() throws Exception {
165:                System.out.println("getCookie");
166:                FileObject jspPage = projectRoot.getFileObject("web/Page1.jsp");
167:                JsfJspDataObject instance = (JsfJspDataObject) DataObject
168:                        .find(jspPage);
169:
170:                // test getCookie
171:                EditorCookie editorCookie = instance
172:                        .getCookie(EditorCookie.class);
173:                OpenCookie openCookie = instance.getCookie(OpenCookie.class);
174:                EditCookie editCookie = instance.getCookie(EditCookie.class);
175:
176:                assertNotNull("OpenCookie is null", openCookie);
177:                assertNotNull("EditCookie is null", editCookie);
178:                assertNotNull("EditorCookie is null", editorCookie);
179:
180:                Lookup lookup = instance.getLookup();
181:
182:                assertEquals(
183:                        "getLookup and getCookie should return the same OpenCookie",
184:                        openCookie, lookup.lookup(OpenCookie.class));
185:                assertEquals(
186:                        "getLookup and getCookie should return the same EditCookie",
187:                        editCookie, lookup.lookup(EditCookie.class));
188:                assertEquals(
189:                        "getLookup and getCookie should return the same EditorCookie",
190:                        editorCookie, lookup.lookup(EditorCookie.class));
191:            }
192:
193:            public void testCorrespondingJsfJava() throws Exception {
194:                System.out.println("correspondingJsfJavaFile");
195:                FileObject jspPage = projectRoot.getFileObject("web/Page1.jsp");
196:                JsfJspDataObject instance = (JsfJspDataObject) DataObject
197:                        .find(jspPage);
198:                FileObject javaSrc = Utils.findJavaForJsp(instance
199:                        .getPrimaryFile());
200:                DataObject dobj = DataObject.find(javaSrc);
201:                assertTrue("Corresponding java file needs to be JSF",
202:                        dobj instanceof  JsfJavaDataObject);
203:            }
204:
205:            //    /**
206:            //     * Test of createNodeDelegate method, of class JsfJspDataObject.
207:            //     */
208:            //    public void testCreateNodeDelegate() {
209:            //        System.out.println("createNodeDelegate");
210:            //        JsfJspDataObject instance = null;
211:            //        Node expResult = null;
212:            //        Node result = instance.createNodeDelegate();
213:            //        assertEquals(expResult, result);
214:            //        // TODO review the generated test code and remove the default call to fail.
215:            //        fail("The test case is a prototype.");
216:            //    }
217:            //
218:            //    /**
219:            //     * Test of getHelpCtx method, of class JsfJspDataObject.
220:            //     */
221:            //    public void testGetHelpCtx() {
222:            //        System.out.println("getHelpCtx");
223:            //        JsfJspDataObject instance = null;
224:            //        HelpCtx expResult = null;
225:            //        HelpCtx result = instance.getHelpCtx();
226:            //        assertEquals(expResult, result);
227:            //        // TODO review the generated test code and remove the default call to fail.
228:            //        fail("The test case is a prototype.");
229:            //    }
230:            //
231:            //    /**
232:            //     * Test of createCookie method, of class JsfJspDataObject.
233:            //     */
234:            //    public void testCreateCookie() {
235:            //        System.out.println("createCookie");
236:            //        Class klass = null;
237:            //        JsfJspDataObject instance = null;
238:            //        Cookie expResult = null;
239:            //        Cookie result = instance.createCookie(klass);
240:            //        assertEquals(expResult, result);
241:            //        // TODO review the generated test code and remove the default call to fail.
242:            //        fail("The test case is a prototype.");
243:            //    }
244:            //
245:            //    /**
246:            //     * Test of getCookieSet0 method, of class JsfJspDataObject.
247:            //     */
248:            //    public void testGetCookieSet0() {
249:            //        System.out.println("getCookieSet0");
250:            //        JsfJspDataObject instance = null;
251:            //        CookieSet expResult = null;
252:            //        CookieSet result = instance.getCookieSet0();
253:            //        assertEquals(expResult, result);
254:            //        // TODO review the generated test code and remove the default call to fail.
255:            //        fail("The test case is a prototype.");
256:            //    }
257:            //
258:            //
259:            //    /**
260:            //     * Test of getPureCookie method, of class JsfJspDataObject.
261:            //     */
262:            //    public void testGetPureCookie() {
263:            //        System.out.println("getPureCookie");
264:            //        Class clazz = null;
265:            //        JsfJspDataObject instance = null;
266:            //        Cookie expResult = null;
267:            //        Cookie result = instance.getPureCookie(clazz);
268:            //        assertEquals(expResult, result);
269:            //        // TODO review the generated test code and remove the default call to fail.
270:            //        fail("The test case is a prototype.");
271:            //    }
272:            //
273:            //    /**
274:            //     * Test of getCookie method, of class JsfJspDataObject.
275:            //     */
276:            //    public void testGetCookie() {
277:            //        System.out.println("getCookie");
278:            //        Class clazz = null;
279:            //        JsfJspDataObject instance = null;
280:            //        Cookie expResult = null;
281:            //        Cookie result = instance.getCookie(clazz);
282:            //        assertEquals(expResult, result);
283:            //        // TODO review the generated test code and remove the default call to fail.
284:            //        fail("The test case is a prototype.");
285:            //    }
286:            //
287:            //    /**
288:            //     * Test of getFileEncoding method, of class JsfJspDataObject.
289:            //     */
290:            //    public void testGetFileEncoding() {
291:            //        System.out.println("getFileEncoding");
292:            //        JsfJspDataObject instance = null;
293:            //        String expResult = "";
294:            //        String result = instance.getFileEncoding();
295:            //        assertEquals(expResult, result);
296:            //        // TODO review the generated test code and remove the default call to fail.
297:            //        fail("The test case is a prototype.");
298:            //    }
299:            //
300:            //    /**
301:            //     * Test of updateFileEncoding method, of class JsfJspDataObject.
302:            //     */
303:            //    public void testUpdateFileEncoding() {
304:            //        System.out.println("updateFileEncoding");
305:            //        boolean fromEditor = false;
306:            //        JsfJspDataObject instance = null;
307:            //        instance.updateFileEncoding(fromEditor);
308:            //        // TODO review the generated test code and remove the default call to fail.
309:            //        fail("The test case is a prototype.");
310:            //    }
311:            //
312:            //    /**
313:            //     * Test of pureCopy method, of class JsfJspDataObject.
314:            //     */
315:            //    public void testPureCopy() throws Exception {
316:            //        System.out.println("pureCopy");
317:            //        DataFolder folder = null;
318:            //        JsfJspDataObject instance = null;
319:            //        instance.pureCopy(folder);
320:            //        // TODO review the generated test code and remove the default call to fail.
321:            //        fail("The test case is a prototype.");
322:            //    }
323:            //
324:            //
325:            //    /**
326:            //     * Test of handleDelete method, of class JsfJspDataObject.
327:            //     */
328:            //    public void testHandleDelete() throws Exception {
329:            //        System.out.println("handleDelete");
330:            //        JsfJspDataObject instance = null;
331:            //        instance.handleDelete();
332:            //        // TODO review the generated test code and remove the default call to fail.
333:            //        fail("The test case is a prototype.");
334:            //    }
335:            //
336:            //    /**
337:            //     * Test of handleCreateFromTemplate method, of class JsfJspDataObject.
338:            //     */
339:            //    public void testHandleCreateFromTemplate() throws Exception {
340:            //        System.out.println("handleCreateFromTemplate");
341:            //        DataFolder df = null;
342:            //        String name = "";
343:            //        JsfJspDataObject instance = null;
344:            //        DataObject expResult = null;
345:            //        DataObject result = instance.handleCreateFromTemplate(df, name);
346:            //        assertEquals(expResult, result);
347:            //        // TODO review the generated test code and remove the default call to fail.
348:            //        fail("The test case is a prototype.");
349:            //    }
350:            //
351:            //    /**
352:            //     * Test of handleRename method, of class JsfJspDataObject.
353:            //     */
354:            //    public void testHandleRename() throws Exception {
355:            //        System.out.println("handleRename");
356:            //        String name = "";
357:            //        JsfJspDataObject instance = null;
358:            //        FileObject expResult = null;
359:            //        FileObject result = instance.handleRename(name);
360:            //        assertEquals(expResult, result);
361:            //        // TODO review the generated test code and remove the default call to fail.
362:            //        fail("The test case is a prototype.");
363:            //    }
364:
365:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.