alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (nice.xml)

This example Ant source code file (nice.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

so, so, test, test, to, to

The nice.xml source code

<?xml version="1.0"?>
<project name="nice" basedir=".">

<description>
Test nicing. To make the test more complex we may be running in a nice mode
to start with, and we want to restore that value at the end. So every test
that succeeds must restore the saved value.
</description>
  <target name="noop">
    <nice/>
  </target>
  
  <target name="current">
    <nice currentPriority="nice.now"/>
    <fail unless="nice.now"/>
  </target>

  <target name="faster">
    <nice newPriority="8" currentPriority="nice.old"/>
    <nice currentPriority="nice.now"/>
    <condition property="test.succeeded">
      <equals arg1="${nice.now}" arg2="8" /> 
    </condition>
    <nice newPriority="${nice.old}"/>
    <fail unless="test.succeeded"/>
  </target>
  
  <target name="slower">
    <nice newPriority="3" currentPriority="nice.old"/>
    <nice currentPriority="nice.now"/>
    <condition property="test.succeeded">
      <equals arg1="${nice.now}" arg2="3" /> 
    </condition>
    <nice newPriority="${nice.old}"/>
    <fail unless="test.succeeded"/>
  </target>
  
  <target name="too_slow">
    <nice currentPriority="nice.old"/>
    <nice newPriority="0"/>
    <nice newPriority="${nice.old}"/>
  </target>

  <target name="too_fast">
    <nice currentPriority="nice.old"/>
    <nice newPriority="20"/>
    <nice newPriority="${nice.old}"/>
  </target>
  
</project>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant nice.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.