Source Code Cross Referenced for JMeterTestCase.java in  » Testing » jakarta-jmeter » org » apache » jmeter » junit » 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 » Testing » jakarta jmeter » org.apache.jmeter.junit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *   http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         * 
017:         */
018:
019:        package org.apache.jmeter.junit;
020:
021:        import java.io.File;
022:        import java.util.MissingResourceException;
023:
024:        import junit.framework.TestCase;
025:        import org.apache.jmeter.util.JMeterUtils;
026:        import org.apache.jorphan.logging.LoggingManager;
027:        import org.apache.log.Logger;
028:
029:        /*
030:         * Extend JUnit TestCase to provide common setup
031:         */
032:        public abstract class JMeterTestCase extends TestCase {
033:            // Used by findTestFile
034:            private static final String filePrefix;
035:
036:            public JMeterTestCase() {
037:                super ();
038:            }
039:
040:            public JMeterTestCase(String name) {
041:                super (name);
042:            }
043:
044:            /*
045:             * If not running under AllTests.java, make sure that the properties (and
046:             * log file) are set up correctly.
047:             * 
048:             * N.B. In order for this to work correctly, the JUnit test must be started
049:             * in the bin directory, and all the JMeter jars (plus any others needed at
050:             * run-time) need to be on the classpath.
051:             * 
052:             */
053:            static {
054:                if (JMeterUtils.getJMeterProperties() == null) {
055:                    String file = "testfiles/jmetertest.properties";
056:                    File f = new File(file);
057:                    if (!f.canRead()) {
058:                        System.out.println("Can't find " + file
059:                                + " - trying bin directory");
060:                        file = "bin/" + file;// JMeterUtils assumes Unix-style
061:                        // separators
062:                        // Also need to set working directory so test files can be found
063:                        System.setProperty("user.dir", System
064:                                .getProperty("user.dir")
065:                                + File.separatorChar + "bin");
066:                        System.out.println("Setting user.dir="
067:                                + System.getProperty("user.dir"));
068:                        filePrefix = "bin/";
069:                    } else {
070:                        filePrefix = "";
071:                    }
072:                    // Used to be done in initializeProperties
073:                    String home = new File(System.getProperty("user.dir"))
074:                            .getParent();
075:                    System.out.println("Setting JMeterHome: " + home);
076:                    JMeterUtils.setJMeterHome(home);
077:                    JMeterUtils jmu = new JMeterUtils();
078:                    try {
079:                        jmu.initializeProperties(file);
080:                    } catch (MissingResourceException e) {
081:                        System.out
082:                                .println("** Can't find resources - continuing anyway **");
083:                    }
084:                    logprop("java.version");
085:                    logprop("java.vendor");
086:                    logprop("java.home");
087:                    logprop("user.home");
088:                    logprop("user.dir");
089:                    logprop("java.class.version");
090:                    logprop("os.name");
091:                    logprop("os.version");
092:                    logprop("os.arch");
093:                    logprop("java.class.path");
094:                    // String cp = System.getProperty("java.class.path");
095:                    // String cpe[]= JOrphanUtils.split(cp,File.pathSeparator);
096:                    // System.out.println("java.class.path=");
097:                    // for (int i=0;i<cpe.length;i++){
098:                    // System.out.println(cpe[i]);
099:                    // }
100:                } else {
101:                    filePrefix = "";
102:                }
103:            }
104:
105:            private static void logprop(String prop) {
106:                System.out.println(prop + "=" + System.getProperty(prop));
107:            }
108:
109:            // Helper method to find a file
110:            protected static File findTestFile(String file) {
111:                File f = new File(file);
112:                if (filePrefix.length() > 0 && !f.isAbsolute()) {
113:                    f = new File(filePrefix + file);// Add the offset
114:                }
115:                return f;
116:            }
117:
118:            protected static final Logger testLog = LoggingManager
119:                    .getLoggerForClass();
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.