From: Paul K. <pau...@us...> - 2007-03-04 07:57:13
|
Update of /cvsroot/openxcf/cfcUnit/cfcunit/app/machii/plugins In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9749/cfcunit/app/machii/plugins Added Files: PropertyToEventPlugin.cfc ExternalConfigPlugin.cfc Log Message: Created a custom tag that allows the test runner application to be invoked from a location other than the "/cfcunit" folder. The tag has two attributes: "preferencesFile" and "assetsFolder". --- NEW FILE: ExternalConfigPlugin.cfc --- <!--- Copyright (c) 2006, Paul Kenney All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---> <cfcomponent name="ExternalConfigPlugin" extends="cfcunit.machii.framework.Plugin" output="false"> <!------------------------------------------------------------------------------------> <cffunction name="configure" returntype="void" access="public" output="false"> <cfset var parameters = getParameters()> <cfset var externalConfigStructName = getParameter("externalConfigStructName", "request.externalConfig")> <cfset var externalConfigStruct = evaluate(externalConfigStructName)> <cfset var key = ""> <cfset var externalName = ""> <cfset var propertyName = ""> <cfloop collection="#parameters#" item="key"> <cfif listFirst(key, ":") is "externalName" and listFirst(parameters[key], ":") is "propertyName"> <cfset externalName = listRest(key, ":")> <cfset propertyName = listRest(parameters[key], ":")> <cfif structKeyExists(externalConfigStruct, externalName)> <cfset setProperty(propertyName, externalConfigStruct[externalName])> </cfif> </cfif> </cfloop> </cffunction> <!------------------------------------------------------------------------------------> </cfcomponent> --- NEW FILE: PropertyToEventPlugin.cfc --- <!--- Copyright (c) 2006, Paul Kenney All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---> <cfcomponent name="PropertyToEventPlugin" extends="cfcunit.machii.framework.Plugin" output="false"> <!-----------------------------------------------------------------------------------------> <cfproperty name="mappings" type="struct"/> <!-----------------------------------------------------------------------------------------> <cffunction name="configure" returntype="void" access="public" output="false"> <cfset var parameters = getParameters()> <cfset var key = ""> <cfset var propertyName = ""> <cfset var eventName = ""> <cfset variables.mappings = structNew()> <cfloop collection="#parameters#" item="key"> <cfif listFirst(key, ":") is "propertyName" and listFirst(parameters[key], ":") is "eventName"> <cfset propertyName = listRest(key, ":")> <cfset eventName = listRest(parameters[key], ":")> <cfset variables.mappings[propertyName] = eventName> </cfif> </cfloop> </cffunction> <!-----------------------------------------------------------------------------------------> <cffunction name="preView" access="public" returntype="void" output="false"> <cfargument name="eventContext" type="cfcunit.machii.framework.EventContext" required="true" /> <cfset var event = arguments.eventContext.getCurrentEvent()> <cfset var propertyName = ""> <cfloop collection="#variables.mappings#" item="propertyName"> <cfset event.setArg(variables.mappings[propertyName], getProperty(propertyName))> </cfloop> </cffunction> <!-----------------------------------------------------------------------------------------> </cfcomponent> |