Source Code Cross Referenced for TransactionListenerTest.java in  » GIS » GeoServer » org » geoserver » wfs » 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 » GIS » GeoServer » org.geoserver.wfs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.geoserver.wfs;
002:
003:        import org.geoserver.data.test.MockData;
004:        import org.geotools.feature.Feature;
005:
006:        /**
007:         * This test must be run with the server configured with the wfs 1.0 cite
008:         * configuration, with data initialized.
009:         * 
010:         * @author Justin Deoliveira, The Open Planning Project
011:         * 
012:         */
013:        public class TransactionListenerTest extends WFSTestSupport {
014:
015:            TransactionListenerTester listener;
016:
017:            protected String[] getSpringContextLocations() {
018:                String[] base = super .getSpringContextLocations();
019:                String[] extended = new String[base.length + 1];
020:                System.arraycopy(base, 0, extended, 0, base.length);
021:                extended[base.length] = "classpath:/org/geoserver/wfs/TransactionListenerTestContext.xml";
022:                return extended;
023:            }
024:
025:            protected void setUp() throws Exception {
026:                super .setUp();
027:                listener = (TransactionListenerTester) applicationContext
028:                        .getBean("transactionListenerTester");
029:                listener.clear();
030:            }
031:
032:            public void testDelete() throws Exception {
033:                // perform a delete
034:                String delete = "<wfs:Transaction service=\"WFS\" version=\"1.0.0\" "
035:                        + "xmlns:cgf=\"http://www.opengis.net/cite/geometry\" "
036:                        + "xmlns:ogc=\"http://www.opengis.net/ogc\" "
037:                        + "xmlns:wfs=\"http://www.opengis.net/wfs\"> "
038:                        + "<wfs:Delete typeName=\"cgf:Points\"> "
039:                        + "<ogc:Filter> "
040:                        + "<ogc:PropertyIsEqualTo> "
041:                        + "<ogc:PropertyName>cgf:id</ogc:PropertyName> "
042:                        + "<ogc:Literal>t0000</ogc:Literal> "
043:                        + "</ogc:PropertyIsEqualTo> "
044:                        + "</ogc:Filter> "
045:                        + "</wfs:Delete> " + "</wfs:Transaction>";
046:
047:                postAsDOM("wfs", delete);
048:                assertEquals(1, listener.events.size());
049:                TransactionEvent event = (TransactionEvent) listener.events
050:                        .get(0);
051:                assertEquals(TransactionEventType.PRE_DELETE, event.getType());
052:                assertEquals(MockData.POINTS, event.getLayerName());
053:                assertEquals(1, listener.features.size());
054:                Feature deleted = (Feature) listener.features.get(0);
055:                assertEquals("t0000", deleted.getAttribute("id"));
056:            }
057:
058:            public void testInsert() throws Exception {
059:                // perform an insert
060:                String insert = "<wfs:Transaction service=\"WFS\" version=\"1.0.0\" "
061:                        + "xmlns:cgf=\"http://www.opengis.net/cite/geometry\" "
062:                        + "xmlns:ogc=\"http://www.opengis.net/ogc\" "
063:                        + "xmlns:wfs=\"http://www.opengis.net/wfs\" "
064:                        + "xmlns:gml=\"http://www.opengis.net/gml\"> "
065:                        + "<wfs:Insert > "
066:                        + "<cgf:Lines>"
067:                        + "<cgf:lineStringProperty>"
068:                        + "<gml:LineString>"
069:                        + "<gml:coordinates decimal=\".\" cs=\",\" ts=\" \">"
070:                        + "494475.71056415,5433016.8189323 494982.70115662,5435041.95096618"
071:                        + "</gml:coordinates>"
072:                        + "</gml:LineString>"
073:                        + "</cgf:lineStringProperty>"
074:                        + "<cgf:id>t0002</cgf:id>"
075:                        + "</cgf:Lines>"
076:                        + "</wfs:Insert>" + "</wfs:Transaction>";
077:
078:                postAsDOM("wfs", insert);
079:                assertEquals(1, listener.events.size());
080:                TransactionEvent firstEvent = (TransactionEvent) listener.events
081:                        .get(0);
082:                assertEquals(TransactionEventType.PRE_INSERT, firstEvent
083:                        .getType());
084:                assertEquals(MockData.LINES, firstEvent.getLayerName());
085:                assertEquals(1, listener.features.size());
086:            }
087:
088:            public void testUpdate() throws Exception {
089:                // perform an update
090:                String insert = "<wfs:Transaction service=\"WFS\" version=\"1.0.0\" "
091:                        + "xmlns:cgf=\"http://www.opengis.net/cite/geometry\" "
092:                        + "xmlns:ogc=\"http://www.opengis.net/ogc\" "
093:                        + "xmlns:wfs=\"http://www.opengis.net/wfs\" "
094:                        + "xmlns:gml=\"http://www.opengis.net/gml\"> "
095:                        + "<wfs:Update typeName=\"cgf:Polygons\" > "
096:                        + "<wfs:Property>"
097:                        + "<wfs:Name>id</wfs:Name>"
098:                        + "<wfs:Value>t0003</wfs:Value>"
099:                        + "</wfs:Property>"
100:                        + "<ogc:Filter>"
101:                        + "<ogc:PropertyIsEqualTo>"
102:                        + "<ogc:PropertyName>id</ogc:PropertyName>"
103:                        + "<ogc:Literal>t0002</ogc:Literal>"
104:                        + "</ogc:PropertyIsEqualTo>"
105:                        + "</ogc:Filter>"
106:                        + "</wfs:Update>" + "</wfs:Transaction>";
107:
108:                postAsDOM("wfs", insert);
109:                assertEquals(2, listener.events.size());
110:                TransactionEvent firstEvent = (TransactionEvent) listener.events
111:                        .get(0);
112:                assertEquals(TransactionEventType.PRE_UPDATE, firstEvent
113:                        .getType());
114:                assertEquals(MockData.POLYGONS, firstEvent.getLayerName());
115:                Feature updatedBefore = (Feature) listener.features.get(0);
116:                assertEquals("t0002", updatedBefore.getAttribute("id"));
117:
118:                TransactionEvent secondEvent = (TransactionEvent) listener.events
119:                        .get(1);
120:                assertEquals(TransactionEventType.POST_UPDATE, secondEvent
121:                        .getType());
122:                assertEquals(MockData.POLYGONS, secondEvent.getLayerName());
123:                Feature updatedAfter = (Feature) listener.features.get(1);
124:                assertEquals("t0003", updatedAfter.getAttribute("id"));
125:
126:                assertEquals(2, listener.features.size());
127:            }
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.