A JBI artifact can be created using one of following classes:
|| JBI artifact || Class || Life-cycle supported ||
| Shared library | {{org.ow2.petals.admin.api.artifact.SharedLibrary}} | no |
| Component | {{org.ow2.petals.admin.api.artifact.Component}} | yes |
| Service assembly | {{org.ow2.petals.admin.api.artifact.ServiceAssembly}} | yes |
| Service unit | {{org.ow2.petals.admin.api.artifact.ServiceUnit}} | no |
You can initialize the state of JBI artifacts supporting a life-cycle:
{code}
final Component component = new Component("component-name", ComponentType.BC);
component.setState(State.STARTED);
{code}
h3. Registering a JBI artifact
A JBI artifact can be put into the artifact registry at any moment of the unit test. *Caution, the artifact registry is cleared at the end of the unit test.*
{code}
@Rule
public PetalsAdministrationApi petalsAdminApi = new PetalsAdministrationApi();
@Test
public void test...() {
final Component component = new Component("component-name", ComponentType.BC);
component.setState(State.STARTED);
this.petalsAdminApi.registerArtifact(component);
... Your unit test source code ...
// The artifact registry will be automatically cleared leaving the unit test.
}
{code}
h1. Installation
The Petals Administration Mock implementation is available as a Maven artifact to add to the POM of your project:
{code}
<project>
...
<dependencies>
...
<dependency>
<groupId>org.ow2.petals</groupId>
<artifactId>petals-admin-mock</artifactId>
<version>...</version>
<scope>test</scope>
</dependency>
...
</dependencies>
...
</project>
{code}