This is restart target code which is defined in build.xml
target name="restart"
propertycopy name="remote.host" from="deploy.${target.env}.host.${remote.id}"
propertycopy name="remote.port" from="deploy.${target.env}.port.${remote.id}"
sshexec trust="true"
host="${remote.host}"
port="${remote.port}"
username="${scm.user}"
keyfile="${scm.user.key}"
command="sudo /usr/local/bin/bounce_jboss"
target
server information is defined in build.properties.
The above code is working fine, but the restarting process is very late bcas its stopping-starting server one and later its stopping-starting another server,
Is there a way where i can restart both servers parallely with a time frame of 45 seconds.
Have you investigated the Ant Parallel task? You should be able to parallelise the rebooting fairly simply using this.
e.g.
<parallel>
<!-- first server reboot -->
<ssh ...>
<!-- second server reboot -->
<ssh ...>
</parallel>
The parallel task will work for you. Another example:
<target name="restart" ... >
<parallel>
<!-- first server reboot call -->
<!-- second server reboot call -->
</parallel>
</target>
From command line:
>ant restart
Don't execute "ant restart" twice. Only call it once and your servers should only restart once.
Related
In a ant script, i need to schedule the execution of a batch file after the end of script (or after a time-lapse).
I tried to wrap the exec task into the parallel+daemons tasks after a sleep task but without success...
<echo>--- start ---</echo>
<parallel>
<daemons>
<echo>start daemon</echo>
<sleep seconds="10" />
<exec dir="Y:\Test" executable="Y:\Test\exec.bat" spawn="true"/>
<echo>stop daemon</echo>
</daemons>
</parallel>
<echo>--- stop ---</echo>
There is any way for do this in Ant? Or it's mandatory insert a timeout into script file?
Is is possible to copy one "xyz.rpt" file from FTP Server "X" to FTP Server "Y" using ANT ?
Should we achieve it using FTP Task of ANT?
There is an ftp task available:
https://ant.apache.org/manual/Tasks/ftp.html
You will indeed need to tranfer the file via your local machine, in 2 subsequent ftp tasks.
Example:
<ftp server="ftp.hypothetical.india.org"
port="2121"
remotedir="/pub/incoming"
userid="coder"
password="java1"
depends="yes"
binary="no"
systemTypeKey="Windows"
serverTimeZoneConfig="India/Calcutta">
<fileset dir="htdocs/manual">
<include name="**/*.html"/>
</fileset>
Change FTP Service Status
Command to check status list:
inetadm
or specific (ftp) service;
svcs ftp
If your status is offline or disabled, you must change your status to enable. To do that:
svcadm -v enable network/ftp
svcadm refresh svc:/network/ftp:default
svcadm restart svc:/network/ftp:default
Check your status again:
svcs ftp
After enabling ftp service;
If you defined before like a target, you need to do somethings like that;
<target name="sendSetup">
<ftp action="mkdir"
server="${app.srv.name}"
userid="${app.srv.user.name}"
passive="yes"
password="${app.srv.passwd}"
remotedir="/xxx/xxx/Builds/${branch.env}/${build.label}"
ignoreNoncriticalErrors="true" />
</target>
I have two ant files say antFile1.xml and antFile2.xml on windows and linux machine respectively.
antFile1.xml
<target name="executeOnLinux">
<sshexec
host="${remote.host.ip}"
username="${remote.user.id}"
password="${remote.user.ssh.password}"
command="ant -f antFile2.xml 'linuxAntTarget'"
trust="true"/>
</target>
antFile2.xml
<target name="linuxAntTarget">
<input message="Enter application edition number" addproperty="editionNo"/>
<echo message="${editionNo}"/>
</target>
When I execute the the target named "executeOnLinux" from antFile1.xml from my, it connects to the linux machine and starts executing the "linuxAntTarget" from antFile2.xml file. But, as soon as it reaches to the the point where user input is required keeps waiting since I am not able to pass the input. My question is how can I pass the value to it? Is this even possible or there is any other better way of doing it?
Since Ant 1.9.4, the sshexec task provides a useSystemIn attribute:
Whether to pass the current standard input to the remote process, defaults to false
You may also try the input attribute from the same task:
A file from which the executed command's standard input is taken. This attribute is mutually exclusive with the inputstring and inputproperty attributes.
When executing more than one command via commandResource, input will be read for each command. since Ant 1.8.0
I am building a Mobile application with Flex 4.11.0 and AIR 4.0. My IDE is Flash Builder 4.7. I wrote a lot of unit tests, some of them using AIR features such as File system access.
I am trying to integrate the project into a CI job on jenkins. I have an ANT script doing the following:
Compiling
Packaging for Android
Packaging for iOS
Generating ASDOC
What I want now is to write an ANT-Task to launch my unit tests and generate a report in XML or HTML which can be parsed by Jenkins afterwards.
I have tried the following:
- Followed the tutorial on http://tutorials.digitalprimates.net/flexunit/Unit-16.html and got the example to work. However, this is a Flash project and not an AIR-Project!
- Read the documentation on https://cwiki.apache.org/confluence/display/FLEX/FlexUnit+Ant+Task, downloaded and built the FlexUnit code from git#github.com:flexunit/flexunit.git to get the FlexUnit4AIRCIListener.swc
- Read a LOT of information on the internet from all over the place, not finding an answer (I did find some hints, but a lot of the information is outdated or references dead links)
What I have so far is the following:
<taskdef resource="flexUnitTasks.tasks" classpath="${basedir}\libs\flexUnitTasks-4.1.0.jar" />
<target name="test" >
<echo>Testing...</echo>
<echo>==========</echo>
<!-- 1. Compile FlexUnit-Application -->
<mxmlc file="${PROJECT.src}\FlexUnit.mxml" output="FlexUnit.swf" >
<load-config filename="D:\tools\sdk\flex\4.11.0_AIR4.0\frameworks\air-config.xml" append="true" />
<source-path path-element="${PROJECT.src}" />
<source-path path-element="${basedir}\test" />
<library-path dir="${PROJECT.libs}" append="true">
<include name="**/*.swc" />
<include name="**/*.ane" />
</library-path>
<library-path dir="D:\tools\sdk\flex\4.11.0_AIR4.0\frameworks\libs\air" append="true">
<include name="airglobal.swc" />
</library-path>
<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
<compiler.headless-server>true</compiler.headless-server>
</mxmlc>
<!-- 2. Run the compiled SWF -->
<flexunit swf="FlexUnit.swf"
player="air"
timeout="180000"
toDir="${OUTPUT.root}\flexUnit"
haltonfailure="false"
verbose="true"
localTrusted="true"
/>
<!-- 3. Generate readable JUnit-style reports -->
<junitreport todir="${OUTPUT.root}\flexUnit">
<fileset dir="${OUTPUT.root}\flexUnit">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${OUTPUT.root}\flexUnit\html" />
</junitreport>
</target>
Here are the relevant parts of my FlexUnit.mxml-Application:
protected function onCreationComplete(event:FlexEvent):void
{
core = new FlexUnitCore();
core.addListener(new AirCIListener());
core.run(currentRunTestSuite());
}
public function currentRunTestSuite():Array
{
var testsToRun:Array = new Array();
testsToRun.push(test.suites.CLXSatelliteTestSuite);
return testsToRun;
}
Step 1. from the ANT-Task works (at least I get the FlexUnit.swf). However, Launching the SWF in the <flexunit>-Task fails:
VerifyError: Error #1014: Class flash.filesystem::File could not be found.
Console output:
[flexunit] Generating default values ...
[flexunit] Using default working dir [D:\workspaces\flex\projects\clx-satellite]
[flexunit] Using the following settings for the test run:
[flexunit] FLEX_HOME: [D:\tools\sdk\flex\4.11.0_AIR4.0]
[flexunit] haltonfailure: [false]
[flexunit] headless: [false]
[flexunit] display: [99]
[flexunit] localTrusted: [true]
[flexunit] player: [flash]
[flexunit] port: [1024]
[flexunit] swf: [D:\workspaces\flex\projects\clx-satellite\FlexUnit.swf]
[flexunit] timeout: [180000ms]
[flexunit] toDir: [D:\workspaces\flex\projects\clx-satellite\deploy\flexUnit]
[flexunit] Setting up server process ...
[flexunit] Starting server ...
[flexunit] Opening server socket on port [1024].
[flexunit] Waiting for client connection ...
[flexunit] OS: [Windows]
[flexunit] Launching player:
[flexunit] Executing 'rundll32' with arguments:
[flexunit] 'url.dll,FileProtocolHandler'
[flexunit] 'D:\workspaces\flex\projects\clx-satellite\FlexUnit.swf'
[flexunit] The ' characters around the executable and arguments are
[flexunit] not part of the command.
[flexunit] Client connected.
[flexunit] Setting inbound buffer size to [262144] bytes.
[flexunit] Receiving data ...
[flexunit] Sending acknowledgement to player to start sending test data ...
[flexunit]
[flexunit] Stopping server ...
[flexunit] End of test data reached, sending acknowledgement to player ...
BUILD FAILED
D:\workspaces\flex\projects\clx-satellite\build.xml:148:
java.util.concurrent.ExecutionException: could not close client/server socket
When I include a single test which does not use the File-Class, the tests work and I get a similar error (ReferenceError: Error #1065: Variable flash.desktop::NativeApplication is not defined.) but at least the tests run through and I get XML-output. Seems to me like FlexUnit is not really compatible with AIR, although I use player=airin the task.
Does anybody of you have a working example of running Unit Tests with FlexUnit for an AIR Application (possibly a mobile application) through ANT?
Never mind, I figured it out myself and blogged about it in my personal blog:
http://www.tiefenauer.info/ci-for-flex-mobile-applications-part-3-performing-unit-tests/
I described a whole CI process there, just in case anyone has the same problem.
There is Apache FlexUnit feature request for this here: Apache FlexUnit: FLEX-35090
Or you can utilize this feature by compiling your own FlexUnit task by using this fork of FlexUnit 4.1: additionalCompilerOptions branch
The formatting supported with the custom FlexUnit Ant Task is as follows:
<flexunit
workingDir="${bin.loc}"
toDir="${report.loc}"
haltonfailure="false"
verbose="true"
localTrusted="true" >
<!-- only supported with custom FlexUnit Ant tasks -->
<additionalCompilerOption option="-define+=MY_CONST::foo,'BAR'" />
</flexunit>
I am trying to setup openbravo on eclipse environment with the above URL.
Development stack setup is done successfully. (ANT, Java, Postgresql)
At the openbravo source directory when i apply the command
ant install.source
Build failure due to errors -
/home/pos/sourcecode_openbravo/Openbravo-3.0MP21/build.xml:480: The following error occurred while executing this line:
480 <ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
/home/pos/sourcecode_openbravo/Openbravo-3.0MP21/src/build.xml:874: The following error occurred while executing this line:
874 <jvmarg line="${env.CATALINA_OPTS}" />
/home/pos/sourcecode_openbravo/Openbravo-3.0MP21/src/build.xml:880: Directory
880 <jvmarg value="-Djava.io.tmpdir=${env.CATALINA_BASE}/temp" />
/var/lib/tomcat6/webapps/openbravo/WEB-INF/lib creation was not successful for an unknown reason
Any help would be appreciated. Thanks.
Sounds like a permission problem.
See the related section 'Permission issues' in openbravo wiki
EDIT
for the remaining issues, i believe the properties base.src, CATALINA_OPTS and CATALINA_BASE are not set properly. Check this via :
<echo>
$${base.src} => ${base.src}
$${env.CATALINA_OPTS} => ${env.CATALINA_OPTS}
$${env.CATALINA_BASE} => ${env.CATALINA_BASE}
</echo>
or simply output all available properties use :
<echoproperties/>
also consider, before using ${env.whatever} you need to use :
<property environment="env"/>
before !
/var/lib/tomcat6/webapps/openbravo/WEB-INF/lib creation was not successful for an unknown reason
Give the permission to webapps folder
sudo chmod -R 777 /var/lib/tomcat6/webapps/
/var/lib/tomcat6/webapps/openbravo/WEB-INF/lib creation was not
successful for an unknown reason
it seem permission problem. It is important to always us the correct user account to start / stop tomcat!
Conceptually there are two user accounts involved in working with Openbravo:
command-line user used to work with files & compile Openbravo
user account used by Apache Tomcat service
There are several overlapping areas in which one of the accounts needs to access and modify files from the other account in both directions.
To avoid any problems Openbravo strongly recommends to run Apache Tomcat services with the same user account which is used on command line. As that way the above topic will be perfectly solved easily.
source: http://wiki.openbravo.com/wiki/Installation/Custom/Apache_Tomcat