Source Code Cross Referenced for ConfigurationTest.java in  » UML » AndroMDA-3.2 » org » andromda » core » configuration » 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 » UML » AndroMDA 3.2 » org.andromda.core.configuration 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.core.configuration;
002:
003:        import java.net.URL;
004:
005:        import junit.framework.TestCase;
006:
007:        /**
008:         * JUnit test for {@link org.andromda.core.configuration.Configuration}
009:         *
010:         * @author Chad Brandon
011:         */
012:        public class ConfigurationTest extends TestCase {
013:            public void testGetInstance() {
014:                URL uri = ConfigurationTest.class
015:                        .getResource("configuration.xml");
016:                assertNotNull(uri);
017:                Configuration configuration = Configuration.getInstance(uri);
018:                assertNotNull(configuration);
019:
020:                // initialize the configuration
021:                configuration.initialize();
022:
023:                // properties
024:                assertEquals(2, configuration.getProperties().length);
025:                final Property property1 = configuration.getProperties()[0];
026:                assertEquals("modelValidation", property1.getName());
027:                assertEquals("true", property1.getValue());
028:                final Property property2 = configuration.getProperties()[1];
029:                assertEquals("cartridgeFilter", property2.getName());
030:                assertEquals("${filter}", property2.getValue());
031:
032:                // server
033:                final Server server = configuration.getServer();
034:                assertNotNull(server);
035:                assertEquals("localhost", server.getHost());
036:                assertEquals(4444, server.getPort());
037:                assertEquals(5000, server.getLoadInterval());
038:                assertEquals(50, server.getMaximumFailedLoadAttempts());
039:
040:                // repositories
041:                assertEquals(1, configuration.getRepositories().length);
042:                final Repository repository = configuration.getRepositories()[0];
043:                assertNotNull(repository);
044:                assertEquals("test", repository.getName());
045:
046:                // models
047:                assertEquals(3, repository.getModels().length);
048:                final Model model1 = repository.getModels()[0];
049:                assertNotNull(model1);
050:                assertEquals(2, model1.getUris().length);
051:                assertEquals("file:model1Uri1.xmi", model1.getUris()[0]);
052:                assertEquals("file:model1Uri2.xmi", model1.getUris()[1]);
053:                assertTrue(model1.isLastModifiedCheck());
054:                assertEquals(2, model1.getModuleSearchLocations().length);
055:
056:                // module search locations        
057:                final Location[] moduleLocations = model1
058:                        .getModuleSearchLocations();
059:                assertNotNull(moduleLocations);
060:                assertEquals(2, moduleLocations.length);
061:                assertEquals("/path/to/model/modules1", moduleLocations[0]
062:                        .getPath());
063:                assertEquals("*.xmi, *.xml.zip", moduleLocations[0]
064:                        .getPatterns());
065:                assertEquals("/path/to/model/modules2", moduleLocations[1]
066:                        .getPath());
067:                assertNull(moduleLocations[1].getPatterns());
068:                assertEquals(2, model1.getModuleSearchLocationPaths().length);
069:                assertEquals("/path/to/model/modules1", model1
070:                        .getModuleSearchLocationPaths()[0]);
071:                assertEquals("/path/to/model/modules2", model1
072:                        .getModuleSearchLocationPaths()[1]);
073:
074:                // modelPackages
075:                assertNotNull(model1.getPackages());
076:                assertFalse(model1.getPackages().isApply("some::package"));
077:                assertFalse(model1.getPackages().isApply(
078:                        "org::andromda::metafacades::uml"));
079:                assertTrue(model1.getPackages().isApply(
080:                        "org::andromda::cartridges::test"));
081:
082:                assertNotNull(model1.getConstraints());
083:                assertFalse(model1
084:                        .getConstraints()
085:                        .isApply(
086:                                "org::andromda::uml::metafacades::Entity::constraint name"));
087:                assertFalse(model1
088:                        .getConstraints()
089:                        .isApply(
090:                                "org::andromda::uml::somepackage::anotherpackage::andanotherpackage::SomeClass"));
091:                assertFalse(model1
092:                        .getConstraints()
093:                        .isApply(
094:                                "org::project::package::somepackage::anotherpackage::andanotherpackage::SomeClass"));
095:                assertTrue(model1
096:                        .getConstraints()
097:                        .isApply(
098:                                "org::project::package::some2package::anotherpackage::SomeClass"));
099:                assertFalse(model1.getConstraints().isApply(
100:                        "andromda::com::package::somepackage"));
101:                assertFalse(model1.getConstraints().isApply(
102:                        "com::package::SomeClass"));
103:                assertTrue(model1.getConstraints().isApply(
104:                        "com::apackage::SomeClass"));
105:                assertTrue(model1.getConstraints().isApply(
106:                        "org::andromda::uml::metafacades::Service"));
107:                assertTrue(model1.getConstraints().isApply("some:Entity"));
108:
109:                // transformations
110:                assertEquals(2, model1.getTransformations().length);
111:                final Transformation transformation1 = model1
112:                        .getTransformations()[0];
113:                assertNotNull(transformation1);
114:                assertEquals("file:transformation1.xsl", transformation1
115:                        .getUri());
116:                assertEquals("path/to/some/directory/transformed-model.xmi",
117:                        transformation1.getOutputLocation());
118:                final Transformation transformation2 = model1
119:                        .getTransformations()[1];
120:                assertNotNull(transformation2);
121:                assertEquals("file:transformation2.xsl", transformation2
122:                        .getUri());
123:
124:                final Model model2 = repository.getModels()[1];
125:                assertNotNull(model2);
126:                assertEquals(1, model2.getUris().length);
127:                assertEquals("file:model2.xmi", model2.getUris()[0]);
128:                assertEquals(0, model2.getModuleSearchLocations().length);
129:                assertFalse(model2.isLastModifiedCheck());
130:
131:                final Model model3 = repository.getModels()[2];
132:                assertNotNull(model3);
133:                assertEquals(1, model3.getUris().length);
134:                assertEquals("file:model3.xmi", model3.getUris()[0]);
135:                assertNotNull(model3.getPackages());
136:                assertTrue(model3.getPackages().isApply("some::package"));
137:                assertFalse(model3.getPackages().isApply(
138:                        "org::andromda::metafacades::uml"));
139:
140:                // namespaces
141:                final Namespace namespace1 = Namespaces.instance()
142:                        .getNamespace("default");
143:                final Property namespace1Property1 = namespace1
144:                        .getProperty("languageMappingsUri");
145:
146:                assertNotNull(namespace1Property1);
147:                assertEquals("Java", namespace1Property1.getValue());
148:                assertFalse(namespace1Property1.isIgnore());
149:                final Property namespace1Property2 = namespace1
150:                        .getProperty("wrapperMappingsUri");
151:                assertEquals("JavaWrapper", namespace1Property2.getValue());
152:                assertNotNull(namespace1Property2);
153:                final Property namespace1Property3 = namespace1
154:                        .getProperty("enumerationLiteralNameMask");
155:                assertNotNull(namespace1Property3);
156:                assertEquals("upperunderscore", namespace1Property3.getValue());
157:                final Property namespace1Property4 = namespace1
158:                        .getProperty("maxSqlNameLength");
159:                assertNotNull(namespace1Property4);
160:                assertTrue(namespace1Property4.isIgnore());
161:                final Namespace namespace2 = Namespaces.instance()
162:                        .getNamespace("spring");
163:                assertNotNull(namespace2);
164:                final Property namespace2Property1 = namespace2
165:                        .getProperty("hibernateQueryUseNamedParameters");
166:                assertNotNull(namespace2Property1);
167:                assertEquals("true", namespace2Property1.getValue());
168:
169:                // mappings search locations
170:                assertEquals(2,
171:                        configuration.getMappingsSearchLocations().length);
172:                assertEquals("/path/to/mappings/location1", configuration
173:                        .getMappingsSearchLocations()[0].getPath());
174:                assertEquals("/path/to/mappings/location2", configuration
175:                        .getMappingsSearchLocations()[1].getPath());
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.