JBoss Community Archive (Read Only)

SwitchYard

Eclipse

Installation

Please refer to Installing Eclipse Tooling for details on installing the SwitchYard Eclipse tooling.

Features

The SwitchYard Eclipse tooling provides the following features:

  • Creation of SwitchYard projects.

  • Adding SwitchYard capabilities to existing Maven based Eclipse projects.

  • Configuration of SwitchYard capabilities (i.e. runtime component dependencies; e.g. SOAP, BPM, Camel, etc.).

  • A graphical editor for editing SwitchYard application configuration (i.e. switchyard.xml), which provides the following features:

    • Creation and configuration of components, services and references.

    • Component service/reference promotion and configuration of gateway bindings.

    • Creation of implementation skeletons for new service components (e.g. bean classes, BPMN2 files, DRL files, etc.).

    • Creation of unit test skeletons for services.

    • Configuration of message transformers, including creation of implementation skeletons for message transformers (e.g. XSL, Java, etc.).

    • Creation of Artifact references.

  • Java2WSDL

  • WSDL2Java

  • XML catalog entries for SwitchYard configuration schema.

  • m2eclipse integration supporting the SwitchYard Maven plugin (org.switchyard:switchyard-plugin).

  • Support for workspace deployment of SwitchYard projects.

Tutorial

A basic tutorial can be found on the Tutorial page.

SwitchYard Projects

A SwitchYard project is a Maven based project with the following characteristics:

  • a switchyard.xml file in the project's META-INF folder

  • one or more SwitchYard runtime dependencies declared in the pom.xml file

  • org.switchyard:switchyard-plugin mojo configured in the pom.xml file

A SwitchYard project may also contain a variety of other resources used to implement the application, for example: Java, BPMN2, DRL, BPEL, WSDL, XSD, and XML files.

The Eclipse tooling supports the creation of new SwitchYard projects.  The tooling also allows users to add SwitchYard capabilities to existing Maven projects.

Creating a New SwitchYard Project

Use the New SwitchYard Project wizard to create new SwitchYard project in your workspace.  The wizard produces a new project with the following structure:

  • a switchyard.xml file in src/main/resources/META-INF/

  • a pom.xml file declaring SwitchYard runtime dependencies and configuration for the switchyard-plugin mojo

  • a beans.xml file in src/main/resources/META-INF/

  • a beans.xml file src/test/resources/META-INF/

  • a folder hierarchy for the specified Java package

The newly created project's switchyard.xml file will be opened in the SwitchYard editor after the wizard finishes.

Initiate the wizard by selecting SwitchYard Project from the SwitchYard category in the File→New→Project... wizard.

The first page asks for the name and location for the new project:

images/author/download/attachments/59146357/switchyard-project-wizard-1.jpg
The second page asks for basic project details, including:

  • the Maven groupId for the project

  • the targetNamespace for the SwitchYard application

  • the default Java package name for the project

  • the SwitchYard configuration version

  • the SwitchYard library version

  • the SwitchYard runtime components (e.g. BPM, Camel, SOAP, etc. support) required for the project

The library version can be specified directly using the Library Version field or indirectly by selecting a Target Runtime. Selecting a target runtime will set the library version to match the version provided by the target runtime.

It is not necessary to select any components when creating the project. The tooling will automatically configure components on the project as necessary.

images/author/download/attachments/59146357/switchyard-project-wizard-2.jpg

Press Finish to create the new project.

Adding SwitchYard Capabilities to Existing Projects

SwitchYard capabilities may be added to existing projects in the workspace.  The following additions are made to the project:

  • a switchyard.xml file is added to src/main/resources/META-INF/

  • a beans.xml file is added to src/main/resources/META-INF/

  • a beans.xml file is added to src/test/resources/META-INF/

  • declarations for SwitchYard runtime dependencies are added to the pom.xml file

  • org.switchyard:switchyard-plugin mojo configuration is added the pom.xml file

SwitchYard capabilities can only be added to Maven projects.

If the project is not already a Faceted Project, a prompt asks if you wish to convert the project to a faceted project.

Changing the configuration version updates the SwitchYard namespace URIs declared in the switchyard.xml, e.g. from urn:switchyard-config:switchyard:1.0 to urn:switchyard-config:switchyard:1.1.

Right-click the project and select, Configure -> SwitchYard Capabilities... to add (or modify) SwitchYard capabilities.  A property dialog is displayed allowing configuration of SwitchYard settings for project.  Changes are reflected in the project's pom.xml and switchyard.xml files.

images/author/download/attachments/59146357/switchyard-project-properties.jpg

Unit Testing

The SwitchYard tooling provides support for stubbing out test classes for services.

New Service Test Wizard

This wizard creates a new service test class.  The class is created with references to any mix-ins specified and a method stub for each operation in the selected service interface.  The method stubs include code for passing a message to the operation and processing the result.  The user needs to initialize the message data and validate the results.  The following illustrates the stubs that are created by the wizard:

SomeServiceTest
@RunWith(SwitchYardRunner.class)
@SwitchYardTestCaseConfig(mixins = CDIMixIn.class, config = SwitchYardTestCaseConfig.SWITCHYARD_XML)
public class SomeServiceTest {

    private SwitchYardTestKit testKit;
    private CDIMixIn cdiMixIn;
    @ServiceOperation("ExampleService")
    private Invoker service;

    @Test
    public void testSomeInOnlyOperation() throws Exception {
        // TODO Auto-generated method stub
        // initialize your test message
        Object message = null;
        service.operation("someInOnlyOperation").sendInOnly(message);

        // validate the results
        Assert.assertTrue("Implement me", false);
    }

    @Test
    public void testSomeInOutOperation() throws Exception {
        // TODO Auto-generated method stub
        // initialize your test message
        Object message = null;
        String result = service.operation("someInOutOperation")
                .sendInOut(message).getContent(String.class);

        // validate the results
        Assert.assertTrue("Implement me", false);
    }

}

images/author/download/attachments/59146367/qs-new-test-wizard.jpg

Runtime Support

TBD: document SwitchYard runtime support

Workspace Deployment

All SwitchYard projects are configured as some type of JEE module by the tooling.  This allows the user to deploy the project to any JEE server defined in the workspace.

SwitchYard projects packaged as JAR are configured as JEE Utility Modules.

SwitchYard capabilities may be added to any existing JEE project.  See Adding SwitchYard Capabilities to Existing Projects for more details.

The user is responsible for ensuring the target server has a compatible SwitchYard runtime installed.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 09:44:32 UTC, last content change 2013-11-13 21:16:42 UTC.