REST API use cases
| Chapter 10. Use cases |

## REST API use cases

### Set up real-time continuous integration build

#### Set up a continuous integration configuration, and want build of this configuration be triggered whenever there is a checkin made into the version control system.

1. Take configuration root.realtime-CI for example. Let's assume this configuration checks out module realtime-CI from CVS repository and builds with Ant.

2. Modify the TriggerBuild.java sample, so that it triggers build of configuration root.realtime-CI. Of course, you also need to change the login information, and hessian service URL. Compile this program with jars under api/lib directory, and write a script `triggerbuild.sh` to run this program with Java.

3. Checkout "`loginfo`" file under CVSROOT directory of your CVS repository, and append a line like this:

       realtime-CI /path/to/triggerbuild.sh

   | Note
   Before editing, the file "`loginfo`" should be checked out first using your cvs client, just like you edit other files in your cvs repository.

4. Check in the "`loginfo`" file. From now on, the checkins under CVS module "realtime-CI" will trigger the triggerbuild.sh command, which will result in triggering build in configuration root.realtime-CI.

5. A live demo is available through QuickBuild's demo site http://livedemo.pmease.com:8081/. Within this live demo, root.api-samples.realtime-CI stands for configuration root.realtime-CI we talked about. Just connect to CVS repository at :pserver:anonymous@cvsdemo.pmease.com/home/cvsroot, and make some checkins into module realtime-CI, you'll see configuration root.api-samples.realtime-CI will be triggered and running to ensure health of the code base.

### Trigger other builds after build of particular project

#### productA depends on componentA. After componentA finishes build, productA should be built to take the most up-to-date artifacts of componentA.

| Note
This scenario can not be addressed through project dependency use case, because the dependency mechanism only guarantees that build of projectA can trigger build of componentA, but not vice versa.

1. Let's assume configuration root.projectA depends on root.componentA, and root.componentA uses Ant to perform build.

2. Modify the TriggerBuild.java sample, so that it triggers build of configuration root.projectA. Of course, you also need to change the login information, and hessian service URL. Compile this program with jars under api/lib directory.

3. Call the following task before end of componentA's Ant build script:

       <java classname="TriggerBuild">
         <classpath>
            <pathelement path="<the directory which contains TriggerBuild.class>"/>
            <pathelement location="/path/to/hessian-3.0.8.jar"/>
            <pathelement location="/path/to/quickbuild-api.jar"/>
         </classpath>
       </java>

4. A live demo is available through QuickBuild's demo site http://livedemo.pmease.com:8081/. Within this live demo:

   - root.api-samples.productA stands for configuration root.productA we talked about.

   - root.api-samples.componentA stands for configuration root.componentA we talked about.

Remote and parallel use cases |  |