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 [12/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...
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAdapter.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAdapter.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAgent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAgent.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAgent.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAgent.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,143 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.display.DisplayObject;
+
+import mx.automation.AutomationHelper;
+import mx.core.FlexGlobals;
+import mx.events.FlexEvent;
+import mx.managers.ISystemManager;
+
+[Mixin]
+public class ToolAgent
+{
+
+ include "../../core/Version.as";
+
+ private static var _root:DisplayObject;
+
+ private static var qtpAdapter:ToolAdapter;
+
+ private static var _clientSocketHandler:ClientSocketHandler;
+
+ public static function get clientSocketHandler():ClientSocketHandler
+ {
+ return _clientSocketHandler;
+ }
+
+
+
+ public static function init(root:DisplayObject):void
+ {
+ if(!qtpAdapter)
+ {
+ _root = root;
+ new ToolAgent(root);
+ }
+ }
+
+ public function ToolAgent(root:DisplayObject):void
+ {
+ super();
+
+ root.addEventListener(FlexEvent.APPLICATION_COMPLETE, applicationCompleteHandler);
+ }
+
+ /*private function applicationCloseHandler(event:Event):void
+ {
+ var sm:ISystemManager = Application.application.systemManager;
+ if(sm.isTopLevelRoot()){
+ trace("getting application close event..informing server to close the socket");
+ clientSocketHandler.sendData(ClientSocketHandler.closeRequestString);
+ }
+ }*/
+
+ private function applicationCompleteHandler(event:FlexEvent):void
+ {
+ _root.removeEventListener(FlexEvent.APPLICATION_COMPLETE, applicationCompleteHandler);
+ //Application.application.addEventListener(Event.CLOSING, applicationCloseHandler);
+
+ var currentAppId:String;
+ var applicationType:int = -1;
+
+
+ // it was observed that when there are other applications loaded into the same domain
+ // we get this event more than once. But for one application domain we need to create the details only once
+ if(qtpAdapter)
+ return;
+
+ if(FlexGlobals.topLevelApplication.hasOwnProperty("applicationID"))// this should work for AIR app's
+ {
+ currentAppId = FlexGlobals.topLevelApplication.applicationID;
+ applicationType = ToolAdapter.ApplicationType_AIR;
+ }
+ else if (FlexGlobals.topLevelApplication.hasOwnProperty("id"))
+ {
+ currentAppId = FlexGlobals.topLevelApplication.id; // this should work for flex apps
+ applicationType = ToolAdapter.ApplicationType_Flex;
+ }
+ /*if( applicationType != ToolAdapter.ApplicationType_AIR)
+ return ;*/ // we support only AIR from this swc // we removed as we support Flex app from AIR for
+ // marshalling
+ if(!currentAppId)
+ {
+ // we have not got the flex type id and we have not got the air type id
+ // so here if it is the top level root applicaiton, we assume that it is air
+ if(_root && (_root as ISystemManager) && (_root as ISystemManager).isTopLevelRoot())
+ {
+ try
+ {
+ currentAppId = FlexGlobals.topLevelApplication.stage.nativeWindow.title;
+ applicationType = ToolAdapter.ApplicationType_AIR;
+ }
+ catch(e:Error)
+ {
+ // we could not access the air related properties.
+ // so this looks to be an improper flex applicaiton which has not specified an ID
+ trace ("ToolAgent:applicationCompleteHandler()-Flex Root Applicaiton which does not have an id found. Please verify");
+ applicationType = ToolAdapter.ApplicationType_Flex;
+ }
+ }
+ else
+ applicationType = ToolAdapter.ApplicationType_Flex; // this is the case of flex applicaiton which
+ // is loaded as the sub application.
+ }
+
+
+ ToolAdapter.applicationType = applicationType;
+ ToolAdapter.applicationId = currentAppId;
+
+ //var point:Point = ExternalInterfaceMethods_AS.getApplicationStartPointInScreenCoordinates(Application.application.id);
+ qtpAdapter = new ToolAdapter();
+
+ if(AutomationHelper.isRequiredAirClassPresent() == true)
+ {
+
+ if(FlexGlobals.topLevelApplication.systemManager.isTopLevelRoot())
+ // start the socket here.
+ _clientSocketHandler = new ClientSocketHandler(qtpAdapter,currentAppId,applicationType);
+ }
+
+ }
+}
+
+}
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAgent.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAgent.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAutomationClass.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAutomationClass.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAutomationClass.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAutomationClass.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.AutomationClass;
+import mx.automation.IAutomationPropertyDescriptor;
+import mx.utils.ObjectUtil;
+
+/**
+ * Provides serializable class information for external automation tools.
+ * Some classes are represented as the same AutomationClass (HSlider and VSlider, forinstance).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+
+public class ToolAutomationClass extends AutomationClass
+ implements IToolAutomationClass
+{
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ public function ToolAutomationClass(name:String, superClassName:String = null)
+ {
+ super(name, superClassName);
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ * QTP is case insensitive. QTP has been found to change property names
+ * at certain instance to complete lower case names. Hence we use a map
+ * built on lower case property name to find the descriptor.
+ */
+ private var propertyCaseMap:Object = {};
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Add a descriptor of a property to the class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ override public function addPropertyDescriptor(p:IAutomationPropertyDescriptor):void
+ {
+ super.addPropertyDescriptor(p);
+ propertyCaseMap[p.name.toLowerCase()] = p;
+ }
+
+ /**
+ * @private
+ * Getter for the map of lower case property name and descriptor.
+ */
+ public function get propertyLowerCaseMap():Object
+ {
+ return propertyCaseMap;
+ }
+}
+
+}
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAutomationClass.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolAutomationClass.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEnvironment.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEnvironment.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEnvironment.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEnvironment.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,369 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.AutomationClass;
+import mx.automation.IAutomationClass;
+import mx.automation.IAutomationClass2;
+import mx.automation.IAutomationEnvironment;
+import mx.automation.IAutomationEventDescriptor;
+import mx.automation.IAutomationMethodDescriptor;
+import mx.automation.IAutomationObject;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+
+[ResourceBundle("automation_agent")]
+
+/**
+ * @private
+ */
+public class ToolEnvironment implements IAutomationEnvironment
+{
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ public function ToolEnvironment(source:XML)
+ {
+ super();
+
+ for (var i:Object in source.ClassInfo)
+ {
+ // populate the class/automationClass map
+ var classInfoXML:XML = source.ClassInfo[i];
+ var automationClassName:String = classInfoXML.@Name.toString();
+ var superClassName:String =
+ classInfoXML.@Extends && classInfoXML.@Extends.length != 0 ?
+ classInfoXML.@Extends.toString() :
+ null;
+ var automationClass:ToolAutomationClass =
+ new ToolAutomationClass(automationClassName, superClassName);
+ automationClassName2automationClass[automationClassName] =
+ automationClass;
+
+ for (var j:Object in classInfoXML.Implementation)
+ {
+ var implementationXML:XML = classInfoXML.Implementation[j];
+ var realClassName:String =
+ implementationXML.@Class.toString().replace("::", ".");
+ var versionObj:Object = implementationXML.@Version;
+ var versionNum:String = versionObj.toString();
+ if(versionNum!= "")
+ {
+ realClassName = realClassName+"_"+versionNum;
+ automationClass.implementationVersion = int(versionNum);
+ }
+ else
+ {
+ automationClass.implementationVersion = 0;
+ }
+ className2automationClass[realClassName] = automationClass;
+ automationClass.addImplementationClassName(realClassName);
+ }
+
+ // for each method
+ for (var k:Object in classInfoXML.TypeInfo.Operation)
+ {
+ var operationXML:XML = classInfoXML.TypeInfo.Operation[k];
+
+ var automationMethodName:String = operationXML.@Name.toString();
+ var eventClassName:String =
+ operationXML.Implementation.@Class.toString();
+ eventClassName = eventClassName.replace("::", ".");
+ var eventType:String =
+ operationXML.Implementation.@Type.toString();
+
+ if (eventType)
+ {
+ var args:Array = [];
+ for (var m:Object in operationXML.Argument)
+ {
+ var argXML:XML = operationXML.Argument[m];
+ var argName:String = argXML.@Name.toString();
+ var argType:String =
+ argXML.Type.@VariantType.toString().toLowerCase();
+ var argCodec:String = argXML.Type.@Codec.toString();
+ var defaultValue:String =
+ argXML.@DefaultValue.length() > 0 ?
+ argXML.@DefaultValue.toString() :
+ null;
+ var pd:ToolPropertyDescriptor =
+ new ToolPropertyDescriptor(
+ argName, true, true, argType,
+ (argCodec == null || argCodec.length == 0 ?
+ "object" :
+ argCodec), defaultValue);
+ args.push(pd);
+ }
+
+ var returnType:String =
+ operationXML.ReturnValueType.Type.@VariantType.toString();
+
+ var codecName:String =
+ operationXML.ReturnValueType.Type.@Codec.toString();
+
+ if(eventClassName)
+ {
+ var ed:IAutomationEventDescriptor = new ToolEventDescriptor(
+ automationMethodName, eventClassName,
+ eventType, args);
+ automationClass.addEvent(ed);
+ }
+ else
+ {
+ var md:IAutomationMethodDescriptor = new ToolMethodDescriptor(
+ automationMethodName, eventType, returnType,
+ codecName, args);
+ automationClass.addMethod(md);
+ }
+
+ }
+ }
+
+ for (var p:Object in classInfoXML.Properties.Property)
+ {
+ var propertyXML:XML = classInfoXML.Properties.Property[p];
+ var propName:String = propertyXML.@Name.toString();
+ var propType:String =
+ propertyXML.Type.@VariantType.toString().toLowerCase();
+ var propCodec:String = propertyXML.Type.@Codec.toString();
+ var pd1:ToolPropertyDescriptor =
+ new ToolPropertyDescriptor(
+ propName,
+ propertyXML.@ForDescription.toString() == "true",
+ propertyXML.@ForVerification.toString() == "true",
+ propType,
+ (propCodec == null || propCodec.length == 0 ?
+ "object" :
+ propCodec));
+ automationClass.addPropertyDescriptor(pd1);
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ private var className2automationClass:Object = {};
+
+ /**
+ * @private
+ */
+ private var automationClassName2automationClass:Object = {};
+
+ /**
+ * @private
+ * Used for accessing localized Error messages.
+ */
+ private var resourceManager:IResourceManager =
+ ResourceManager.getInstance();
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ public function getAutomationClassByInstance(
+ obj:IAutomationObject):IAutomationClass
+ {
+ var result:IAutomationClass = findClosestAncestor(obj);
+ if (! result)
+ {
+ var message:String = resourceManager.getString(
+ "automation_agent", "autClassNotFound",
+ [AutomationClass.getClassName(obj), obj]);
+ throw new Error(message);
+ }
+ return result;
+ }
+
+ /**
+ * @private
+ */
+ public function getAutomationClassByName(
+ automationClass:String):IAutomationClass
+ {
+ return ToolAutomationClass(
+ automationClassName2automationClass[automationClass]);
+ }
+
+ /**
+ * Finds the closest ancestor to this object about which information was
+ * passed in the environment XML.
+ * @private
+ */
+ private function findClosestAncestor(obj:Object):IAutomationClass
+ {
+ var className:String = AutomationClass.getClassName(obj).concat('_').concat(AutomationClass.getMajorVersion());
+ var version:int = int(className.substr(className.length-1));
+ className = className.substring(0, className.length - 2);
+ for(var i:int = version; i > 0; i--){
+ var classNameWithVersion:String = className.concat('_').concat(i);
+ if (classNameWithVersion in className2automationClass)
+ return className2automationClass[classNameWithVersion];
+ }
+
+ if (className in className2automationClass)
+ return className2automationClass[className];
+
+ var ancestors:Array = findAllAncestors(obj);
+ if (ancestors.length != 0)
+ {
+ className2automationClass[className] = getClosestVersionAncestor(ancestors);
+ return className2automationClass[className];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function getClosestVersionAncestor(ancestors:Array):IAutomationClass
+ {
+ //There can be many ancestors of same class but with different versions
+ //We need to find the ancestor which is closer in version to current version
+ var closeAncestors:Array = [];
+ closeAncestors.push(ancestors[0]);
+ var n:int = ancestors.length;
+ var isAncestor:Boolean = false;
+
+ for( var i:int = 1; i < n; i++ )
+ {
+ var firstSuperClass:String = ancestors[0].superClassName;
+ var secondAncestor:IAutomationClass = ancestors[i];
+
+ while( firstSuperClass )
+ {
+ if( firstSuperClass == secondAncestor.name )
+ {
+ isAncestor = true;
+ break;
+ }
+ else
+ {
+ firstSuperClass = getAutomationClassByName(firstSuperClass).superClassName;
+ }
+ }
+ if( !isAncestor )
+ {
+ var temp:Array = [];
+ temp.push(ancestors[i]);
+ closeAncestors = temp.concat(closeAncestors);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ var currentVersion:int = int(AutomationClass.getMajorVersion());
+ var closestAncestor:IAutomationClass = closeAncestors[0];
+
+ if(closeAncestors[0] is IAutomationClass2)
+ {
+ var currentAncestorVersion:int = IAutomationClass2(closeAncestors[0]).implementationVersion;
+ n = closeAncestors.length;
+ for (i = 1; i < n; i++)
+ {
+ var nextAncestorVersion:int = IAutomationClass2(closeAncestors[i]).implementationVersion;
+ if( currentAncestorVersion > currentVersion )
+ currentAncestorVersion = nextAncestorVersion;
+ if( nextAncestorVersion <= currentVersion && nextAncestorVersion >= currentAncestorVersion )
+ {
+ closestAncestor = closeAncestors[i];
+ currentAncestorVersion = nextAncestorVersion;
+ }
+ }
+ }
+ return closestAncestor;
+ }
+
+ /**
+ * @private
+ */
+ private function findAllAncestors(obj:Object):Array
+ {
+ var result:Array = [];
+
+ for (var i:String in className2automationClass)
+ {
+ var temp:String = i;
+ if(temp.indexOf("_") != -1)
+ temp = temp.substring(0, i.lastIndexOf("_"));
+ var realClass:Class =
+ AutomationClass.getDefinitionFromObjectDomain(obj,temp);
+ if (realClass && obj is realClass)
+ result.push(className2automationClass[i]);
+ }
+
+ result.sort(sortAncestors);
+
+ return result;
+ }
+
+ /**
+ * @private
+ */
+ private function sortAncestors(a:IAutomationClass, b:IAutomationClass):int
+ {
+ var superClass:IAutomationClass;
+ var x:String = a.superClassName;
+ while (x)
+ {
+ if (x == b.name)
+ return -1;
+ superClass = getAutomationClassByName(x);
+ x = superClass.superClassName;
+ }
+
+ x = b.superClassName;
+ while (x)
+ {
+ if (x == a.name)
+ return 1;
+ superClass = getAutomationClassByName(x);
+ x = superClass.superClassName;
+ }
+
+ // Bad things will happen if we return 0... maybe throw an error?
+ return 0;
+ }
+}
+
+}
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEnvironment.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEnvironment.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEventDescriptor.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEventDescriptor.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEventDescriptor.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEventDescriptor.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,128 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+import flash.events.FocusEvent;
+import flash.events.KeyboardEvent;
+import flash.system.ApplicationDomain;
+import flash.utils.describeType;
+
+import mx.automation.Automation;
+import mx.automation.AutomationEventDescriptor;
+import mx.automation.IAutomationObject;
+import mx.automation.events.AutomationReplayEvent;
+import mx.core.mx_internal;
+import mx.automation.tool.IToolCodecHelper;
+
+use namespace mx_internal;
+
+/**
+ * Method descriptor class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+public class ToolEventDescriptor extends AutomationEventDescriptor
+{
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ public function ToolEventDescriptor(name:String,
+ eventClassName:String,
+ eventType:String,
+ args:Array)
+ {
+ super(name, eventClassName, eventType, args);
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ private var _eventArgASTypesInitialized:Boolean = false;
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ override public function record(target:IAutomationObject, event:Event):Array
+ {
+ var args:Array = getArgDescriptors(target);
+
+ var helper:IToolCodecHelper = ToolAdapter.getCodecHelper();
+ return helper.encodeProperties(event, args, target);
+ }
+
+ /**
+ * @private
+ */
+ override public function replay(target:IAutomationObject, args:Array):Object
+ {
+ if(!target)
+ return null;
+
+ var event:Event = createEvent(target);
+ var argDescriptors:Array = getArgDescriptors(target);
+ var helper:IToolCodecHelper = ToolAdapter.getCodecHelper();
+ helper.decodeProperties(event, args, argDescriptors,
+ IAutomationObject(target));
+
+ var riEvent:AutomationReplayEvent = new AutomationReplayEvent();
+ riEvent.automationObject = target;
+ riEvent.replayableEvent = event;
+ Automation.automationManager.replayAutomatableEvent(riEvent);
+
+ return null;
+ }
+
+}
+
+}
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEventDescriptor.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolEventDescriptor.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMarshallingEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMarshallingEvent.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMarshallingEvent.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMarshallingEvent.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,223 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+ import mx.events.SWFBridgeEvent;
+ import flash.events.Event;
+
+ /**
+ * The MarshalledAutomationEvents class represents event objects that are dispatched
+ * by the AutomationManager.This represents the marshalling related events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ public class ToolMarshallingEvent extends SWFBridgeEvent
+ {
+ include "../../core/Version.as";
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Class constants
+ //
+ //--------------------------------------------------------------------------
+ /*
+ public static const BEGIN_RECORDING:String = "BeginRecording";
+ public static const END_RECORDING:String = "EndRecording";
+
+ public static const ENV_DETAILS:String = "SetEnvironment";
+ public static const RECORDING_STATUS_REQUEST:String ="GetRecordingStatus";
+ public static const RECORDING_STATUS_REPLY:String ="RecordingStatusReply";
+ */
+
+ public static const RECORD:String = "Record";
+
+ public static const FIND_OBJECTIDS:String = "FindObjectIDs";
+ public static const FIND_OBJECTIDS_REPLY:String = "FindObjectIDsReply";
+
+ public static const RUN:String = "Run";
+ public static const RUN_REPLY:String = "RunReply";
+
+ public static const GET_ACTIVESCREEN:String = "GetActiveScreen";
+ public static const GET_ACTIVESCREEN_REPLY:String = "GetActiveScreenReply";
+
+ public static const GET_RECTANGLE:String = "GetRectangle";
+ public static const GET_RECTANGLE_REPLY:String = "GetRectangleReply";
+
+ public static const GET_PARENT:String = "GetParent";
+ public static const GET_PARENT_REPLY:String = "GetParentReply";
+
+ public static const GET_ELEMENT_FROM_POINT:String = "GetElementFromPoint";
+ public static const GET_ELEMENT_FROM_POINT_REPLY:String = "GetElementFromPointReply";
+
+ public static const GET_ELEMENT_TYPE:String = "GetElementType";
+ public static const GET_ELEMENT_TYPE_REPLY:String = "GetElementTypeReply";
+
+
+ public static const GET_DISPLAY_NAME:String = "GetDisplayName";
+ public static const GET_DISPLAY_NAME_REPLY:String = "GetDisplayNameReply";
+
+
+ public static const GET_PROPERTIES:String = "GetProperties";
+ public static const GET_PROPERTIES_REPLY:String = "GetPropertiesReply";
+
+
+ public static const GET_TABULAR_DATA:String = "GetTabularData";
+ public static const GET_TABULAR_DATA_REPLY:String = "GetTabularDataReply";
+
+
+ public static const GET_TABULAR_ATTRIBUTES:String = "GetTabularAttributes";
+ public static const GET_TABULAR_ATTRIBUTES_REPLY:String = "GetTabularAttributesReply";
+
+
+
+ public static const BUILD_DESCRIPTION:String = "BuilddDescription";
+ public static const BUILD_DESCRIPTION_REPLY:String = "BuilddDescriptionReply";
+
+
+ public static const GET_CHILDREN:String = "GetChildren";
+ public static const GET_CHILDREN_REPLY:String = "GetChildrenReply";
+
+
+ public static const LEARN_CHILD_OBJECTS:String = "LearnChildObjects";
+ public static const LEARN_CHILD_OBJECTS_REPLY:String = "LearnChildObjectsReply";
+
+
+ public static const GET_LAST_ERROR:String = "GetLastError";
+ public static const GET_LAST_ERROR_REPLY:String = "GetLastErrorReply";
+
+
+ public static const SET_LAST_ERROR:String = "SetLastError";
+ // no reply for the setLastError
+
+
+ public static function marshal(event:Event):ToolMarshallingEvent
+ {
+ var eventObj:Object = event;
+ return new ToolMarshallingEvent(eventObj.type,
+ eventObj.bubbles,
+ eventObj.cancelable,/*
+ eventObj.automationObject,
+ eventObj.replayableEvent,
+ eventObj.args,
+ eventObj.name,
+ eventObj.cacheable, */
+ eventObj.applicationName,
+ eventObj.interAppDataToSubApp ,
+ eventObj.interAppDataToMainApp);
+
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ public function ToolMarshallingEvent(type:String,
+ bubbles:Boolean = true,
+ cancelable:Boolean = true,/*
+ automationObject:IAutomationObject = null,
+ replayableEvent:Event = null,
+ args:Array = null,
+ name:String = null,
+ cacheable:Boolean = false,*/
+ applicationName:String = null ,
+ interAppDataToSubApp :Array =null,
+ interAppDataToMainApp:Array = null)
+ {
+ super(type, bubbles, cancelable);
+ // this.automationObject = automationObject;
+ //this.replayableEvent = replayableEvent;
+ //this.args = args;
+ //this.name = name;
+ //this.cacheable = cacheable;
+ this.applicationName = applicationName;
+ this.interAppDataToSubApp = interAppDataToSubApp;
+ this.interAppDataToMainApp = interAppDataToMainApp;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+
+
+ /**
+ * Contains <code>string</code> which represents the application Name for the application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ public var applicationName:String;
+
+
+ /**
+ * Contains <code>array</code> which represents the data from the parent to sub applications.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ public var interAppDataToSubApp:Array;
+
+ /**
+ * Contains <code>array</code> which represents the data from the sub applications to parent.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ public var interAppDataToMainApp:Array;
+
+
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Overridden methods: Event
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ override public function clone():Event
+ {
+ return new ToolMarshallingEvent(type, bubbles, cancelable,/*
+ automationObject,
+ replayableEvent,
+ args,
+ name,
+ cacheable,*/
+ applicationName, interAppDataToSubApp,interAppDataToMainApp);
+ }
+ }
+}
\ No newline at end of file
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMarshallingEvent.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMarshallingEvent.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMethodDescriptor.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMethodDescriptor.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMethodDescriptor.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMethodDescriptor.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,151 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+import flash.system.ApplicationDomain;
+import flash.utils.describeType;
+import mx.automation.Automation;
+import mx.automation.AutomationClass;
+import mx.automation.IAutomationManager;
+import mx.automation.IAutomationMethodDescriptor;
+import mx.automation.IAutomationObject;
+import mx.core.mx_internal;
+import mx.automation.tool.IToolCodecHelper;
+import mx.automation.AutomationMethodDescriptor;
+
+use namespace mx_internal;
+
+/**
+ * Basic method descriptor class. Generates descriptor from event parameters, if necessary
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+public class ToolMethodDescriptor extends AutomationMethodDescriptor
+ implements IToolMethodDescriptor
+{
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ public function ToolMethodDescriptor(name:String,
+ asMethodName:String,
+ returnType:String,
+ codecName:String,
+ args:Array)
+ {
+ super(name, asMethodName, returnType, args);
+ _codecName = codecName;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // codecName
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ private var _codecName:String;
+
+ /**
+ * @private
+ */
+ public function get codecName():String
+ {
+ return _codecName;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ override public function record(target:IAutomationObject, event:Event):Array
+ {
+ // Unsupported to record a method.
+ throw new Error();
+ return null;
+ }
+
+ /**
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ override public function replay(target:IAutomationObject, args:Array):Object
+ {
+ var delegate:IAutomationObject = target;
+ var argDescriptors:Array = getArgDescriptors(delegate);
+ var asArgs:Object = {};
+
+ var helper:IToolCodecHelper = ToolAdapter.getCodecHelper();
+ helper.decodeProperties(asArgs, args, argDescriptors, delegate);
+
+ // Convert args into an ordered array.
+ var asArgsOrdered:Array = [];
+ for (var argNo:int = 0; argNo < argDescriptors.length; ++argNo)
+ asArgsOrdered.push(asArgs[argDescriptors[argNo].name]);
+
+ var retVal:Object = super.replay(target, asArgsOrdered);
+
+ return helper.encodeValue(retVal, returnType, _codecName, delegate);
+ }
+
+}
+
+}
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMethodDescriptor.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolMethodDescriptor.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolPropertyDescriptor.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolPropertyDescriptor.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolPropertyDescriptor.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolPropertyDescriptor.as Mon Jun 18 18:10:20 2012
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.AutomationPropertyDescriptor;
+
+/**
+ * Describes a property of a test object.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+public class ToolPropertyDescriptor extends AutomationPropertyDescriptor implements IToolPropertyDescriptor
+{
+ /**
+ * @private
+ */
+ private var _type:String;
+
+ /**
+ * @private
+ */
+ private var _codecName:String;
+
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 4
+ */
+ public function ToolPropertyDescriptor(name:String,
+ forDescription:Boolean,
+ forVerification:Boolean,
+ type:String,
+ codecName:String,
+ defaultValue:String = null)
+ {
+ super(name, forDescription, forVerification, defaultValue);
+ _type = type;
+ _codecName = codecName;
+ }
+
+ /**
+ * @private
+ */
+ public function get Tooltype():String
+ {
+ return _type;
+ }
+
+ /**
+ * @private
+ */
+ public function get codecName():String
+ {
+ return _codecName;
+ }
+
+ /**
+ * @private
+ */
+/* public function set MyAsType(v:String):void
+ {
+ _asType = v;
+ }
+*/
+ /**
+ * @private
+ */
+/* public function get MyAsType():String
+ {
+ return _asType ;
+ }
+*/
+
+}
+
+}
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolPropertyDescriptor.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/automation/tool/ToolPropertyDescriptor.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/core/Version.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/tool_air/src/mx/core/Version.as?rev=1351437&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/tool_air/src/mx/core/Version.as (added)
+++ incubator/flex/trunk/frameworks/projects/tool_air/src/mx/core/Version.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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+import mx.core.mx_internal;
+
+/**
+ * @private
+ * Version string for this class.
+ */
+mx_internal static const VERSION:String = "4.6.0.0";
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/core/Version.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/trunk/frameworks/projects/tool_air/src/mx/core/Version.as
------------------------------------------------------------------------------
svn:mime-type = text/plain