Need to run Jtest by using an ant script...any example ?
I have done this so far
<target name="test">
<jtest config="/Carts Static Analysis.properties" localsettings="/ApplicationCore.jtest/scripts/build.properties"
publish="false" showdetails="false" nobuild="true"
report="c:/reports" workspace="C:/">
<resource name="EC"/>
</jtest>
</target>
</project>
But I get an error that "Failed to create task or type jtest. Any suggestions ?
Did you check Parasoft web page :
http://build.parasoft.com/docs/overview.html ?
Related
I am learning build.xml and am confused by the following code:
<macrodef name="a-test">
<attribute name="port" default="${PORT}"/> #1
<junit printsummary=...
<env key="PORT" value="#{port}" /> #2
...
when I run java with commandLine including -DPORT=8080 and then in java code I get port value 8080 by calling
String port = System.getenv(PORT).
What is the above build.xml doing? So far I know $ is to represent a property while # is to represent an attribute. Besides, the above code is the only place where PORT and port appear. What happens here so that port value are finally obtained in java code? Thanks.
The other question, what is the difference btw. using "env key" and using "sysproperty"? according to http://etutorials.org/Programming/Java+extreme+programming/Chapter+3.+Ant/3.6+Passing+Arguments+to+a+Buildfile/
sysproperty can be use to parse argument -D to java code, while env key is used to do the same thing right? Thanks.
Is there any detailed document about build.xml? the one I google from internet describer things so briefly.
What you see is macrodef in ant. There will be another place in build.xml(or other build.xml) where this is called by like
<a-test port=<value> ..
I have configured the Jenkins Jmeter plugin and i am able to view the reports as shown in the image. What i need is a way to send these reports as an email content . I am using email-ext plugin for sending mail.
The Jmeter gives me an output of type xml .
What I understand is that jMeter comes with some XSL files which can be used to transform the xml to html (jmeter-results-detail-report.xsl in extras folder). Is there any way to invoke the XSLT transformation directly inside the DefaultContent in email_ext plugin ?
Any Groovy script or something ?
This is how my configuration looks like :
You can use JMeter Ant Task which has target to transform JMeter XML result file into HTML format. See /extras/build.xml file under root of your JMeter installation folder
<target name="xslt-report" depends="_message_xalan">
<tstamp><format property="report.datestamp" pattern="yyyy/MM/dd HH:mm"/></tstamp>
<xslt
classpathref="xslt.classpath"
force="true"
in="${testpath}/${test}.jtl"
out="${testpath}/${test}.html"
style="${basedir}/jmeter-results-detail-report${style_version}.xsl">
<param name="showData" expression="${show-data}"/>
<param name="titleReport" expression="${report.title}"/>
<param name="dateReport" expression="${report.datestamp}"/>
</xslt>
</target>
See 5 Ways To Launch a JMeter Test without Using the JMeter GUI guide for more details.
I have an ant script that is executing a jmx get task:
<jmx:get
name="java.lang:type=GarbageCollector,name=Copy"
attribute="LastGcInfo"
resultproperty="CopyLastGcInfo"
/>
Now, the LastGcInfo attribute has a map Map called memoryUsageBeforeGC. In this map there is a pair with a key called "value". Althoug I am unable to elicit it and print it out. I have tried to accomplish it like that:
<echo>${CopyLastGcInfo.memoryUsageBeforeGc.value.used}</echo>
<echo>${CopyLastGcInfo.memoryUsageBeforeGc.0.used}</echo>
<echo>${CopyLastGcInfo.memoryUsageBeforeGc.used}</echo>
That didn't work. Do you have any suggestions how to tackle this problem?
Thanks.
The following example worked for me:
<project name="Catalina Ant JMX" xmlns:jmx="antlib:org.apache.catalina.ant.jmx" default="jmx">
<target name="jmx" description="Show JMX stats">
<jmx:open host="localhost" port="9012" username="controlRole" password="tomcat"/>
<jmx:get name="java.lang:type=GarbageCollector,name=Copy"
attribute="LastGcInfo"
resultproperty="CopyLastGcInfo"
echo="false"
/>
<echo>
memoryUsageBeforeGc
===================
Perm Gen.used=${CopyLastGcInfo.memoryUsageBeforeGc.Perm Gen.used}
Tenured Gen.used=${CopyLastGcInfo.memoryUsageBeforeGc.Tenured Gen.used}
Eden Space.used=${CopyLastGcInfo.memoryUsageBeforeGc.Eden Space.used}
Code Cache.used=${CopyLastGcInfo.memoryUsageBeforeGc.Code Cache.used}
Survivor Space.used=${CopyLastGcInfo.memoryUsageBeforeGc.Survivor Space.used}
</echo>
</target>
</project>
Example output
jmx:
[echo]
[echo] memoryUsageBeforeGc
[echo] ===================
[echo] Perm Gen.used=9660888
[echo] Tenured Gen.used=8393792
[echo] Eden Space.used=4456448
[echo] Code Cache.used=2038016
[echo] Survivor Space.used=172784
[echo]
Note
The "echo" attribute of the "jmx:query" task can be used to see the ANT properties and values created by the task. Useful for troubleshooting.
I've added the future-rollback tag to my ant script. What i want to do (and I think future-rollback is what Im looking for) is to generate an sql rollback script, but without executing it (rollback script must be delivered with sql scripts is the requirement from my client).
My changelog file has many changesets, some of which contain the <sqlFile> tag.
For example:
<databaseChangeLog ...>
<include file="latest/somesqlprocedure.xml" relativeToChangelogFile="true"/>
</databaseChangelog...>
Where the latest/somesqlprocedure.xml has an sqlFile tag.
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<sqlFile path="${changelog.dir}/latest/myprocedure.sql" splitStatements="false" />
</changeSet>
</databaseChangeLog>
When I run the ant script, I get the following error
liquibase.exception.ChangeLogParseException:
Invalid Migration File: <sqlfile
path=${changelog.dir}/latest/myprocedure.sql>
- Could not find file
Does anyone has an idea of whats going on ?
This is a snippet of the build.xml file
<target name="db-future-rollback" depends="init">
<rollbackFutureDatabase
changeLogFile="${db.changelog.file}"
driver="${database.driver}"
url="${database.url}"
username="${database.username}"
password="${database.password}"
outputfile="${database.rollback.dir}"
promptOnNonLocalDatabase="${prompt.user.if.not.local.database}"
classpathref="project.classpath"
>
</rollbackFutureDatabase>
</target>
Thanks in advance.
The problem may be coming from using an absolute path in your sqlFile, rather than a classpath-relative path. The classpath relative path was what was originally supported in liquibase and is still better tested. The absolute path option was added recently, and the futureRollbackSql code may have not been patched to support it.
Can you try the sqlFile using a relative path?
As a side note, the relative path option is generally better because the filename is used in the databasechangelog table to note which changeSets have ran. If you use an absolute path, the entire path is stored and if you try to re-run the changelog from a different path (or running against the same database from a different machine), liquibase will think it is a different changeSet and try to re-run it.
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.