Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public class HelloWorldITest extends TestCase {

    @Reference 
    protected HelloWorld helloWorld;

    public void testSayHello() {
        assertEquals({"Hello, Foo", helloWorld.sayHello("Foo"));
    }
}

The

...

test

...

case

...

is

...

then

...

configured

...

in

...

a

...

special

...

test

...

composite

...

that

...

includes

...

the

...

application

...

composite.

...

The

...

test

...

composite

...

should

...

be

...

names

...

"TestComposite"

...

with

...

a

...

target

...

namespace

...

of

...

"urn:fabric3.org"

...

and

...

placed

...

under

...

/src/test/resource:

...

Code Block
xml
xml
<composite name="TestComposite" targetNamespace="urn:fabric3.org" ...>
           
   <component name="HelloWorldTest">
        <f3:junit class="...HelloWorldITest"{color}/>
        <reference name="helloWorld" target="HelloWorldComponent"/>
    </component>
    
    <include name="HelloWorldComposite/>
</composite>


h3.

The

...

Maven

...

POM

...

The

...

Maven

...

POM

...

must

...

specify

...

the

...

SCA

...

API

...

and

...

JUnit

...

as

...

dependencies.

...

It

...

must

...

also

...

configure

...

the

...

Fabric3

...

ITest

...

plugin:

...

Code Block
xml
xml
<project ...>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.fabric3.spec</groupId>
            <artifactId>sca-api-r1.0</artifactId>
            <version>0.2.1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>verify</defaultGoal>
        <plugins>
             <plugin>
                <groupId>org.codehaus.fabric3</groupId>
                <artifactId>fabric3-itest-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

...

Code Block
xml
xml
<composite name="TestComposite" targetNamespace="urn:fabric3.org" ...>
           
   <component name="HelloWorldTest">
        <f3:junit class="...HelloWorldITest"{color}/>
        <reference name="helloWorld" target="HelloWorldComponent">
           <binding.jms>
              <destination jndiName="Queue"/>
           </binding.jms> 
        </reference>
    </component>
    
    <include name="HelloWorldComposite/>
</composite>


h2.

Using

...

Profiles

...

and

...

Extensions

...

The

...

ITest

...

plugin

...

supports

...

the

...

full

...

range

...

of

...

Fabric3

...

extensions

...

and

...

profiles

...

such

...

as

...

JTA,

...

JMS,

...

Web

...

Services

...

and

...

REST.

...

Profiles

...

and

...

extensions

...

are

...

enabled

...

using

...

the

...

<profiles>

...

and

...

<extensions>

...

elements

...

respectively:

...

Code Block
xml
xml
  
<plugin>
   <plugin>
      <groupId>org.codehaus.fabric3</groupId>
      <artifactId>fabric3-itest-plugin</artifactId>
      <version>${fabric3.version}</version>
      <configuration>
         <runtimeVersion>${fabric3.version}</runtimeVersion>
         <profiles>
             <profile>
                <groupId>org.codehaus.fabric3</groupId>
                <artifactId>profile-jms</artifactId>
                <version>${fabric3.version}</version>
              </profile>
         </profiles>
         <extensions>
             <extension>
                <groupId>org.codehaus.fabric3</groupId>
                <artifactId>some-extension</artifactId>
                <version>${fabric3.version}</version>
              </extension>
         </extensions>
      </configuration>
      <executions>
         <execution>
            <goals>
               <goal>test</goal>
            </goals>
         </execution>
      </executions>
   </plugin>
</plugins>

...