You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/03/12 19:47:41 UTC

svn commit: r385340 - /jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java

Author: sebb
Date: Sun Mar 12 10:47:41 2006
New Revision: 385340

URL: http://svn.apache.org/viewcvs?rev=385340&view=rev
Log:
Moved test into separate tree

Added:
    jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java   (with props)

Added: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java?rev=385340&view=auto
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java (added)
+++ jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java Sun Mar 12 10:47:41 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2004,2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jmeter.monitor.model;
+
+import junit.framework.TestCase;
+
+public class TestObjectFactory extends TestCase {
+
+
+    // TODO turn this into a proper test case
+    
+	/**
+	 * Basic method for testing the class
+	 * 
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		if (args != null && args.length == 2) {
+			String file = null;
+			// int count = 1;
+			if (args[0] != null) {
+				file = args[0];
+			}
+			if (args[1] != null) {
+				// count = Integer.parseInt(args[1]);
+			}
+			try {
+				ObjectFactory of = ObjectFactory.getInstance();
+				java.io.File infile = new java.io.File(file);
+				java.io.FileInputStream fis = new java.io.FileInputStream(infile);
+				java.io.InputStreamReader isr = new java.io.InputStreamReader(fis);
+				StringBuffer buf = new StringBuffer();
+				java.io.BufferedReader br = new java.io.BufferedReader(isr);
+				String line = null;
+				while ((line = br.readLine()) != null) {
+					buf.append(line);
+				}
+				System.out.println("contents: ");
+				System.out.println(buf.toString());
+				System.out.println("----------------------");
+				Status st = of.parseBytes(buf.toString().getBytes());
+				if (st == null) {
+					System.out.println("parse failed");
+				} else {
+					System.out.println("parse successful:");
+					System.out.println(st.getJvm().getMemory().getFree());
+					System.out.println(st.getJvm().getMemory().getTotal());
+					System.out.println(st.getJvm().getMemory().getMax());
+					System.out.println("connector size: " + st.getConnector().size());
+					Connector conn = (Connector) st.getConnector().get(0);
+					System.out.println("conn: " + conn.getThreadInfo().getMaxThreads());
+				}
+			} catch (java.io.FileNotFoundException e) {
+				e.printStackTrace();
+			} catch (java.io.IOException e) {
+				e.printStackTrace();
+			}
+		} else {
+		}
+	}
+}

Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision

Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org