Author: ggrekhov
Date: Wed May 23 16:05:55 2012
New Revision: 1341929
URL: http://svn.apache.org/viewvc?rev=1341929&view=rev
Log:
Add port test
Added:
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/library.lzx
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.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=1341929&r1=1341928&r2=1341929&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
Wed May 23 16:05:55 2012
@@ -22,11 +22,19 @@
<include href="tools/" />
+ <attribute name="host" type="string" value="192.168.56.101" />
+ <attribute name="rtmpPort" type="number" value="1935" />
+ <attribute name="httpPort" type="number" value="5080" />
+
<attribute name="pingTool" value="null" />
+ <attribute name="portTool" value="null" />
<handler name="oninit">
canvas.pingTool = new lz.PingTool();
-
canvas.pingTool.ping("http://192.168.56.101:5080/openmeetings/testingToolsFiles/pingTest");
+ canvas.portTool = new lz.PortAvailabilityTool();
+
+ canvas.pingTool.ping(host, httpPort);
+ canvas.portTool.check(host, rtmpPort);
</handler>
</canvas>
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/library.lzx
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/library.lzx?rev=1341929&r1=1341928&r2=1341929&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/library.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/library.lzx
Wed May 23 16:05:55 2012
@@ -21,5 +21,6 @@
<library>
<include href="pingtool.lzx" />
+ <include href="portavailabilitytool.lzx" />
</library>
Modified:
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx?rev=1341929&r1=1341928&r2=1341929&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx
(original)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/pingtool.lzx
Wed May 23 16:05:55 2012
@@ -43,35 +43,36 @@
<attribute name="loader" value="null" />
- <method name="ping" args="hostUrl">
- this.request = new URLRequest(hostUrl);
- this.loader = new URLLoader();
- this.loader.addEventListener(Event.COMPLETE, this.onComplete);
- this.loader.addEventListener(IOErrorEvent.IO_ERROR, this.onError);
- this.testsFinished = 0;
- this.wholeTime = 0;
- this.successfulTestsCount = 0;
-
- if($debug) Debug.write("Start pinging...");
- this.startTime = getTimer();
- this.loader.load(this.request);
+ <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 - this.startTime;
- this.wholeTime += pingTime;
+ var pingTime = endTime - startTime;
+ wholeTime += pingTime;
if($debug) Debug.write("Ping time: ", pingTime, " ms");
- this.testsFinished++;
- this.successfulTestsCount++;
- if (this.testsFinished < this.testsCount) {
- this.startTime = getTimer();
- this.loader.load(this.request);
+ testsFinished++;
+ successfulTestsCount++;
+ if (testsFinished < testsCount) {
+ startTime = getTimer();
+ loader.load(request);
} else {
- var averageTime = wholeTime / this.successfulTestsCount;
- if($debug) Debug.write("Average ping time: ", averageTime, " ms");
+ this.report();
}
]]>
</method>
@@ -80,17 +81,28 @@
<![CDATA[
if($debug) Debug.write("Error: ", e);
- this.testsFinished++;
- if (this.testsFinished < this.testsCount) {
- this.startTime = getTimer();
- this.loader.load(this.request);
+ testsFinished++;
+ if (testsFinished < testsCount) {
+ startTime = getTimer();
+ loader.load(request);
} else {
- var averageTime = wholeTime / this.successfulTestsCount;
- if($debug) Debug.write("Average ping time: ", averageTime, " ms");
+ 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";
+ }
+
+ if($debug) Debug.write(report);
+ </method>
+
</class>
</library>
Added:
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx?rev=1341929&view=auto
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx
(added)
+++
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/tools/portavailabilitytool.lzx
Wed May 23 16:05:55 2012
@@ -0,0 +1,58 @@
+<?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="PortAvailabilityTool">
+
+ <switch>
+ <when property="$as3">
+ <passthrough>
+ import flash.events.*;
+ import flash.net.*;
+ import flash.system.*;
+ </passthrough>
+ </when>
+ </switch>
+
+ <rtmpconnection name="rtmp" autoconnect="false" />
+
+ <method name="check" args="host, port">
+ rtmp.setAttribute("src",
"rtmp://"+host+":"+port+"/openmeetings/hibernate");
+ if($debug) Debug.write("Start port availability test... ", rtmp.src);
+
+ rtmp.connect();
+ </method>
+
+ <handler name="onconnect" reference="rtmp">
+ if($debug) Debug.write("Port is available");
+ </handler>
+
+ <handler name="onerror" args="e" reference="rtmp">
+ if($debug) Debug.write("Connection error: ", e);
+ </handler>
+
+ <handler name="onstatus" args="e" reference="rtmp">
+ if($debug) Debug.write("RTMP connect status: ", e);
+ </handler>
+
+</class>
+
+</library>