Source Code Cross Referenced for F_EjbJarHotDeploy.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jtests » clients » hotdeploy » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.jtests.clients.hotdeploy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.jonas.jtests.clients.hotdeploy;
002:
003:        import junit.framework.*;
004:
005:        import org.objectweb.jonas.jtests.util.JTestCase;
006:        import org.objectweb.jonas.jtests.beans.hotdeploy.HotDeploy;
007:        import org.objectweb.jonas.jtests.beans.hotdeploy.HotDeployHome;
008:
009:        import java.io.File;
010:        import java.io.FileInputStream;
011:        import java.io.FileOutputStream;
012:        import java.io.IOException;
013:
014:        import javax.rmi.PortableRemoteObject;
015:        import javax.naming.NamingException;
016:
017:        public class F_EjbJarHotDeploy extends JTestCase {
018:
019:            private static String BEAN_HOME = "HotDeployHome";
020:            private HotDeployHome bhome1 = null;
021:            private HotDeployHome bhome2 = null;
022:            private String jonasbase = null;
023:            private String sep = File.separator;
024:
025:            public F_EjbJarHotDeploy(String name) {
026:                super (name);
027:            }
028:
029:            public static Test suite() {
030:                return new TestSuite(F_EjbJarHotDeploy.class);
031:            }
032:
033:            public void setUp() {
034:                jonasbase = System.getProperty("jonas.base");
035:            }
036:
037:            private void copy(String source, String dest) throws IOException {
038:                File src = new File(jonasbase + sep + "ejbjars" + sep + source);
039:                File dst = new File(jonasbase + sep + "ejbjars" + sep + dest);
040:
041:                FileInputStream is = new FileInputStream(src);
042:                FileOutputStream os = new FileOutputStream(dst);
043:
044:                byte[] b = new byte[1024];
045:                int t;
046:                while ((t = is.read(b, 0, b.length - 1)) != -1) {
047:                    os.write(b, 0, t);
048:                }
049:
050:            }
051:
052:            public void testBeanHotDeployTwice() throws Exception {
053:                // copy $JONAS_BASE/ejbjars/hotdeploy1.jar -> $JONAS_BASE/ejbjars/hotdeploy.jar
054:                System.err.println("Start Test");
055:                copy("hotdeploy1.jar", "hotdeploy.jar");
056:                System.err.println("Copy executed");
057:                useBeans("hotdeploy", false);
058:                System.err.println("First Deployment OK");
059:                try {
060:                    bhome1 = (HotDeployHome) PortableRemoteObject.narrow(ictx
061:                            .lookup(BEAN_HOME), HotDeployHome.class);
062:                } catch (NamingException e) {
063:                    fail("Cannot get HotDeployHome:" + e);
064:                }
065:                System.err.println("Home retrieved");
066:
067:                HotDeploy bean1 = bhome1.create();
068:                String envVal1 = bean1.getEnvString();
069:                int beanVal1 = bean1.getVersionNumber();
070:                int helperVal1 = bean1.getHelperClassVersionNumber();
071:
072:                System.err.println("getValues OK");
073:                unloadBeans("hotdeploy");
074:                System.err.println("Unload first");
075:
076:                // copy $JONAS_BASE/ejbjars/hotdeploy2.jar -> $JONAS_BASE/ejbjars/hotdeploy.jar
077:                copy("hotdeploy2.jar", "hotdeploy.jar");
078:
079:                System.err.println("Copy Second jar");
080:                useBeans("hotdeploy", false);
081:                System.err.println("Seconf Load OK");
082:                try {
083:                    bhome2 = (HotDeployHome) PortableRemoteObject.narrow(ictx
084:                            .lookup(BEAN_HOME), HotDeployHome.class);
085:                } catch (NamingException e) {
086:                    fail("Cannot get HotDeployHome:" + e);
087:                }
088:
089:                HotDeploy bean2 = bhome2.create();
090:                String envVal2 = bean2.getEnvString();
091:                int beanVal2 = bean2.getVersionNumber();
092:                int helperVal2 = bean2.getHelperClassVersionNumber();
093:                unloadBeans("hotdeploy");
094:
095:                assertEquals("1.XML env String", "value1", envVal1);
096:                assertEquals("1.Static bean attr", 1, beanVal1);
097:                assertEquals("1.Static helper attr", 1, helperVal1);
098:
099:                assertEquals("2.XML env String", "value2", envVal2);
100:                assertEquals("2.Static bean attr", 2, beanVal2);
101:                assertEquals("2.Static helper attr", 2, helperVal2);
102:
103:            }
104:
105:            public static void main(String args[]) {
106:                String testtorun = null;
107:                // Get args
108:                for (int argn = 0; argn < args.length; argn++) {
109:                    String s_arg = args[argn];
110:                    Integer i_arg;
111:                    if (s_arg.equals("-n")) {
112:                        testtorun = args[++argn];
113:                    }
114:                }
115:                if (testtorun == null) {
116:                    junit.textui.TestRunner.run(suite());
117:                } else {
118:                    junit.textui.TestRunner
119:                            .run(new F_EjbJarHotDeploy(testtorun));
120:                }
121:            }
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.