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.gui.action;
020:
021: import java.io.File;
022: import java.io.FileInputStream;
023:
024: import org.apache.jmeter.junit.JMeterTestCase;
025: import org.apache.jmeter.save.SaveService;
026: import org.apache.jorphan.collections.HashTree;
027:
028: /**
029: *
030: * @version $Revision: 514347 $ Last updated: $Date: 2007-03-04 03:38:32 +0000 (Sun, 04 Mar 2007) $
031: */
032: public class TestLoad extends JMeterTestCase {
033: File testFile1, testFile2, testFile3, testFile4, testFile5,
034: testFile6, testFile7, testFile8, testFile9, testFile10,
035: testFile11, testFile12, testFile13;
036:
037: static Load loader = new Load();
038:
039: public TestLoad(String name) {
040: super (name);
041: }
042:
043: public void setUp() {
044: // testFile1 = // Old-style format; no longer used
045: // new File(System.getProperty("user.dir") + "/testfiles", "Test Plan.jmx");
046: testFile2 = new File(System.getProperty("user.dir")
047: + "/testfiles", "Modification Manager.jmx");
048: testFile3 = new File(System.getProperty("user.dir")
049: + "/testfiles", "proxy.jmx");
050: testFile4 = new File(System.getProperty("user.dir")
051: + "/testfiles", "AssertionTestPlan.jmx");
052: testFile5 = new File(System.getProperty("user.dir")
053: + "/testfiles", "AuthManagerTestPlan.jmx");
054: testFile6 = new File(System.getProperty("user.dir")
055: + "/testfiles", "HeaderManagerTestPlan.jmx");
056: testFile7 = new File(System.getProperty("user.dir")
057: + "/testfiles", "InterleaveTestPlan.jmx");
058: testFile8 = new File(System.getProperty("user.dir")
059: + "/testfiles", "InterleaveTestPlan2.jmx");
060: testFile9 = new File(System.getProperty("user.dir")
061: + "/testfiles", "LoopTestPlan.jmx");
062: testFile10 = new File(System.getProperty("user.dir")
063: + "/testfiles", "OnceOnlyTestPlan.jmx");
064: testFile11 = new File(System.getProperty("user.dir")
065: + "/testfiles", "ProxyServerTestPlan.jmx");
066: testFile12 = new File(System.getProperty("user.dir")
067: + "/testfiles", "SimpleTestPlan.jmx");
068: // Incomplete file
069: // testFile13 =
070: // new File(System.getProperty("user.dir") + "/testfiles", "URLRewritingExample.jmx");
071: }
072:
073: // public void testFile1() throws Exception {
074: // assertTree(getTree(testFile1));
075: // }
076:
077: public void testFile2() throws Exception {
078: assertTree(getTree(testFile2));
079: }
080:
081: public void testFile3() throws Exception {
082: assertTree(getTree(testFile3));
083: }
084:
085: private void assertTree(HashTree tree) throws Exception {
086: final Object object = tree.getArray()[0];
087: if (!(object instanceof org.apache.jmeter.testelement.TestPlan)) {
088: fail("Hash tree should be TestPlan, but is "
089: + object.getClass().getName());
090: }
091: }
092:
093: public void testFile4() throws Exception {
094: assertTree(getTree(testFile4));
095: }
096:
097: public void testFile5() throws Exception {
098: assertTree(getTree(testFile5));
099: }
100:
101: public void testFile6() throws Exception {
102: assertTree(getTree(testFile6));
103: }
104:
105: public void testFile7() throws Exception {
106: assertTree(getTree(testFile7));
107: }
108:
109: public void testFile8() throws Exception {
110: assertTree(getTree(testFile8));
111: }
112:
113: public void testFile9() throws Exception {
114: assertTree(getTree(testFile9));
115: }
116:
117: public void testFile10() throws Exception {
118: assertTree(getTree(testFile10));
119: }
120:
121: public void testFile11() throws Exception {
122: assertTree(getTree(testFile11));
123: }
124:
125: public void testFile12() throws Exception {
126: assertTree(getTree(testFile12));
127: }
128:
129: // public void testFile13() throws Exception {
130: // assertTree(getTree(testFile13));
131: // }
132:
133: private HashTree getTree(File f) throws Exception {
134: HashTree tree = SaveService.loadTree(new FileInputStream(f));
135: return tree;
136: }
137: }
|