Develop > Business logic layer > Workspaces support for BOD service modules


Call a service with a workspace context from a Java based client or JUnit testcase

You can specify a workspace context when you call a WebSphere Commerce service from a Java based client, or a JUnit testcase.

Test the services with different workspace context data to ensure they work properly for all workspaces.

The Management Center Web application includes business context data by default in its service requests. You do not need to modify the Management Center to include this data.


Procedure

  1. Create a workspace, task, or task group to use for testing.

  2. Include Java code similar to the following sample (from a JUnit testcase) to set the business context in the client code:

    // set the business context intent
    businessContext.setIntent("Authoring"); 
    // add the workspace context data to the business context
    ContextDataType contextData = CommerceFoundationFactory.eINSTANCE.createContextDataType(); contextData.setName("workspace.name"); contextData.setValue("W_10001"); businessContext.getContextData().add(contextData);     
    contextData = CommerceFoundationFactory.eINSTANCE.createContextDataType(); contextData.setName("workspace.taskGroup"); contextData.setValue("G_10001"); businessContext.getContextData().add(contextData);     
    contextData = CommerceFoundationFactory.eINSTANCE.createContextDataType(); contextData.setName("workspace.task"); contextData.setValue("T_10002"); businessContext.getContextData().add(contextData);
    

    In the preceding example:

    • W_10001 is the workspace name

    • G_10001 is the task group name

    • T_10002 is the task name


Related tasks

Enable workspaces support for a custom table in an existing WebSphere Commerce BOD service module

Enable change control for a noun

Enable change control for a noun part

Include change control information in the response of a Get service

Create a workspace

Create tasks

Create a task group


+

Search Tips   |   Advanced Search