Re: How to run unit test

mark mark <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Message-ID <[email protected]>
Sorry, those attachments didn't come through.  Here
they are cut and paste:


${basedir}/build.xml
<?xml version="1.0" encoding="UTF-8" ?>

<project name="itmedico-hellotest" default="install"
basedir="." xmlns:x="antlib:org.apache.avalon.tools">

        <property name="project.home" value="." />

        <import file="${project.home}/standard.xml" />

        <target name="build" depends="standard.build">
                <x:block name="hellotest"
embed="MAIN">
                        <x:component name="hello"
class="com.itmedico.hellotest.HelloComponent" />
                </x:block>
        </target>

</project>


${basedir}/index.xml
<?xml version="1.0" encoding="iso-8859-1"?>

<index>

  <import
href="http://svn.apache.org/repos/asf/avalon/trunk/runtime/index.xml"/>

  <project basedir=".">
    <info>
      <group>itmedico/hellotest</group>
      <name>itmedico-hellotest</name>
    </info>
    <dependencies>
      <include key="avalon-framework-api"
runtime="false"/>
      <include key="avalon-merlin-unit"
runtime="false"/>
    </dependencies>
    <plugins>
      <include key="avalon-meta-tools"/>
    </plugins>
  </project>

</index>


src/main/com/itmedico/hellotest/HelloCoponent.java
/*
 * HelloComponent.java
 * Created on Jul 28, 2004
 */
package com.itmedico.hellotest;

import
org.apache.avalon.framework.activity.Initializable;
import
org.apache.avalon.framework.logger.AbstractLogEnabled;

/**
 * Basic component for testing.
 *
 * @author Mark
 * @version 1.0, Jul 28, 2004
 *
 * @avalon.component version="1.0" name="hello"
lifestyle="singleton"
 */
public class HelloComponent extends AbstractLogEnabled
implements Initializable {

    /*
     * (non-Javadoc)
     *
     * @see
org.apache.avalon.framework.activity.Initializable#initialize()
     */
    public void initialize() {
        getLogger().info("initialize()");
        getLogger().info("Hello World");
    }
}


src/main/com/itmedico/hellotest/TestHelloComponent.java
/*
 * TestHelloComponent.java
 * Created on Jul 28, 2004
 */
package com.itmedico.hellotest;

import
org.apache.avalon.merlin.unit.AbstractMerlinTestCase;

/**
 * Tests for HelloComponent
 *
 * @author Mark
 * @version 1.0, Jul 28, 2004
 */
public class TestHelloComponent extends
AbstractMerlinTestCase {

    /**
     * Constructor
     *
     * @param name
     */
    public TestHelloComponent(String name) {
        super(name);
    }

    /**
     * Tests resolution of component named hello
within hellotest container.
     *
     * @throws Exception
     */
    public void testServiceResolution() throws
Exception {
        HelloComponent hello = (HelloComponent)
resolve("hellotest/hello");
        assertNotNull(hello);
    }

}


There is no test: output from ant.  The default ant
target does otherwise work and the component does work
in merlin when run with:
merlin -execute target/classes

Thanks for any help.

Regards.
Mark.

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.