You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/06/18 20:10:25 UTC

svn commit: r1351437 [10/12] - in /incubator/flex/trunk/frameworks/projects: automation_agent/ automation_agent/bundles/ automation_agent/bundles/da_DK/ automation_agent/bundles/de_DE/ automation_agent/bundles/en_US/ automation_agent/bundles/es_ES/ aut...

Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolCodecHelper.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolCodecHelper.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolCodecHelper.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolCodecHelper.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.automation.tool
+{
+
+import mx.automation.IAutomationObject;	
+	
+public interface IToolCodecHelper
+{
+    /**
+     *  Encodes properties in an AS object to an array of values for a testing tool
+     *  using the codecs.  Since the object being passed in may not be an IAutomationObject 
+     *  (it could be an event class) and some of the properties require the
+     *  IAutomationObject to be transcoded (such as the item renderers in
+     *  a list event), relativeParent should always be set to the relevant
+     *  IAutomationObject.
+     *
+     *  @param obj the object that contains the properties to be encoded.
+     * 
+     *  @param propertyDescriptors the property descriptors that describes the properties for this object.
+     * 
+     *  @param relativeParent the IAutomationObject that is related to this object.
+     *
+     *  @return the encoded property value.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 4
+     */
+    function encodeProperties(obj:Object, 
+                              propertyDescriptors:Array, 
+                              relativeParent:IAutomationObject):Array;
+
+    /**
+     *  Encodes a single value to a testing tool value.  Unlike encodeProperties which
+     *  takes an object which contains all the properties to encode, this method
+     *  takes the actual value to encode.  This is useful for encoding return values.
+     *
+     *  @param obj the value to be encoded.
+     * 
+     *  @param propertyDescriptor the property descriptor that describes this value.
+     * 
+     *  @param relativeParent the IAutomationObject that is related to this value.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 4
+     */
+     
+    function encodeValue(value:Object, 
+                         testingToolType:String,
+                         codecName:String,
+                         relativeParent:IAutomationObject):Object;
+
+    /**
+     *  Decodes an array of properties from a testing tool into an AS object.
+     *  using the codecs.
+     *
+     *  @param obj the object that contains the properties to be encoded.
+     * 
+     *  @param args the property values to transcode.
+     * 
+     *  @param propertyDescriptors the property descriptors that describes the properties for this object.
+     * 
+     *  @param relativeParent the IAutomationObject that is related to this object.
+     *
+     *  @return the decoded property value.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 4
+     */
+    function decodeProperties(obj:Object, 
+                              args:Array,
+                              propertyDescriptors:Array,
+                              relativeParent:IAutomationObject):void;
+
+}		
+}

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolCodecHelper.as
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolCodecHelper.as
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolMethodDescriptor.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolMethodDescriptor.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolMethodDescriptor.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolMethodDescriptor.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.automation.tool
+{
+
+import mx.automation.IAutomationMethodDescriptor;
+
+/**
+ *  Defines the interface for a method descriptor.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 4
+ */
+public interface IToolMethodDescriptor extends IAutomationMethodDescriptor
+{
+    /**
+     *  Returns the codec name for the return value of this method
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 4
+     */
+    function get codecName():String;
+
+}
+
+}

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolMethodDescriptor.as
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolMethodDescriptor.as
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolPropertyDescriptor.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolPropertyDescriptor.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolPropertyDescriptor.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolPropertyDescriptor.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,57 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.automation.tool
+{
+
+import mx.automation.IAutomationPropertyDescriptor
+
+/**
+ * Describes a property of a test object.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 4
+ */
+public interface IToolPropertyDescriptor extends IAutomationPropertyDescriptor
+{
+	/**
+	 * Property type as string.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 4
+	 */
+    function get Tooltype():String;
+
+	/**
+	 * The codec that should be used for this property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 4
+	 */
+    function get codecName():String;
+
+}
+
+}

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolPropertyDescriptor.as
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/IToolPropertyDescriptor.as
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RecordingHandler.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RecordingHandler.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RecordingHandler.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RecordingHandler.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,138 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.automation.tool
+{
+	import flash.utils.Timer;
+	
+	public class RecordingHandler
+	{
+		/*
+		private static var requestsQueue:Array; // array of request data to be processed one after the other. 
+		 // this is to ensure that data will be sent synchronously one after the other.
+		 // please note that in such cases we should not expect request back from the client. (other than
+		 // for the incomplete processing.
+		 // if we expect so, we need to figure out some other methods. // like we can indicate proceed to next only
+		 // after recieveing an x data request from app.
+		 
+		private static var currentDataFromAppToAgent:ApplicationDataToAgent;
+		private static var responseRecieved:Boolean = false;
+		private static var currentSocketEvent:SocketResponseEvent;
+		private static var isInPartDataProcessing:Boolean = false;
+		
+		public function RecordingHandler()
+		{
+			
+		}
+			
+		public static  function addToRecordRequestQueue1(requestObject:RequestData):int
+		{
+			// this is to handle the multiple requests which needs to be
+			// processed for the record operation.
+			if( !requestsQueue)
+				requestsQueue = new Array();
+			
+			return requestsQueue.push(requestObject);
+		}
+		
+	 
+		public static function processQueuedRecordRequestsFromRecordHandler(socket:CustomSocket ,currentApplicationId:String,fromAgent:Boolean = false):Boolean
+		{
+			var processed:Boolean = false;
+			
+			// we will be getting this request only from the agent,].
+			// we should only only process the current request and return the fucntion thread
+			// back to the agent.
+			// socket transfer is asynchronous.
+			// by the logic here, we are trying to make it synchronous.
+			if(requestsQueue)
+			{
+				while(requestsQueue.length)
+				{
+					// get the current request
+					var currentRequest:RequestData = requestsQueue.shift(); 
+					sendData(socket,currentApplicationId,currentRequest.requestID, currentRequest.requestData);
+				}
+			}
+			
+
+			return processed;
+		}
+		
+		
+		private static function sendRecordData(socket:CustomSocket,currentApplicationId:String, requestIdentifier:String,dataString:String):void
+        {
+        	
+    		if(!dataString)
+        		dataString = ClientSocketHandler.nullValueIndicator;
+        		
+        	  	
+        	if(!currentDataFromAppToAgent)
+        		currentDataFromAppToAgent = new ApplicationDataToAgent(currentApplicationId,requestIdentifier,dataString);
+        	else
+           		currentDataFromAppToAgent.init(currentApplicationId,requestIdentifier,dataString);
+	           		
+	    
+        	do
+        	{
+	               	if(currentDataFromAppToAgent.willDataBePendingAfterNextSend())
+	           		isInPartDataProcessing = true;
+	           	else
+	           		isInPartDataProcessing = false;
+	           	
+	          	
+	           	var currentDataToBeSent:String = currentDataFromAppToAgent.getNextFormattedData(requestIdentifier, isInPartDataProcessing);
+	           	
+	           	socket.sendRequestString(currentDataToBeSent, true);
+        		socket.flush();
+        		var responseString:String = socket.getResponse();
+	           	
+	           	var tempTimer:Timer = new Timer(1000, 0);
+					tempTimer.start();
+					
+				responseString = socket.getResponse();	
+	           	
+	           	// we will only send the data to the socket and wait for the feedback
+				//responseRecieved = false;
+				//while(responseRecieved == false)
+				//{
+				//	var tempTimer:Timer = new Timer(500, 0);
+				//	tempTimer.start();
+				//}
+				
+				
+        	}while(isInPartDataProcessing)
+           	
+        }
+        
+       // public static function checkTimer
+        
+        public static function handleResponse(event:SocketResponseEvent):void
+        {
+        	// we need to process here only if the current response is from recording
+           	if(event.isInRecordProcessing)
+       		{
+        		responseRecieved = true;
+        		currentSocketEvent =SocketResponseEvent( event.clone());
+       		}
+        
+        }
+      */
+
+	}
+}
\ No newline at end of file

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RecordingHandler.as
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RecordingHandler.as
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RequestData.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RequestData.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RequestData.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RequestData.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.automation.tool
+{
+	public class RequestData
+	{
+		public var requestID:String;
+		public var requestData:String;
+	}
+}
\ No newline at end of file

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RequestData.as
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/RequestData.as
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/SocketResponseEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/SocketResponseEvent.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/SocketResponseEvent.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/SocketResponseEvent.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.automation.tool
+{
+	import flash.events.Event;
+
+	public class SocketResponseEvent extends Event
+	{
+	    public static const SOCKET_RESPONSE:String = "socket_response";
+
+		public var response:String;
+		//public var isInRecordProcessing:Boolean;
+		
+		public function SocketResponseEvent(response:String,/*isInRecordProcessing:Boolean,*/ type:String, bubbles:Boolean=false, cancelable:Boolean=false)
+		{
+			super(type, bubbles, cancelable);
+			this.response = response;
+			//this.result = result;
+			//this.isInRecordProcessing = isInRecordProcessing;
+		}
+		
+		
+	    override public function clone():Event
+	    {
+	        return new SocketResponseEvent(response, /*isInRecordProcessing, */ type, bubbles, cancelable);
+	    }
+	}
+}
\ No newline at end of file

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/SocketResponseEvent.as
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/SocketResponseEvent.as
------------------------------------------------------------------------------
    svn:mime-type = text/plain