Source Code Cross Referenced for ShutdownTest.java in  » ESB » celtix-1.0 » org » objectweb » celtix » systest » ws » rm » 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 » ESB » celtix 1.0 » org.objectweb.celtix.systest.ws.rm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.celtix.systest.ws.rm;
002:
003:        import java.net.URL;
004:        import java.util.List;
005:
006:        import javax.xml.namespace.QName;
007:        import javax.xml.soap.SOAPMessage;
008:        import javax.xml.ws.BindingProvider;
009:        import javax.xml.ws.handler.Handler;
010:        import javax.xml.ws.handler.LogicalMessageContext;
011:
012:        import junit.framework.Test;
013:        import junit.framework.TestSuite;
014:
015:        import org.objectweb.celtix.Bus;
016:        import org.objectweb.celtix.BusException;
017:        import org.objectweb.celtix.bindings.AbstractBindingImpl;
018:        import org.objectweb.celtix.bus.busimpl.BusConfigurationBuilder;
019:        import org.objectweb.celtix.bus.ws.rm.Names;
020:        import org.objectweb.celtix.configuration.ConfigurationBuilder;
021:        import org.objectweb.celtix.configuration.ConfigurationBuilderFactory;
022:        import org.objectweb.celtix.greeter_control.Greeter;
023:        import org.objectweb.celtix.greeter_control.GreeterService;
024:        import org.objectweb.celtix.systest.common.ClientServerSetupBase;
025:        import org.objectweb.celtix.systest.common.ClientServerTestBase;
026:
027:        /**
028:         * Tests Reliable Messaging.
029:         */
030:        public class ShutdownTest extends ClientServerTestBase {
031:
032:            private static final String APP_NAMESPACE = "http://celtix.objectweb.org/greeter_control";
033:            private static final String GREETMEONEWAY_ACTION = APP_NAMESPACE
034:                    + "/types/Greeter/greetMeOneWay";
035:
036:            private static final QName SERVICE_NAME = new QName(APP_NAMESPACE,
037:                    "GreeterService");
038:            private static final QName PORT_NAME = new QName(APP_NAMESPACE,
039:                    "GreeterPort");
040:
041:            private Bus bus;
042:            private MessageFlow mf;
043:            private GreeterService greeterService;
044:            private Greeter greeter;
045:
046:            public static void main(String[] args) {
047:                junit.textui.TestRunner.run(ShutdownTest.class);
048:            }
049:
050:            public static Test suite() throws Exception {
051:                TestSuite suite = new TestSuite(ShutdownTest.class);
052:                return new ClientServerSetupBase(suite) {
053:                    public void startServers() throws Exception {
054:                        // special case handling for WS-Addressing system test to avoid
055:                        // UUID related issue when server is run as separate process
056:                        // via maven on Win2k
057:                        assertTrue("server did not launch correctly",
058:                                launchServer(ShutdownTestServer.class,
059:                                        "Windows 2000".equals(System
060:                                                .getProperty("os.name"))));
061:                    }
062:
063:                    public void setUp() throws Exception {
064:
065:                        URL url = getClass().getResource(
066:                                "oneway-terminate-on-shutdown.xml");
067:                        assertNotNull("cannot find test resource", url);
068:                        configFileName = url.toString();
069:                        ConfigurationBuilder builder = ConfigurationBuilderFactory
070:                                .getBuilder();
071:                        builder.buildConfiguration(
072:                                BusConfigurationBuilder.BUS_CONFIGURATION_URI,
073:                                "celtix");
074:
075:                        super .setUp();
076:
077:                    }
078:                };
079:            }
080:
081:            public void setUp() throws BusException {
082:
083:                // Map<String, Object> busProperties = new HashMap<String, Object>();
084:                // busProperties.put(BusConfigurationBuilder.BUS_ID_PROPERTY, "oneway-terminate-on-shutdown");
085:                // bus = Bus.init(null, busProperties);
086:                bus = Bus.init();
087:
088:                URL wsdl = getClass().getResource("/wsdl/greeter_control.wsdl");
089:                greeterService = new GreeterService(wsdl, SERVICE_NAME);
090:
091:                greeter = greeterService.getPort(PORT_NAME, Greeter.class);
092:
093:                BindingProvider provider = (BindingProvider) greeter;
094:                AbstractBindingImpl abi = (AbstractBindingImpl) provider
095:                        .getBinding();
096:                List<Handler> handlerChain = abi
097:                        .getPostProtocolSystemHandlers();
098:                assertTrue(handlerChain.size() > 0);
099:
100:                List<SOAPMessage> outboundMessages = null;
101:                List<LogicalMessageContext> inboundContexts = null;
102:
103:                boolean found = false;
104:                for (Handler h : handlerChain) {
105:                    if (!found && h instanceof  SOAPMessageRecorder) {
106:                        SOAPMessageRecorder recorder = (SOAPMessageRecorder) h;
107:                        outboundMessages = recorder.getOutboundMessages();
108:                        outboundMessages.clear();
109:                        found = true;
110:                        break;
111:                    }
112:                }
113:                assertTrue(
114:                        "Could not find SOAPMessageRecorder in post protocol handler chain",
115:                        found);
116:                handlerChain = abi.getPreLogicalSystemHandlers();
117:                assertTrue(handlerChain.size() > 0);
118:                found = false;
119:                for (Handler h : handlerChain) {
120:                    if (!found && h instanceof  LogicalMessageContextRecorder) {
121:                        LogicalMessageContextRecorder recorder = (LogicalMessageContextRecorder) h;
122:                        inboundContexts = recorder.getInboundContexts();
123:                        inboundContexts.clear();
124:                        found = true;
125:                        break;
126:                    }
127:                }
128:                assertTrue(
129:                        "Could not find LogicalMessageContextRecorder in pre logical handler chain",
130:                        found);
131:
132:                mf = new MessageFlow(outboundMessages, inboundContexts);
133:
134:            }
135:
136:            public void testOnewayTerminateOnShutdown() throws Exception {
137:
138:                try {
139:                    greeter.greetMeOneWay("once");
140:                    greeter.greetMeOneWay("twice");
141:                    greeter.greetMeOneWay("thrice");
142:                } finally {
143:                    bus.shutdown(true);
144:                }
145:
146:                mf.verifyMessages(6, true);
147:                String[] expectedActions = new String[] {
148:                        Names.WSRM_CREATE_SEQUENCE_ACTION,
149:                        GREETMEONEWAY_ACTION, GREETMEONEWAY_ACTION,
150:                        GREETMEONEWAY_ACTION, Names.WSRM_LAST_MESSAGE_ACTION,
151:                        Names.WSRM_TERMINATE_SEQUENCE_ACTION };
152:                mf.verifyActions(expectedActions, true);
153:                mf.verifyMessageNumbers(new String[] { null, "1", "2", "3",
154:                        "4", null }, true);
155:
156:                mf.verifyMessages(7, false);
157:                expectedActions = new String[] { null,
158:                        Names.WSRM_CREATE_SEQUENCE_RESPONSE_ACTION, null, null,
159:                        null, null, null };
160:                mf.verifyActions(expectedActions, false);
161:                mf.verifyMessageNumbers(new String[] { null, null, null, null,
162:                        null, null, null }, false);
163:                boolean[] expectedAcks = new boolean[7];
164:                expectedAcks[5] = true;
165:                mf.verifyAcknowledgements(expectedAcks, false);
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.