Author: fthomas
Date: Thu Dec 6 00:55:01 2012
New Revision: 1417717
URL: http://svn.apache.org/viewvc?rev=1417717&view=rev
Log:
- Added Java, Maven and Ant path detection from env. on windows
- Added abstract shell command and native process helper
Added:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractShellCommand.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/GetEnvironmentVariablesCommand.as
- copied, changed from r1417526,
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml
- copied, changed from r1417525,
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeProcessHelper.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/CommandLineProcessTest.as
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/GeneralSettingsPM.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/IGeneralSettingsPM.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/GeneralSettings.mxml
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/formItem/ToolHomeFormItem.mxml
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/domain/SettingModel.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateAntHomePathCommand.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateJavaHomePathCommand.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateMavenHomePathCommand.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/SampleTest.as
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/GeneralSettingsPM.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/GeneralSettingsPM.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/GeneralSettingsPM.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/GeneralSettingsPM.as
Thu Dec 6 00:55:01 2012
@@ -15,6 +15,8 @@
limitations under the License.
*/
package
org.apache.flex.utilities.developerToolSuite.presentation.behavior.settingsPanel
{
+ import flash.utils.Dictionary;
+
import mx.collections.ArrayCollection;
import org.apache.flex.utilities.developerToolSuite.LocaleUtil;
@@ -37,6 +39,10 @@ package org.apache.flex.utilities.develo
return LocaleUtil.getDefaultLanguage(settings.locale);
}
+ public function get environmentVariables():Dictionary {
+ return settings.environmentVariables;
+ }
+
public function get javaHomePath():String {
return settings.JAVA_HOME;
}
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/IGeneralSettingsPM.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/IGeneralSettingsPM.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/IGeneralSettingsPM.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/settingsPanel/IGeneralSettingsPM.as
Thu Dec 6 00:55:01 2012
@@ -15,6 +15,8 @@
limitations under the License.
*/
package
org.apache.flex.utilities.developerToolSuite.presentation.behavior.settingsPanel
{
+ import flash.utils.Dictionary;
+
import mx.collections.ArrayCollection;
import
org.apache.flex.utilities.developerToolSuite.executor.domain.SettingModel;
@@ -24,6 +26,8 @@ package org.apache.flex.utilities.develo
function get currentLanguage():Object;
+ function get environmentVariables():Dictionary;
+
function get javaHomePath():String;
function get antHomePath():String;
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
Thu Dec 6 00:55:01 2012
@@ -17,24 +17,20 @@ limitations under the License.
-->
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:parsley="http://www.spicefactory.org/parsley"
-
xmlns:settingspanel="org.apache.flex.utilities.developerToolSuite.presentation.behavior.settingsPanel.*">
+
xmlns:settingspanel="org.apache.flex.utilities.developerToolSuite.presentation.behavior.settingsPanel.*"
+
xmlns:menu="org.apache.flex.utilities.developerToolSuite.presentation.behavior.menu.*">
<fx:Declarations>
+ <parsley:DynamicObject type="{GeneralMenu}"/>
+
+ <parsley:MapCommand type="{MenuActionCommand}"/>
+
<settingspanel:GeneralSettingsPM/>
- <parsley:MapCommand type="{ChangeLanguageCommand}"/>
- <parsley:MapCommand type="{SaveSettingsCommand}"/>
- <parsley:MapCommand type="{SaveSettingCommand}"/>
- <parsley:MapCommand type="{ValidateJavaHomePathCommand}"/>
- <parsley:MapCommand type="{ValidateAntHomePathCommand}"/>
- <parsley:MapCommand type="{ValidateMavenHomePathCommand}"/>
+ <menu:ApplicationMenuPM/>
</fx:Declarations>
<fx:Script><![CDATA[
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ChangeLanguageCommand;
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingCommand;
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingsCommand;
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateAntHomePathCommand;
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateJavaHomePathCommand;
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateMavenHomePathCommand;
+ import
org.apache.flex.utilities.developerToolSuite.infrastructure.command.MenuActionCommand;
+ import
org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.GeneralMenu;
]]></fx:Script>
</fx:Object>
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/GeneralSettings.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/GeneralSettings.mxml?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/GeneralSettings.mxml
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/GeneralSettings.mxml
Thu Dec 6 00:55:01 2012
@@ -80,13 +80,13 @@ limitations under the License.
languageComboBox.selectedItem = model.currentLanguage;
javaHomeFormItem.dispatch = dispatch;
- javaHomeFormItem.propertyValue = model.javaHomePath;
+ javaHomeFormItem.propertyValue = model.javaHomePath ?
model.javaHomePath : model.environmentVariables["JAVA_HOME"];
antHomeFormItem.dispatch = dispatch;
- antHomeFormItem.propertyValue = model.antHomePath;
+ antHomeFormItem.propertyValue = model.antHomePath ?
model.antHomePath : model.environmentVariables["ANT_HOME"];
mavenHomeFormItem.dispatch = dispatch;
- mavenHomeFormItem.propertyValue = model.mavenHomePath;
+ mavenHomeFormItem.propertyValue = model.mavenHomePath ?
model.mavenHomePath : model.environmentVariables["MAVEN_HOME"];
}
private function
localeComboBox_changeHandler(event:IndexChangeEvent):void {
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/formItem/ToolHomeFormItem.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/formItem/ToolHomeFormItem.mxml?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/formItem/ToolHomeFormItem.mxml
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/formItem/ToolHomeFormItem.mxml
Thu Dec 6 00:55:01 2012
@@ -62,7 +62,7 @@ limitations under the License.
private var _file:File;
private var _toolHomePathValidated:Boolean;
- private var _responder:mx.rpc.Responder;
+ private var _validateToolResponder:mx.rpc.Responder;
[Bindable]
public var propertyName:String;
@@ -86,9 +86,11 @@ limitations under the License.
public var dispatch:Function;
private function creationCompleteHandler(event:FlexEvent):void {
- _responder = new mx.rpc.Responder(toolHomePathResult,
toolHomePathValidatedError);
+ _validateToolResponder = new mx.rpc.Responder(toolHomePathResult,
toolHomePathValidatedError);
+
toolHomeLocation.text = propertyValue;
- dispatch(new validateToolMessageClass(toolHomeLocation.text,
_responder));
+
+ dispatch(new validateToolMessageClass(propertyValue,
_validateToolResponder));
}
private function browseButton_clickHandler(event:MouseEvent):void {
@@ -104,13 +106,14 @@ limitations under the License.
private function file_select(evt:Event):void {
toolHomeLocation.text = _file.nativePath;
- dispatch(new validateToolMessageClass(toolHomeLocation.text,
_responder));
+ dispatch(new validateToolMessageClass(toolHomeLocation.text,
_validateToolResponder));
}
private function
toolHomeLocation_changeHandler(event:TextOperationEvent):void {
- dispatch(new validateToolMessageClass(toolHomeLocation.text,
_responder));
+ dispatch(new validateToolMessageClass(toolHomeLocation.text,
_validateToolResponder));
}
+ // Result handlers for the commands which check if the path of the
tool is good
private function toolHomePathResult(result:Boolean):void {
toolHomePathValidated = true;
@@ -123,6 +126,7 @@ limitations under the License.
toolHomePathValidated = false;
}
+ // Result handlers for the SaveSettingCommand
public function get toolHomePathValidated():Boolean {
return _toolHomePathValidated;
}
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/domain/SettingModel.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/domain/SettingModel.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/domain/SettingModel.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/domain/SettingModel.as
Thu Dec 6 00:55:01 2012
@@ -15,9 +15,11 @@
limitations under the License.
*/
package org.apache.flex.utilities.developerToolSuite.executor.domain {
+ import flash.utils.Dictionary;
[Bindable]
public class SettingModel {
+ public var environmentVariables:Dictionary;
public var locale:String;
public var JAVA_HOME:String;
public var ANT_HOME:String;
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as
Thu Dec 6 00:55:01 2012
@@ -33,12 +33,12 @@ package org.apache.flex.utilities.develo
protected var log:ILogger = LogUtil.getLogger(this);
- [Inject]
- public var db:ApplicationDB;
-
[MessageDispatcher]
public var dispatch:Function;
+ [Inject]
+ public var db:ApplicationDB;
+
public var callback:Function;
protected var sql:String;
@@ -51,11 +51,6 @@ package org.apache.flex.utilities.develo
prepareSql();
}
- [MessageHandler]
- public function DBReadyHandler(msg:InitApplicationMessage):void {
- prepareSql();
- }
-
protected function prepareSql():void {
var responder:Responder = new Responder(result, error);
stmt.text = sql;
@@ -64,12 +59,12 @@ package org.apache.flex.utilities.develo
protected function result(result:SQLResult):void {
var resultMessage:String = (result.data != null) ?
ObjectUtil.toString(result.data) : result.rowsAffected + " affected row(s)";
- log.debug("Successfully executed command: " + resultMessage);
+ log.debug("Successfully executed shell: " + resultMessage);
callback(resultMessage);
}
protected function error(error:SQLError):void {
- log.error("Error executing command: " +
ObjectUtil.toString(error));
+ log.error("Error executing shell: " + ObjectUtil.toString(error));
callback(error);
}
}
Added:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractShellCommand.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractShellCommand.as?rev=1417717&view=auto
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractShellCommand.as
(added)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractShellCommand.as
Thu Dec 6 00:55:01 2012
@@ -0,0 +1,95 @@
+/**
+ 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
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command {
+ import flash.events.IOErrorEvent;
+ import flash.events.NativeProcessExitEvent;
+ import flash.events.ProgressEvent;
+
+ import mx.logging.ILogger;
+
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess.NativeProcessHelper;
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;
+
+ public class AbstractShellCommand {
+
+ protected var log:ILogger = LogUtil.getLogger(this);
+
+ public var callback:Function;
+
+ protected var shell:NativeProcessHelper;
+
+ protected var command:String;
+ protected var args:Vector.<String> = new Vector.<String>();
+
+ protected var output:String;
+
+ protected function executeCommand():void {
+ shell = new NativeProcessHelper();
+ addShellListeners();
+
+ shell.run(command, args);
+ }
+
+ private function addShellListeners():void {
+ shell.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,
outputDataHandler, false, 0, true);
+ shell.addEventListener(ProgressEvent.STANDARD_ERROR_DATA,
errorDataHandler, false, 0, true);
+ shell.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR,
IOErrorHandler, false, 0, true);
+ shell.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR,
IOErrorHandler, false, 0, true);
+ shell.addEventListener(NativeProcessExitEvent.EXIT, exitHandler,
false, int.MIN_VALUE, true);
+ }
+
+ private function removeShellListeners():void {
+ shell.removeEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,
outputDataHandler);
+ shell.removeEventListener(ProgressEvent.STANDARD_ERROR_DATA,
errorDataHandler);
+ shell.removeEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR,
IOErrorHandler);
+ shell.removeEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR,
IOErrorHandler);
+ shell.removeEventListener(NativeProcessExitEvent.EXIT,
exitHandler);
+ }
+
+ protected function outputDataHandler(event:ProgressEvent):void {
+ var shell:NativeProcessHelper = event.currentTarget as
NativeProcessHelper;
+ output =
shell.process.standardOutput.readUTFBytes(shell.process.standardOutput.bytesAvailable);
+ log.debug("Reading standard output: \n" + output);
+ }
+
+ protected function errorDataHandler(event:ProgressEvent):void {
+ var shell:NativeProcessHelper = event.currentTarget as
NativeProcessHelper;
+ log.error("ERROR -" +
shell.process.standardError.readUTFBytes(shell.process.standardError.bytesAvailable));
+ returnError(event);
+ }
+
+ protected function IOErrorHandler(event:IOErrorEvent):void {
+ log.error(event.toString());
+ returnError(event);
+ }
+
+ protected function exitHandler(event:NativeProcessExitEvent):void {
+ log.debug("Process exited with ", event.exitCode);
+ removeShellListeners();
+ }
+
+ protected function returnSuccess(result:Object):void {
+ shell.process.exit();
+ callback(result);
+ }
+
+ protected function returnError(error:Object):void {
+ shell.process.exit();
+ callback(error);
+ }
+ }
+}
Copied:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/GetEnvironmentVariablesCommand.as
(from r1417526,
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as)
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/GetEnvironmentVariablesCommand.as?p2=incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/GetEnvironmentVariablesCommand.as&p1=incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as&r1=1417526&r2=1417717&rev=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/AbstractDBCommand.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/GetEnvironmentVariablesCommand.as
Thu Dec 6 00:55:01 2012
@@ -15,62 +15,43 @@
limitations under the License.
*/
package
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command {
- import flash.data.SQLResult;
- import flash.data.SQLStatement;
- import flash.errors.SQLError;
- import flash.net.Responder;
+ import flash.events.ProgressEvent;
+ import flash.utils.Dictionary;
- import mx.logging.ILogger;
+ import
org.apache.flex.utilities.developerToolSuite.executor.domain.SettingModel;
- import mx.logging.Log;
- import mx.utils.ObjectUtil;
-
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.database.ApplicationDB;
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.InitApplicationMessage;
- import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;
-
- public class AbstractDBCommand {
-
- protected var log:ILogger = LogUtil.getLogger(this);
+ public class GetEnvironmentVariablesCommand extends AbstractShellCommand {
[Inject]
- public var db:ApplicationDB;
-
- [MessageDispatcher]
- public var dispatch:Function;
+ public var settings:SettingModel;
- public var callback:Function;
-
- protected var sql:String;
- protected var stmt:SQLStatement = new SQLStatement();
+ public function execute():void {
+ executeCommand();
+ }
- protected function executeAsync():void {
- if (!db.DBReady)
- db.connect();
+ override protected function executeCommand():void {
+ command = "C:\\Windows\\System32\\cmd.exe";
- prepareSql();
- }
+ args.push("/C");
+ args.push("set");
- [MessageHandler]
- public function DBReadyHandler(msg:InitApplicationMessage):void {
- prepareSql();
+ super.executeCommand();
}
- protected function prepareSql():void {
- var responder:Responder = new Responder(result, error);
- stmt.text = sql;
- db.executeSqlStatement(stmt, responder);
- }
+ private function extractVariables(output:String):void {
+ settings.environmentVariables = new Dictionary();
- protected function result(result:SQLResult):void {
- var resultMessage:String = (result.data != null) ?
ObjectUtil.toString(result.data) : result.rowsAffected + " affected row(s)";
- log.debug("Successfully executed command: " + resultMessage);
- callback(resultMessage);
+ var rows:Array = output.split("\r\n");
+ for each (var row:String in rows) {
+ var tuple:Array = row.split("=");
+ settings.environmentVariables[tuple[0]] = tuple[1];
+ }
+ returnSuccess(settings.environmentVariables);
}
- protected function error(error:SQLError):void {
- log.error("Error executing command: " +
ObjectUtil.toString(error));
- callback(error);
+ override protected function
outputDataHandler(event:ProgressEvent):void {
+ super.outputDataHandler(event);
+ extractVariables(output);
}
}
}
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateAntHomePathCommand.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateAntHomePathCommand.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateAntHomePathCommand.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateAntHomePathCommand.as
Thu Dec 6 00:55:01 2012
@@ -41,7 +41,7 @@ package org.apache.flex.utilities.develo
msg.responder.fault(false);
return
}
- LOG.debug("Successfully executed command")
+ LOG.debug("Successfully executed shell")
msg.responder.result(true);
}
}
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateJavaHomePathCommand.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateJavaHomePathCommand.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateJavaHomePathCommand.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateJavaHomePathCommand.as
Thu Dec 6 00:55:01 2012
@@ -41,7 +41,7 @@ package org.apache.flex.utilities.develo
msg.responder.fault(false);
return
}
- LOG.info("Successfully executed command")
+ LOG.info("Successfully executed shell")
msg.responder.result(true);
}
}
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateMavenHomePathCommand.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateMavenHomePathCommand.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateMavenHomePathCommand.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/command/ValidateMavenHomePathCommand.as
Thu Dec 6 00:55:01 2012
@@ -41,7 +41,7 @@ package org.apache.flex.utilities.develo
msg.responder.fault(false);
return
}
- LOG.info("Successfully executed command")
+ LOG.info("Successfully executed shell")
msg.responder.result(true);
}
}
Copied:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml
(from r1417525,
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml)
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml?p2=incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml&p1=incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml&r1=1417525&r2=1417717&rev=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml
Thu Dec 6 00:55:01 2012
@@ -17,24 +17,43 @@ limitations under the License.
-->
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:parsley="http://www.spicefactory.org/parsley"
-
xmlns:settingspanel="org.apache.flex.utilities.developerToolSuite.presentation.behavior.settingsPanel.*">
+
xmlns:database="org.apache.flex.utilities.developerToolSuite.executor.infrastructure.database.*"
+
xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*"
+
xmlns:nativeprocess="org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess.*">
<fx:Declarations>
- <settingspanel:GeneralSettingsPM/>
+ <database:ApplicationDB/>
+
+ <parsley:MapCommand messageType="{InitApplicationMessage}">
+ <parsley:CommandSequence>
+ <parsley:Command type="{InitDBCommand}"/>
+ <parsley:Command type="{GetSettingsCommand}"/>
+ <parsley:Command type="{GetEnvironmentVariablesCommand}"/>
+ </parsley:CommandSequence>
+ </parsley:MapCommand>
+
+
<parsley:MapCommand type="{ChangeLanguageCommand}"/>
<parsley:MapCommand type="{SaveSettingsCommand}"/>
<parsley:MapCommand type="{SaveSettingCommand}"/>
<parsley:MapCommand type="{ValidateJavaHomePathCommand}"/>
<parsley:MapCommand type="{ValidateAntHomePathCommand}"/>
<parsley:MapCommand type="{ValidateMavenHomePathCommand}"/>
+
+ <domain:SettingModel/>
</fx:Declarations>
<fx:Script><![CDATA[
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ChangeLanguageCommand;
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.GetEnvironmentVariablesCommand;
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.GetEnvironmentVariablesCommand;
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.GetSettingsCommand;
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.InitDBCommand;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingCommand;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingsCommand;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateAntHomePathCommand;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateJavaHomePathCommand;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateMavenHomePathCommand;
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.InitApplicationMessage;
]]></fx:Script>
</fx:Object>
Added:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeProcessHelper.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeProcessHelper.as?rev=1417717&view=auto
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeProcessHelper.as
(added)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeProcessHelper.as
Thu Dec 6 00:55:01 2012
@@ -0,0 +1,136 @@
+package
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess
{
+ import flash.desktop.NativeProcess;
+ import flash.desktop.NativeProcessStartupInfo;
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.IOErrorEvent;
+ import flash.events.NativeProcessExitEvent;
+ import flash.events.ProgressEvent;
+ import flash.filesystem.File;
+
+ import mx.logging.ILogger;
+
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;
+
+ public class NativeProcessHelper extends EventDispatcher {
+
+ // Use trace during tests as AIR thru Maven doesn't support resource
xml config files for logging.
+ private static var LOG:ILogger;
+
+ private static var _gcLocker:GCLocker;
+
+ private var _process:NativeProcess;
+ private var _isRunning:Boolean;
+
+ private var _isLogEnabled:Boolean;
+
+ public function NativeProcessHelper() {
+ super();
+ if (!LOG)
+ LOG = LogUtil.getLogger(NativeProcessHelper);
+ if (!_gcLocker)
+ _gcLocker = new GCLocker();
+ }
+
+ public function get process():NativeProcess {
+ return _process;
+ }
+
+ public function get isRunning():Boolean {
+ return _isRunning;
+ }
+
+ public function run(command:String, args:Vector.<String> = null):void {
+
+ if (_isRunning) {
+ throw new Error("NativeProcessHelper is currently busy");
+ return;
+ }
+ _process = new NativeProcess();
+ _isRunning = true;
+
+ //Avoid the garbage collection
+ _gcLocker.lock(this);
+
+ var nativeProcessStartupInfo:NativeProcessStartupInfo = new
NativeProcessStartupInfo();
+ var processArgs:Vector.<String> = new Vector.<String>();
+
+ var file:File = File.applicationDirectory.resolvePath(command);
+ nativeProcessStartupInfo.executable = file;
+ processArgs = args;
+ nativeProcessStartupInfo.arguments = processArgs;
+
+ _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,
dispatch2, false, 0, true);
+ _process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA,
dispatch2, false, 0, true);
+ _process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR,
dispatch2, false, 0, true);
+ _process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR,
dispatch2, false, 0, true);
+ _process.addEventListener(NativeProcessExitEvent.EXIT,
exitHandler, false, -100, true);
+ _process.start(nativeProcessStartupInfo);
+ }
+
+ public function logMessages():void {
+ if (_isLogEnabled) {
+ return;
+ }
+ _isLogEnabled = true;
+ _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,
outputDataLogHandler, false, 0, true);
+ _process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA,
errorDataLogHandler, false, 0, true);
+ _process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR,
IOErrorLogHandler, false, 0, true);
+ _process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR,
IOErrorLogHandler, false, 0, true);
+ _process.addEventListener(NativeProcessExitEvent.EXIT,
exitLogHandler, false, 0, true);
+ }
+
+ private function errorDataLogHandler(event:ProgressEvent):void {
+
trace(_process.standardError.readUTFBytes(_process.standardError.bytesAvailable));
+
//LOG.error(_process.standardError.readUTFBytes(_process.standardError.bytesAvailable));
+ }
+
+ private function exitLogHandler(event:NativeProcessExitEvent):void {
+ trace("Process exited with " + event.exitCode);
+ //LOG.info("Process exited with " + event.exitCode);
+
+ }
+
+ private function IOErrorLogHandler(event:IOErrorEvent):void {
+ trace(event.toString());
+ //LOG.error(event.toString());
+ }
+
+ private function outputDataLogHandler(event:ProgressEvent):void {
+ var output:String =
_process.standardOutput.readUTFBytes(_process.standardOutput.bytesAvailable);
+ trace("Output: " + output);
+ //LOG.info("Output: " + output);
+ }
+
+ private function dispatch2(e:Event):void {
+ this.dispatchEvent(e);
+ }
+
+ private function exitHandler(e:Event):void {
+ _gcLocker.release(this);
+ _process = null;
+ _isRunning = false;
+ this.dispatchEvent(e);
+ }
+ }
+}
+internal class GCLocker {
+
+ private var _lockedRefs:Array;
+
+ public function GCLocker() {
+ _lockedRefs = [];
+ }
+
+ public function release(ref:*):void {
+ var i:int = _lockedRefs.indexOf(ref);
+
+ if (i >= 0) {
+ _lockedRefs.splice(i, 1);
+ }
+ }
+
+ public function lock(ref:*):void {
+ _lockedRefs[_lockedRefs.length] = ref;
+ }
+}
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/SampleTest.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/SampleTest.as?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/SampleTest.as
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/SampleTest.as
Thu Dec 6 00:55:01 2012
@@ -15,6 +15,7 @@
limitations under the License.
*/
package org.apache.flex.utilities.developerToolSuite.executor {
+ import org.flexunit.asserts.assertFalse;
public class SampleTest {
[Before]
@@ -26,6 +27,7 @@ package org.apache.flex.utilities.develo
public function testNothing():void {
//TODO un implemented
trace("Hello test");
+ assertFalse(false);
}
[After]
Added:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/CommandLineProcessTest.as
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/CommandLineProcessTest.as?rev=1417717&view=auto
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/CommandLineProcessTest.as
(added)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/test/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/CommandLineProcessTest.as
Thu Dec 6 00:55:01 2012
@@ -0,0 +1,51 @@
+package
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess
{
+ import flash.desktop.NativeProcess;
+ import flash.events.ProgressEvent;
+
+ import org.flexunit.Assert;
+
+ import org.flexunit.asserts.assertNotNull;
+ import org.flexunit.async.Async;
+
+ public class CommandLineProcessTest {
+
+ private var command:NativeProcessHelper;
+
+ [Before]
+ public function setUp():void {
+ command = new NativeProcessHelper();
+ command.logMessages();
+ }
+
+ [Test(async)]
+ public function shouldLogMessages():void {
+ command.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,
Async.asyncHandler(this, outputDataLogHandler, 20000, null, handleTimeout),
false, 0,
+ true);
+
+ var shell:String = "C:\\Windows\\System32\\cmd.exe";
+ var args:Vector.<String> = new Vector.<String>();
+ args.push("/K");
+ args.push("set");
+
+ command.run(shell, args);
+ }
+
+ private function outputDataLogHandler(event:ProgressEvent,
passThroughData:Object):void {
+ var command:NativeProcessHelper = event.currentTarget as
NativeProcessHelper;
+ var result:String =
command.process.standardOutput.readUTFBytes(command.process.standardOutput.bytesAvailable);
+ trace("res: ",
command.process.standardOutput.readUTFBytes(command.process.standardOutput.bytesAvailable));
+ assertNotNull(result);
+ }
+
+ private function handleTimeout(passThroughData:Object):void {
+ Assert.fail("Timeout reached before event");
+ }
+
+
+
+ [After]
+ public function tearDown():void {
+ command = null;
+ }
+ }
+}
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml
Thu Dec 6 00:55:01 2012
@@ -18,29 +18,10 @@ limitations under the License.
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:parsley="http://www.spicefactory.org/parsley"
xmlns:menu="org.apache.flex.utilities.developerToolSuite.presentation.behavior.menu.*"
-
xmlns:menuGraphic="org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.*"
-
xmlns:database="org.apache.flex.utilities.developerToolSuite.executor.infrastructure.database.*"
-
xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*"
-
xmlns:settingspanel="org.apache.flex.utilities.developerToolSuite.presentation.behavior.settingsPanel.*">
+
xmlns:menuGraphic="org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.*">
<fx:Declarations>
<menuGraphic:ApplicationMenu/>
- <parsley:DynamicObject type="{GeneralMenu}"/>
-
- <database:ApplicationDB/>
-
- <domain:SettingModel/>
-
- <menu:ApplicationMenuPM/>
-
- <parsley:MapCommand messageType="{InitApplicationMessage}">
- <parsley:CommandSequence>
- <parsley:Command type="{InitDBCommand}"/>
- <parsley:Command type="{GetSettingsCommand}"/>
- </parsley:CommandSequence>
- </parsley:MapCommand>
-
- <parsley:MapCommand type="{MenuActionCommand}"/>
</fx:Declarations>
<fx:Script><![CDATA[
Modified:
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml?rev=1417717&r1=1417716&r2=1417717&view=diff
==============================================================================
---
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml
(original)
+++
incubator/flex/whiteboard/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml
Thu Dec 6 00:55:01 2012
@@ -28,6 +28,7 @@ limitations under the License.
<parsley:ViewSettings autowireComponents="true"/>
<parsley:FlexConfig type="{ApplicationContext}"/>
<parsley:FlexConfig type="{SettingsContext}"/>
+ <parsley:FlexConfig type="{ExecutorContext}"/>
</parsley:ContextBuilder>
<parsley:Configure/>
</fx:Declarations>
@@ -49,6 +50,7 @@ limitations under the License.
import mx.logging.targets.TraceTarget;
import
org.apache.flex.utilities.developerToolSuite.executor.domain.SettingModel;
+ import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.config.ExecutorContext;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ApplicationReadyMessage;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.InitApplicationMessage;
import
org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;