Author: ggrekhov
Date: Thu May 31 17:53:02 2012
New Revision: 1344835

URL: http://svn.apache.org/viewvc?rev=1344835&view=rev
Log:
NetworkTesting: add jitter test; code refacroring

Added:
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/
      - copied from r1344771, 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/BaseURLLoadTest.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/JitterTest.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/NetworkTest.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PingTest.lzx
      - copied, changed from r1344771, 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PortAvailabilityTest.lzx
      - copied, changed from r1344771, 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx
Removed:
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/pingtool.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/portavailabilitytool.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/
Modified:
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/library.lzx

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx?rev=1344835&r1=1344834&r2=1344835&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
 Thu May 31 17:53:02 2012
@@ -20,21 +20,20 @@
 -->
 <canvas debug="true" width="100%" height="100%" title="NetworkTesting">
 
-    <include href="tools/" />
+    <include href="tests/" />
 
-    <attribute name="host" type="string" value="192.168.56.101" />
+    <attribute name="host" type="string" value="localhost" />
     <attribute name="rtmpPort" type="number" value="1935" />
     <attribute name="httpPort" type="number" value="5080" />
 
-    <attribute name="pingTool" value="null" />
-    <attribute name="portTool" value="null" />
+    <PingTest name="pingTest" host="${parent.host}" port="${parent.httpPort}" 
/>
+    <PortAvailabilityTest name="portTest" host="${parent.host}" 
port="${parent.rtmpPort}" />
+    <JitterTest name="jitterTest" host="${parent.host}" 
port="${parent.httpPort}" />
 
     <handler name="oninit">
-        canvas.pingTool = new lz.PingTool();
-        canvas.portTool = new lz.PortAvailabilityTool();
-
-        canvas.pingTool.ping(host, httpPort);
-        canvas.portTool.check(host, rtmpPort);
+        canvas.pingTest.start();
+        canvas.jitterTest.start();
+        canvas.portTest.start();
     </handler>
 
 </canvas>

Added: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/BaseURLLoadTest.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/BaseURLLoadTest.lzx?rev=1344835&view=auto
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/BaseURLLoadTest.lzx
 (added)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/BaseURLLoadTest.lzx
 Thu May 31 17:53:02 2012
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+
+-->
+<library>
+
+<class name="BaseURLLoadTest" extends="NetworkTest">
+
+    <switch>
+        <when property="$as3">
+            <passthrough>
+                import flash.events.*;
+                import flash.net.*;
+                import flash.utils.*;
+            </passthrough>
+        </when>
+    </switch>
+
+    <attribute name="testsCount" type="number" value="0" />
+    <attribute name="loadFileName" type="string" value="null" />
+    <attribute name="verbose" type="boolean" value="true" />
+
+    <attribute name="startTime" type="number" value="0" />
+    <attribute name="wholeTime" type="number" value="0" />
+    <attribute name="maxTime" type="number" value="0" />
+    <attribute name="minTime" type="number" value="999999" />
+    <attribute name="finishedTestsCount" type="number" value="0" />
+    <attribute name="successfulTestsCount" type="number" value="0" />
+
+    <attribute name="request" value="null" />
+    <attribute name="loader" value="null" />
+
+
+    <method name="start">
+        var hostUrl = "http://"; + host + ":" + port + "/" + loadFileName;
+        request = new URLRequest(hostUrl);
+
+        loader = new URLLoader();
+        loader.addEventListener(Event.COMPLETE, this.onComplete);
+        loader.addEventListener(IOErrorEvent.IO_ERROR, this.onError);
+        loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, 
this.onError);
+
+        finishedTestsCount = 0;
+        successfulTestsCount = 0;
+        wholeTime = 0;
+        maxTime = 0;
+        minTime = 999999;
+
+        if($debug) Debug.write(testName +": start test... ", hostUrl);
+        startTime = getTimer();
+        loader.load(request);
+    </method>
+
+    <method name="onComplete" args="e">
+        <![CDATA[
+        var endTime = getTimer();
+        var pingTime = endTime - startTime;
+        wholeTime += pingTime;
+        if (pingTime > maxTime) {
+            maxTime = pingTime;
+        }
+        if (pingTime < minTime) {
+            minTime = pingTime;
+        }
+
+        if (verbose) {
+            if($debug) Debug.write(testName +": load time = ", pingTime, " 
ms");
+        }
+
+        finishedTestsCount++;
+        successfulTestsCount++;
+        if (finishedTestsCount < testsCount) {
+            startTime = getTimer();
+            loader.load(request);
+        } else {
+            this.report();
+        }
+        ]]>
+    </method>
+
+    <method name="onError" args="e">
+        <![CDATA[
+        if (verbose) {
+            if($debug) Debug.write(testName + ": Error - ", e);
+        }
+
+        finishedTestsCount++;
+        if (finishedTestsCount < testsCount) {
+            startTime = getTimer();
+            loader.load(request);
+        } else {
+            this.report();
+        }
+        ]]>
+    </method>
+
+    <method name="report">
+        var report;
+        if (successfulTestsCount > 0) {
+            report = testName + " report:\n" + this.generateReport();
+        } else {
+            report = "Ping test: connection error";
+        }
+
+        if($debug) Debug.write(report);
+    </method>
+
+    <method name="generateReport" />
+
+</class>
+
+</library>

Added: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/JitterTest.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/JitterTest.lzx?rev=1344835&view=auto
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/JitterTest.lzx
 (added)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/JitterTest.lzx
 Thu May 31 17:53:02 2012
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+
+-->
+<library>
+
+<class name="JitterTest" extends="BaseURLLoadTest">
+
+    <handler name="oninit">
+        this.setAttribute("testsCount", 100);
+        this.setAttribute("testName", "Jitter test");
+        this.setAttribute("loadFileName", "jitterTest");
+        this.setAttribute("verbose", false);
+    </handler>
+
+    <method name="generateReport">
+        var averageTime = wholeTime / successfulTestsCount;
+        var jitterMax = maxTime - averageTime;
+        var jitterMin = minTime - averageTime;
+        var report = "Average time: " + averageTime + " ms\n";
+        report += "Min time: " + minTime + " ms\n";
+        report += "Max time: " + maxTime + " ms\n";
+        report += "Jitter: " + jitterMax + " ms and " + jitterMin + " ms \n";
+
+        return report;
+    </method>
+
+</class>
+
+</library>

Added: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/NetworkTest.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/NetworkTest.lzx?rev=1344835&view=auto
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/NetworkTest.lzx
 (added)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/NetworkTest.lzx
 Thu May 31 17:53:02 2012
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+
+-->
+<library>
+
+<class name="NetworkTest" extends="view">
+
+    <attribute name="testName" type="string" value="null" />
+    <attribute name="host" type="string" value="null" />
+    <attribute name="port" type="number" value="null" />
+
+    <method name="start" />
+
+</class>
+
+</library>

Copied: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PingTest.lzx
 (from r1344771, 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx)
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PingTest.lzx?p2=incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PingTest.lzx&p1=incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx&r1=1344771&r2=1344835&rev=1344835&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PingTest.lzx
 Thu May 31 17:53:02 2012
@@ -20,87 +20,22 @@
 -->
 <library>
 
-<class name="PingTool">
+<class name="PingTest" extends="BaseURLLoadTest">
 
-    <switch>
-        <when property="$as3">
-            <passthrough>
-                import flash.display.*;
-                import flash.events.*;
-                import flash.net.*;
-                import flash.utils.*;
-            </passthrough>
-        </when>
-    </switch>
-
-    <attribute name="startTime" type="number" value="0" />
-    <attribute name="wholeTime" type="number" value="0" />
-    <attribute name="testsFinished" type="number" value="0" />
-    <attribute name="testsCount" type="number" value="10" />
-    <attribute name="successfulTestsCount" type="number" value="10" />
-
-    <attribute name="request" value="null" />
-    <attribute name="loader" value="null" />
-
-
-    <method name="ping" args="host, httpPort">
-        var hostUrl = "http://"; + host + ":" + httpPort + 
"/openmeetings/testingToolsFiles/pingTest";
-        request = new URLRequest(hostUrl);
-        loader = new URLLoader();
-        loader.addEventListener(Event.COMPLETE, this.onComplete);
-        loader.addEventListener(IOErrorEvent.IO_ERROR, this.onError);
-        loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, 
this.onError);
-        testsFinished = 0;
-        wholeTime = 0;
-        successfulTestsCount = 0;
-
-        if($debug) Debug.write("Start ping test... ", hostUrl);
-        startTime = getTimer();
-        loader.load(request);
-    </method>
-
-    <method name="onComplete" args="e">
-        <![CDATA[
-        var endTime = getTimer();
-        var pingTime = endTime - startTime;
-        wholeTime += pingTime;
-        if($debug) Debug.write("Ping time: ", pingTime, " ms");
-
-        testsFinished++;
-        successfulTestsCount++;
-        if (testsFinished < testsCount) {
-            startTime = getTimer();
-            loader.load(request);
-        } else {
-            this.report();
-        }
-        ]]>
-    </method>
-
-    <method name="onError" args="e">
-        <![CDATA[
-        if($debug) Debug.write("Error: ", e);
-
-        testsFinished++;
-        if (testsFinished < testsCount) {
-            startTime = getTimer();
-            loader.load(request);
-        } else {
-            this.report();
-        }
-        ]]>
-    </method>
-
-    <method name="report">
-        var report;
-        if (successfulTestsCount > 0) {
-            var averageTime = wholeTime / successfulTestsCount;
-            report = "Average ping time: " + averageTime + " ms";
-        } else {
-            report = "Ping test: connection error";
-        }
+    <handler name="oninit">
+        this.setAttribute("testsCount", 10);
+        this.setAttribute("testName", "Ping test");
+        this.setAttribute("loadFileName", "pingTest");
+    </handler>
+
+    <method name="generateReport">
+        var averageTime = wholeTime / successfulTestsCount;
+        var packetsLost = testsCount - successfulTestsCount;
+        var report = "Average ping time: " + averageTime + " ms\n";
+        report += "Packets received: " + successfulTestsCount + "\n";
+        report += "Packets lost: " + packetsLost + "\n";
 
-        if($debug) Debug.write(report);
+        return report;
     </method>
 
 </class>

Copied: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PortAvailabilityTest.lzx
 (from r1344771, 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx)
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PortAvailabilityTest.lzx?p2=incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PortAvailabilityTest.lzx&p1=incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx&r1=1344771&r2=1344835&rev=1344835&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/PortAvailabilityTest.lzx
 Thu May 31 17:53:02 2012
@@ -20,7 +20,7 @@
 -->
 <library>
 
-<class name="PortAvailabilityTool">
+<class name="PortAvailabilityTest" extends="NetworkTest">
 
     <switch>
         <when property="$as3">
@@ -34,23 +34,27 @@
 
     <rtmpconnection name="rtmp" autoconnect="false" />
 
-    <method name="check" args="host, port">
+    <handler name="oninit">
+        this.setAttribute("testName", "Port test");
+    </handler>
+
+    <method name="start">
         rtmp.setAttribute("src", 
"rtmp://"+host+":"+port+"/openmeetings/hibernate");
-        if($debug) Debug.write("Start port availability test... ", rtmp.src);
+        if($debug) Debug.write(testName + ": start test... ", rtmp.src);
 
         rtmp.connect();
     </method>
 
     <handler name="onconnect" reference="rtmp">
-        if($debug) Debug.write("Port is available");
+        if($debug) Debug.write(testName + ": port is available");
     </handler>
 
     <handler name="onerror" args="e" reference="rtmp">
-        if($debug) Debug.write("Connection error: ", e);
+        if($debug) Debug.write(testName + ": connection error - ", e);
     </handler>
 
     <handler name="onstatus" args="e" reference="rtmp">
-        if($debug) Debug.write("RTMP connect status: ", e);
+        if($debug) Debug.write(testName + ": RTMP connect status - ", e);
     </handler>
 
 </class>

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/library.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/library.lzx?rev=1344835&r1=1344771&r2=1344835&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/library.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tests/library.lzx
 Thu May 31 17:53:02 2012
@@ -20,7 +20,10 @@
 -->
 <library>
 
-    <include href="pingtool.lzx" />
-    <include href="portavailabilitytool.lzx" />
+    <include href="BaseURLLoadTest.lzx" />
+    <include href="JitterTest.lzx" />
+    <include href="NetworkTest.lzx" />
+    <include href="PingTest.lzx" />
+    <include href="PortAvailabilityTest.lzx" />
 
 </library>


Reply via email to