Source Code Cross Referenced for StatsQueryTest.java in  » Web-Framework » vraptor » org » vraptor » util » 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 » Web Framework » vraptor » org.vraptor.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.vraptor.util;
002:
003:        import java.util.Collection;
004:        import java.util.List;
005:        import java.util.Map;
006:
007:        import org.vraptor.AbstractTest;
008:        import org.vraptor.annotations.In;
009:        import org.vraptor.component.BeanConstructor;
010:        import org.vraptor.component.ComponentInstantiationException;
011:        import org.vraptor.component.ComponentType;
012:        import org.vraptor.component.FieldAnnotation;
013:        import org.vraptor.component.InvalidComponentException;
014:        import org.vraptor.component.LogicMethod;
015:        import org.vraptor.component.LogicNotFoundException;
016:        import org.vraptor.interceptor.InterceptorType;
017:        import org.vraptor.introspector.BeanProvider;
018:        import org.vraptor.introspector.ReadParameter;
019:        import org.vraptor.plugin.VRaptorPlugin;
020:        import org.vraptor.reflection.GettingException;
021:        import org.vraptor.reflection.MethodInvocationException;
022:        import org.vraptor.scope.ScopeType;
023:        import org.vraptor.util.StatsQuery.ComponentTypeNameComparator;
024:        import org.vraptor.webapp.DefaultWebApplication;
025:        import org.vraptor.webapp.WebApplication;
026:
027:        public class StatsQueryTest extends AbstractTest {
028:
029:            public void testLogicName() throws InvalidComponentException,
030:                    ComponentInstantiationException, LogicNotFoundException {
031:
032:                boolean found = false;
033:                ComponentType statsQuery = registry.getComponentManager()
034:                        .getComponentType(StatsQuery.class);
035:
036:                for (LogicMethod logic : statsQuery.getLogics()) {
037:                    if ("read".equals(logic.getName())) {
038:                        found = true;
039:                    }
040:                }
041:
042:                assertTrue("Logic name read not found", found);
043:            }
044:
045:            public void testChecksDifferentComponentsGetSortedByName() {
046:                StatsQuery query = new StatsQuery(createApp());
047:                ComponentTypeNameComparator comp = query.new ComponentTypeNameComparator();
048:                assertTrue(comp.compare(new MockType("a"), new MockType("b")) < 0);
049:            }
050:
051:            private WebApplication createApp() {
052:                return new DefaultWebApplication(createServletContext());
053:            }
054:
055:            public void testSortsComponentsWithSameName() {
056:                StatsQuery query = new StatsQuery(createApp());
057:                ComponentTypeNameComparator comp = query.new ComponentTypeNameComparator();
058:                assertTrue(comp.compare(new MockType("a"), new MockType("a")) == 0);
059:            }
060:
061:            class MockType implements  ComponentType {
062:
063:                private String name;
064:
065:                public MockType(String n) {
066:                    this .name = n;
067:                }
068:
069:                public Class getComponentClass() {
070:                    return null;
071:                }
072:
073:                public String getDestroyLogicName() {
074:                    return null;
075:                }
076:
077:                public List<FieldAnnotation<In>> getInAnnotations() {
078:                    return null;
079:                }
080:
081:                public List<InterceptorType> getInterceptors() {
082:                    return null;
083:                }
084:
085:                public String getKey() {
086:                    return null;
087:                }
088:
089:                public LogicMethod getLogic(String key)
090:                        throws LogicNotFoundException {
091:                    return null;
092:                }
093:
094:                public Collection<LogicMethod> getLogics() {
095:                    return null;
096:                }
097:
098:                public String getName() {
099:                    return name;
100:                }
101:
102:                public List<ReadParameter> getReadParameters() {
103:                    return null;
104:                }
105:
106:                public ScopeType getScope() {
107:                    return null;
108:                }
109:
110:                public Object newInstance(BeanProvider provider)
111:                        throws ComponentInstantiationException {
112:                    return null;
113:                }
114:
115:                public Map<String, Object> getOutjectedValues(Object comp,
116:                        ScopeType scope) throws GettingException,
117:                        MethodInvocationException {
118:                    return null;
119:                }
120:
121:                public BeanConstructor getConstructor() {
122:                    return null;
123:                }
124:
125:            }
126:
127:            public void testOutjectsAllComponents()
128:                    throws InvalidComponentException, LogicNotFoundException {
129:                WebApplication app = createApp();
130:                ComponentType c = createComponentType(Component.class);
131:                app.getComponentManager().register(c);
132:                StatsQuery query = new StatsQuery(app);
133:                query.read();
134:                assertTrue(query.getComponents().contains(c));
135:            }
136:
137:            public void testOutjectsAllPlugins()
138:                    throws InvalidComponentException {
139:                WebApplication app = createApp();
140:                SimplePlugin plugin = new SimplePlugin();
141:                app.getPluginManager().register(plugin);
142:                StatsQuery query = new StatsQuery(app);
143:                query.read();
144:                assertTrue(query.getPlugins().contains(plugin));
145:            }
146:
147:            public static class SimplePlugin implements  VRaptorPlugin {
148:                public void init(WebApplication application) {
149:                }
150:            }
151:
152:            public static class Component {
153:                public void logic() {
154:                }
155:            }
156:
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.