Test Drives 试驾之旅
2.1 Print10Test 打印10次测试
2.1.1 Situation 情况
This is a simple test equivalent to the perennial 'Hello World' program found in many tutorials.
The goal is to count from 0 to 9 and print the result to the screen.
这是一个简单的测试,与常见的在许多向导中的"Hello World"程序等价。目的在于
从0到9计数,并且打印结果到屏幕上去。
2.1.2 Preparation准备
2.1.2.1 Overview 概述
1) If the PowerFolder Server has not been started, start it now.
2) Log into the PowerFolder Console
3) Undeploy all scripts and web pages
4) Deploy the following script and web pages.
1) 如果PowerFolder服务器没有启动,那么启动它。
2) 登录进入PowerFolder控制台
3) 卸载所有脚本和Web页面
4) 发布下面的脚本和Web页面
Script:
- Print10Times
脚本:
Print10Times
Web Pages:
- StartPrint10Times
Web页面
- StartPrint10Times
2.1.2.2 How-To 怎样做
- Starting the PowerFolder Server. If you configured environment variable 'JAVA_HOME'
during installation, just double-click 'run_with_tomcat.bat' in Windows Explorer. Otherwise,
open a command console and make sure the environment variable 'JAVA_HOME' is set to base
directory of the Java installation. Start the PowerFolder server by going to the directory then go
to the 'jboss' subdirectory then again go to the 'bin' subdirectory. Run program
'run_with_tomcat.bat'.
启动PowerFolder服务器。如果你在安装时配置了环境变量JAVA_HOME,在文件夹中双
击run_with_tomcat.bat。否则,打开一个命令行控制台,确认环境变量JAVA_HOME被设
置到Java安装的根目录。要启动PowerFolder服务器,移动到jboss子目录,再移动到
bin子目录。运行程序run_with_tomcat.bat。如下图。
- Logging into the PowerFolder Console. Open a web browser and go to the address
'http://localhost:8080/powerfolder/login'. Enter 'admin' for the user name and password, then
press 'Login'.
登录进入PowerFolder控制台。打开一个浏览器,移动到地址
'http://localhost:8080/powerfolder/login'.输入admin作为用户名和口令,按下
Login.
- Undeploying scripts and web pages. To undeploy scripts, from the PowerFolder Console open
'Administer' then open 'Scripts'. Check the boxes next to the scripts you want to undeploy under
the section 'Deployed Scripts' then click 'Remove Checked Scripts'. To undeploy web pages,
from the PowerFolder Console open 'Administer' then open 'Web Pages'. Check the boxes next
to the web pages you want to undeploy under the section 'Deployed Web Pages' then click
'Remove Checked Web Pages'.
卸载所有脚本和页面。为了卸载脚本,从PowerFolder控制台打开Administer,然后
打开Scripts.在'Deployed Scripts'部分,选中你想卸载的脚本前面的选择框,然后单
击'Remove Checked Scripts'。为了卸载页面,从PowerFolder控制台打开
Administer,接着打开Web Pages。在Deployed Web Pages部分选中你要卸在的页面,
然后单击'Remove Checked Web Pages'。
- Deploying scripts and web pages. To deploy scripts, from the PowerFolder Console open
'Administer' then open 'Scripts'. Check the boxes next to the scripts you want to deploy under the
section 'Available Scripts' then click 'Deploy Checked Scripts'. To deploy web pages, from the
PowerFolder Console open 'Administer' then open 'Web Pages'. Check the boxes next to the web
pages you want to deploy under the section 'Available Web Pages' then click 'Deploy Checked
Web Pages'.
发布脚本和页面。为了发布脚本,从PowerFolder控制台打开Administer,接着打开
Scripts.在Available Scripts部分选中你想发布的脚本,接着单击'Deploy Checked
Scripts'。为了发布Web页面,从Administer,接着打开Web Pages。从Available Web
Pages部分选中要发布的页面,接着单击'Deploy Checked Web Pages'。
2.1.3 Technical Overview 技术总览
2.1.3.1 Diagram 图示
2.1.3.2 Workflow Steps 工作流步骤
1) StartHere - this is where the process begins.
这是流程开始的地方
2) CheckCount - checks if the process is finished counting (count variable is 10).
检查流程是否完成了计数(count变量等于10)
3) PrintCount - print the current count to the command console.
打印当前count到命令控制台
4) Add1 - add 1 to the count variable.
给count变量加1。
5) StopHere - this is where the process ends.
这是流程终止的地方
2.1.3.3 User Interface 用户界面
1) StartPrint10Times - the actual counting does not require any user interaction, but the process
cannot start on its own. This web page allows the user to start the process.
StartPrint10Times -实际的计数并不需要任何的用户界面,但流程不会自己启动。
这个Web页面允许用户来启动流程。
2.1.4 Usage 使用
Open a browser (preferably different than the one with PowerFolder Console) and go to
'http://localhost:8080/StartPrint10Times.jsp'. Note the '.jsp' - all web pages in PowerFolder end
with '.jsp' when deployed.
打开一个浏览器(与PowerFolder控制台分别打开比较好),到'http://localhost:
8080/StartPrint10Times.jsp'.页面,注意".jsp",在PowerFolder中,所有的Web页面
在发布以后都以jsp来结尾。
After opening this page on your browser, go look at the command console running
'run_with_tomcat.bat'. You should see 0 through 9 printed at the bottom of the screen.
在你的浏览器打开这个页面以后,到运行"run_with_tomcat.bat"命令的控制台。你
将会看到在屏幕的底部打印出0到9。
2.1.5 Results 结果
Go to the PowerFolder console and open 'Administer'. Under the 'Existing Workflows' section
click the 'Find Workflows' button.
移动到PowerFolder控制台,打开'Administer'.在'Existing Workflows'部分下,
单击'Find Workflows'按钮.
Now that you are at the 'PowerFolder Query Workflows' web page, change the contents of
'Query' to '*APP* = 'Print10Times'' (note that you should surround Print10Test with single
quotes) and 'Output' to '*ID*,*APP*,*STATUS*' (pay attention to letter case and don't use any
spaces!), then click 'Submit'.
现在你处于 PowerFolder工作流查询页面,更改'Query'的内容为'*APP* =
'Print10Times''(注意你应当用单引号来环绕Print10Times)而且'Output'的内容为
'*ID*,*APP*,*STATUS*',注意字符的大小写而且不要使用任何空格,然后单击
'Submit'(提交).
What is all this? Basically, you are asking PowerFolder to display all workflows using the script
Print10Times and, for each matching workflow, display its Id, Script Name, and Status. These
are predefined attributes (system attributes) common to all workflows. A system attribute is
represented by its name surrounded by '*'.
所有这些都是什么?基本上,你正请求PowerFolder来显示所有使用脚本
Print10Times的工作流,而且,对于每个符合的工作流,显示它的编号,脚本名称和状
态。这些都是预先定义好的属性(系统属性),对于所有工作流都是一样的。一个系统属
性的名字用*号环绕来表示。
You should see just one listing - the workflow resulting from the test you just ran. The listing
should contain a unique id (each workflow gets its own), 'Print10Times' for the script name, and
'DONE' for its status (it is no longer active - it finished after printing 10 times).
你应当仅仅看到一个列表—那个你刚刚运行的测试产生的工作流。列表中应当包括一
个唯一的序号(每个工作流都有它自己的),脚本名称是Print10Times,它的状态是
DONE(它不再是活动的了,它在打印10次以后结束了).
Now click the 'Snapshot' button. This will open a new window which will allow you to get much
more detail about the current state of this workflow.
现在单击' Snapshot '(快照)按钮。这将打开一个新的窗口,它将使你得到关于这个
工作流当前状态的更多细节信息。
Click 'Attributes' to see all system and script-specific attributes and their current values. Under
'Script' click 'View Graph' and 'View Summary' to get a nice pictorial and written summary of
the script. Click 'Trigger' to see the data that actually started the process. This data is fixed for
this process (the same every time you start it), but in other cases you can customize it to provide
very specific context information (e.g. user, quantity, time, etc.). Finally, click 'History' and then
click 'Trace 1'. There were no 'branches' (a way of doing more than one thing at once, see below
example) so this workflow just followed one path of execution the entire time. It consists of 33
records - it began at 'StartHere' did an initial check at 'CheckCount', looped through 'PrintCount',
'Add1', and 'CheckCount' 10 times (30 total) before going to 'StopHere'.
单击'Attributes'来看所有的系统和脚本特定属性和它们的当前值。在'Script'单击
'View Graph'和'View Summary'来得到一个图形化和文本的脚本的总结。单击'Trigger'
来看实际启动流程的数据。这个数据对于这个流程是固定的(每次你启动它都一样),但在
其他例子中你可以自定义它来提供特定的上下文信息(例如用户,质量,时间等等)。最
后,单击 'History' ,接着单击'Trace 1'。这里没有branches'(一种同时作多于一件
事情的方式,参见下面的例子)所以这个工作流在整个事件仅仅跟随一个可执行路径。它
包括了33条记录--它在StartHere开始,在'CheckCount'行初始化检查,循环进入
'PrintCount', 'Add1', 和'CheckCount' 10次(共30次),最后到达'StopHere'。