@@ -0,0 +1,246 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.salaboy.jbpm5.dev.guide;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.drools.SystemEventListenerFactory;
import org.jbpm.task.*;
import org.jbpm.task.query.TaskSummary;
import org.jbpm.task.service.ContentData;
import org.jbpm.task.service.PermissionDeniedException;
import org.jbpm.task.service.TaskService;
import org.jbpm.task.service.TaskServiceSession;
import org.jbpm.task.service.local.LocalTaskService;
import org.junit.*;
import static org.junit.Assert.*;

/**
*
* @author salaboy
*/
public class HumanTasksLifecycleAPITest {

private EntityManagerFactory emf;
private TaskService taskService;
private TaskServiceSession taskSession;
private Map<String, User> users = new HashMap<String, User>();
private Map<String, Group> groups = new HashMap<String, Group>();

public HumanTasksLifecycleAPITest() {
}

@BeforeClass
public static void setUpClass() throws Exception {
}

@AfterClass
public static void tearDownClass() throws Exception {
}

@Before
public void setUp() {
// Create an EntityManagerFactory based on the PU configuration
emf = Persistence.createEntityManagerFactory("org.jbpm.task");
// The Task Service will use the EMF to store our Task Status
taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
// We can uset the Task Service to get an instance of the Task Session which
// allows us to introduce to our database the users and groups information before
// running our tests
taskSession = taskService.createSession();
// Adds 1 Administrator, 2 users and 1 Group
addUsersAndGroups(taskSession);

//We need to set up an user to represent the user that is making the requests
MockUserInfo userInfo = new MockUserInfo();
taskService.setUserinfo(userInfo);
}

@After
public void tearDown() {
taskSession.dispose();
emf.close();
}

@Test
public void regularFlowTest() {


// Create a local instance of the TaskService
LocalTaskService localTaskService = new LocalTaskService(taskService);

List<User> potentialOwners = new ArrayList<User>();
potentialOwners.add(users.get("salaboy"));
// Create a Task Definition
Task task = createSimpleTask(potentialOwners, users.get("administrator"));

// Deploy the Task Definition to the Task Component
localTaskService.addTask(task, new ContentData());

// Because the Task contains a direct assignment we can query it for its Potential Owner
// Notice that we obtain a list of TaskSummary (a lightweight representation of a task)
List<TaskSummary> tasksAssignedAsPotentialOwner = localTaskService.getTasksAssignedAsPotentialOwner("salaboy", "en-UK");

// We know that there is just one task available so we get the first one
Long taskId = tasksAssignedAsPotentialOwner.get(0).getId();

// In order to check the task status we need to get the real task
// The task is in a Reserved status because it already have a well-defined Potential Owner
Task simpleTask = localTaskService.getTask(taskId);
assertEquals(Status.Reserved, simpleTask.getTaskData().getStatus());

// In order start working with this task we call the start() method
localTaskService.start(simpleTask.getId(), "salaboy");

// The task is now In Progress
simpleTask = localTaskService.getTask(taskId);
assertEquals(Status.InProgress, simpleTask.getTaskData().getStatus());

// PERFORM THE TASK ACTIVITY HERE, the user need to perform the required activities here

// Once the Task activity is performed the user can complete the task,
// Notice that we are completing this task without results
localTaskService.complete(simpleTask.getId(), "salaboy", null);

// We can check the task status after completion
simpleTask = localTaskService.getTask(taskId);
assertEquals(Status.Completed, simpleTask.getTaskData().getStatus());


}

@Test
public void claimConflictAndRetry() {


// Create a local instance of the TaskService
LocalTaskService localTaskService = new LocalTaskService(taskService);
List<User> potentialOwners = new ArrayList<User>();
potentialOwners.add(users.get("salaboy"));
potentialOwners.add(users.get("watman"));
// Create a Task Definition
Task task = createSimpleTask(potentialOwners, users.get("administrator"));

// Deploy the Task Definition to the Task Component
localTaskService.addTask(task, new ContentData());

// Because the Task contains a direct assignment we can query it for its Potential Owner
// Notice that we obtain a list of TaskSummary (a lightweight representation of a task)
List<TaskSummary> salaboyTasks = localTaskService.getTasksAssignedAsPotentialOwner("salaboy", "en-UK");

// We know that there is just one task available so we get the first one
Long salaboyTaskId = salaboyTasks.get(0).getId();

// In order to check the task status we need to get the real task
// The task is in a Reserved status because it already have a well-defined Potential Owner
Task salaboyTask = localTaskService.getTask(salaboyTaskId);
assertEquals(Status.Ready, salaboyTask.getTaskData().getStatus());

// Because the Task contains a direct assignment we can query it for its Potential Owner
// Notice that we obtain a list of TaskSummary (a lightweight representation of a task)
List<TaskSummary> watmanTasks = localTaskService.getTasksAssignedAsPotentialOwner("watman", "en-UK");

// We know that there is just one task available so we get the first one
Long watmanTaskId = watmanTasks.get(0).getId();
assertEquals(watmanTaskId, salaboyTaskId);
// In order to check the task status we need to get the real task
// The task is in a Reserved status because it already have a well-defined Potential Owner
Task watmanTask = localTaskService.getTask(watmanTaskId);
assertEquals(Status.Ready, watmanTask.getTaskData().getStatus());


localTaskService.claim(watmanTask.getId(), "watman");

try{
localTaskService.claim(salaboyTask.getId(), "salaboy");
} catch(PermissionDeniedException ex){
// The Task is gone.. salaboy needs to retry
assertNotNull(ex);
}







}

@Test
public void claimNextAvailable() {


// Create a local instance of the TaskService
LocalTaskService localTaskService = new LocalTaskService(taskService);
List<User> potentialOwners = new ArrayList<User>();
potentialOwners.add(users.get("salaboy"));
potentialOwners.add(users.get("watman"));
// Create a Task Definition
Task task = createSimpleTask(potentialOwners, users.get("administrator"));

// Deploy the Task Definition to the Task Component
localTaskService.addTask(task, new ContentData());

// we don't need to query for our task to see what we will claim, just claim the next one available for us

localTaskService.claimNextAvailable("watman", "en-UK");

List<Status> status = new ArrayList<Status>();
status.add(Status.Ready);
List<TaskSummary> salaboyTasks = localTaskService.getTasksAssignedAsPotentialOwnerByStatus("salaboy",status, "en-UK");
assertEquals(0, salaboyTasks.size());






}
private void addUsersAndGroups(TaskServiceSession taskSession) {
User user = new User("salaboy");
User watman = new User("watman");
taskSession.addUser(user);
taskSession.addUser(watman);
User administrator = new User("Administrator");
taskSession.addUser(administrator);
users.put("salaboy", user);
users.put("watman", watman);
users.put("administrator", administrator);
Group myGroup = new Group("group1");
taskSession.addGroup(myGroup);
groups.put("group1", myGroup);

}

private Task createSimpleTask(List<User> users, User administrator) {
Task task = new Task();
task.setPriority(1);
TaskData data = new TaskData();
data.setWorkItemId(1);
PeopleAssignments peopleAssignments = new PeopleAssignments();
List<OrganizationalEntity> usersEntities = new ArrayList<OrganizationalEntity>();
for (User user : users) {
usersEntities.add(user);
}
List<OrganizationalEntity> adminsEntities = new ArrayList<OrganizationalEntity>();
adminsEntities.add(administrator);
peopleAssignments.setBusinessAdministrators(adminsEntities);
peopleAssignments.setPotentialOwners(usersEntities);
task.setPeopleAssignments(peopleAssignments);
List<I18NText> names = new ArrayList<I18NText>();
names.add(new I18NText("en-UK", "My Simple Task"));
task.setNames(names);
task.setDescriptions(names);
task.setSubjects(names);
data.setProcessInstanceId(1);
data.setProcessSessionId(1);
task.setTaskData(data);
return task;
}
}
@@ -0,0 +1,95 @@
/**
* Copyright 2010 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.salaboy.jbpm5.dev.guide;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.jbpm.task.Group;
import org.jbpm.task.OrganizationalEntity;

import org.jbpm.task.UserInfo;


public class MockUserInfo implements UserInfo {

private Map<Group, List<OrganizationalEntity>> groups = new HashMap<Group, List<OrganizationalEntity>>();

private Map<OrganizationalEntity, String> emails = new HashMap<OrganizationalEntity, String>();

private Map<OrganizationalEntity, String> languages = new HashMap<OrganizationalEntity, String>();

private Map<OrganizationalEntity, String> displayNames = new HashMap<OrganizationalEntity, String>();

public Map<Group, List<OrganizationalEntity>> getGroups() {
return groups;
}

public void setGroups(Map<Group, List<OrganizationalEntity>> groups) {
this.groups = groups;
}

public Map<OrganizationalEntity, String> getEmails() {
return emails;
}

public void setEmails(Map<OrganizationalEntity, String> emails) {
this.emails = emails;
}

public String getEmailForEntity(OrganizationalEntity entity) {
return emails.get( entity );
}



public Map<OrganizationalEntity, String> getDisplayNames() {
return displayNames;
}

public void setDisplayNames(Map<OrganizationalEntity, String> displayNames) {
this.displayNames = displayNames;
}

public Map<OrganizationalEntity, String> getLanguages() {
return languages;
}

public void setLanguages(Map<OrganizationalEntity, String> languages) {
this.languages = languages;
}

public Iterator<OrganizationalEntity> getMembersForGroup(Group group) {
return groups.get( group ).iterator();
}

public boolean hasEmail(Group group) {
return emails.containsKey( group );
}

public String getDisplayName(OrganizationalEntity entity) {
String displayName = displayNames.get( entity );
return ( displayName != null ) ? displayName : entity.getId();
}

public String getLanguageForEntity(OrganizationalEntity entity) {
return languages.get( entity );
}


}
@@ -0,0 +1,222 @@
/**
* Copyright 2010 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.salaboy.jbpm5.dev.guide;

import java.util.ArrayList;
import java.util.List;
import org.drools.SystemEventListenerFactory;
import org.jbpm.task.*;
import org.jbpm.task.TaskService;
import org.jbpm.task.query.TaskSummary;
import org.jbpm.task.service.*;

import org.jbpm.task.service.local.LocalTaskService;

import org.jbpm.task.service.mina.MinaTaskClientConnector;
import org.jbpm.task.service.mina.MinaTaskClientHandler;
import org.jbpm.task.service.mina.MinaTaskServer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

public class TaskServiceMinaSyncTest extends BaseTest {
protected TaskServer server;
protected TaskService client;

@Before
public void setUp() throws Exception {
super.setUp();
server = new MinaTaskServer( taskService );
Thread thread = new Thread( server );
thread.start();
System.out.println("Waiting for the MinaTask Server to come up");
while (!server.isRunning()) {
System.out.print(".");
Thread.sleep( 50 );
}
client = new AsyncTaskServiceWrapper(new TaskClient(new MinaTaskClientConnector("client 1",
new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener()))));
client.connect("127.0.0.1", 9123);
}
@After
public void tearDown() throws Exception {
super.tearDown();
client.disconnect();
server.stop();
}

@Test
public void regularFlowTest() {


List<User> potentialOwners = new ArrayList<User>();
potentialOwners.add(users.get("salaboy"));
// Create a Task Definition
Task task = createSimpleTask(potentialOwners, users.get("administrator"));

// Deploy the Task Definition to the Task Component
client.addTask(task, new ContentData());

// Because the Task contains a direct assignment we can query it for its Potential Owner
// Notice that we obtain a list of TaskSummary (a lightweight representation of a task)
List<TaskSummary> tasksAssignedAsPotentialOwner = client.getTasksAssignedAsPotentialOwner("salaboy", "en-UK");

// We know that there is just one task available so we get the first one
Long taskId = tasksAssignedAsPotentialOwner.get(0).getId();

// In order to check the task status we need to get the real task
// The task is in a Reserved status because it already have a well-defined Potential Owner
Task simpleTask = client.getTask(taskId);
assertEquals(Status.Reserved, simpleTask.getTaskData().getStatus());

// In order start working with this task we call the start() method
client.start(simpleTask.getId(), "salaboy");

// The task is now In Progress
simpleTask = client.getTask(taskId);
assertEquals(Status.InProgress, simpleTask.getTaskData().getStatus());

// PERFORM THE TASK ACTIVITY HERE, the user need to perform the required activities here

// Once the Task activity is performed the user can complete the task,
// Notice that we are completing this task without results
client.complete(simpleTask.getId(), "salaboy", null);

// We can check the task status after completion
simpleTask = client.getTask(taskId);
assertEquals(Status.Completed, simpleTask.getTaskData().getStatus());


}

@Test
public void claimConflictAndRetry() {


// Create a local instance of the TaskService
LocalTaskService localTaskService = new LocalTaskService(taskService);
List<User> potentialOwners = new ArrayList<User>();
potentialOwners.add(users.get("salaboy"));
potentialOwners.add(users.get("watman"));
// Create a Task Definition
Task task = createSimpleTask(potentialOwners, users.get("administrator"));

// Deploy the Task Definition to the Task Component
localTaskService.addTask(task, new ContentData());

// Because the Task contains a direct assignment we can query it for its Potential Owner
// Notice that we obtain a list of TaskSummary (a lightweight representation of a task)
List<TaskSummary> salaboyTasks = localTaskService.getTasksAssignedAsPotentialOwner("salaboy", "en-UK");

// We know that there is just one task available so we get the first one
Long salaboyTaskId = salaboyTasks.get(0).getId();

// In order to check the task status we need to get the real task
// The task is in a Reserved status because it already have a well-defined Potential Owner
Task salaboyTask = localTaskService.getTask(salaboyTaskId);
assertEquals(Status.Ready, salaboyTask.getTaskData().getStatus());

// Because the Task contains a direct assignment we can query it for its Potential Owner
// Notice that we obtain a list of TaskSummary (a lightweight representation of a task)
List<TaskSummary> watmanTasks = localTaskService.getTasksAssignedAsPotentialOwner("watman", "en-UK");

// We know that there is just one task available so we get the first one
Long watmanTaskId = watmanTasks.get(0).getId();
assertEquals(watmanTaskId, salaboyTaskId);
// In order to check the task status we need to get the real task
// The task is in a Reserved status because it already have a well-defined Potential Owner
Task watmanTask = localTaskService.getTask(watmanTaskId);
assertEquals(Status.Ready, watmanTask.getTaskData().getStatus());


localTaskService.claim(watmanTask.getId(), "watman");

try{
localTaskService.claim(salaboyTask.getId(), "salaboy");
} catch(PermissionDeniedException ex){
// The Task is gone.. salaboy needs to retry
assertNotNull(ex);
}







}

@Test
public void claimNextAvailable() {


// Create a local instance of the TaskService
LocalTaskService localTaskService = new LocalTaskService(taskService);
List<User> potentialOwners = new ArrayList<User>();
potentialOwners.add(users.get("salaboy"));
potentialOwners.add(users.get("watman"));
// Create a Task Definition
Task task = createSimpleTask(potentialOwners, users.get("administrator"));

// Deploy the Task Definition to the Task Component
localTaskService.addTask(task, new ContentData());

// we don't need to query for our task to see what we will claim, just claim the next one available for us

localTaskService.claimNextAvailable("watman", "en-UK");


List<Status> status = new ArrayList<Status>();
status.add(Status.Ready);
List<TaskSummary> salaboyTasks = localTaskService.getTasksAssignedAsPotentialOwnerByStatus("salaboy",status, "en-UK");
assertEquals(0, salaboyTasks.size());





}


private Task createSimpleTask(List<User> users, User administrator) {
Task task = new Task();
task.setPriority(1);
TaskData data = new TaskData();
data.setWorkItemId(1);
PeopleAssignments peopleAssignments = new PeopleAssignments();
List<OrganizationalEntity> usersEntities = new ArrayList<OrganizationalEntity>();
for (User user : users) {
usersEntities.add(user);
}
List<OrganizationalEntity> adminsEntities = new ArrayList<OrganizationalEntity>();
adminsEntities.add(administrator);
peopleAssignments.setBusinessAdministrators(adminsEntities);
peopleAssignments.setPotentialOwners(usersEntities);
task.setPeopleAssignments(peopleAssignments);
List<I18NText> names = new ArrayList<I18NText>();
names.add(new I18NText("en-UK", "My Simple Task"));
task.setNames(names);
task.setDescriptions(names);
task.setSubjects(names);
data.setProcessInstanceId(1);
data.setProcessSessionId(1);
task.setTaskData(data);
return task;
}

}
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">

<persistence-unit name="org.jbpm.task">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<class>org.jbpm.task.Attachment</class>
<class>org.jbpm.task.Content</class>
<class>org.jbpm.task.BooleanExpression</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Delegation</class>
<class>org.jbpm.task.Escalation</class>
<class>org.jbpm.task.Group</class>
<class>org.jbpm.task.I18NText</class>
<class>org.jbpm.task.Notification</class>
<class>org.jbpm.task.EmailNotification</class>
<class>org.jbpm.task.EmailNotificationHeader</class>
<class>org.jbpm.task.PeopleAssignments</class>
<class>org.jbpm.task.Reassignment</class>
<class>org.jbpm.task.Status</class>
<class>org.jbpm.task.Task</class>
<class>org.jbpm.task.TaskData</class>
<class>org.jbpm.task.SubTasksStrategy</class>
<class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
<class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
<class>org.jbpm.task.User</class>
<properties>
<!-- testing with H2 in memory -->
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
<property name="hibernate.connection.url" value="jdbc:h2:mem:mydb" />
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value="sasa"/>
<property name="hibernate.connection.autocommit" value="false" />

<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
@@ -11,7 +11,7 @@
<artifactId>jBPM5-Ldapcallback</artifactId>
<version>1.0-SNAPSHOT</version>
<name>jBPM5 :: Human Task Ldap Callback Test</name>
<url>http://maven.apache.org</url>
<url>http://salaboy.com</url>
<properties>
<jbpm.version>5.2.0.Final</jbpm.version>
<spring.security.version>3.0.5.RELEASE</spring.security.version>
@@ -13,7 +13,9 @@
<url>http://salaboy.com</url>
<modules>
<module>jBPM5-Ldapcallback</module>
<module>jBPM5-HumanTasksSimple</module>
<module>jBPM5-HumanTaskUI-Swing</module>
</modules>


</project>
</project>
@@ -44,18 +44,18 @@
<userTask id="_9" name="User Task 1" >
<extensionElements>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry1");
kcontext.getKnowledgeRuntime().insert(new OnEntryNodeEvent());</script>
<tns:script>System.out.println("On-entry1");
kcontext.getKnowledgeRuntime().insert(new OnEntryNodeEvent());</tns:script>
</tns:onEntry-script>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry2");</script>
<tns:script>System.out.println("On-entry2");</tns:script>
</tns:onEntry-script >
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit1");
kcontext.getKnowledgeRuntime().insert(new OnExitNodeEvent()); </script>
<tns:script>System.out.println("On-exit1");
kcontext.getKnowledgeRuntime().insert(new OnExitNodeEvent()); </tns:script>
</tns:onExit-script>
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit2");</script>
<tns:script>System.out.println("On-exit2");</tns:script>
</tns:onExit-script>
</extensionElements>
<ioSpecification>
@@ -68,20 +68,20 @@
<userTask id="_10" name="User Task 2" >
<extensionElements>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry1");
<tns:script>System.out.println("On-entry1");
kcontext.getKnowledgeRuntime().insert(new OnEntryNodeEvent());
</script>
</tns:script>
</tns:onEntry-script>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry2");</script>
<tns:script>System.out.println("On-entry2");</tns:script>
</tns:onEntry-script>
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit1");
<tns:script>System.out.println("On-exit1");
kcontext.getKnowledgeRuntime().insert(new OnExitNodeEvent());
</script>
</tns:script>
</tns:onExit-script>
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit2");</script>
<tns:script>System.out.println("On-exit2");</tns:script>
</tns:onExit-script>
</extensionElements>
<ioSpecification>
@@ -94,16 +94,16 @@
<userTask id="_11" name="User Task 3" >
<extensionElements>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry1");</script>
<tns:script>System.out.println("On-entry1");</tns:script>
</tns:onEntry-script>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry2");</script>
<tns:script>System.out.println("On-entry2");</tns:script>
</tns:onEntry-script>
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit1");</script>
<tns:script>System.out.println("On-exit1");</tns:script>
</tns:onExit-script>
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit2");</script>
<tns:script>System.out.println("On-exit2");</tns:script>
</tns:onExit-script>
</extensionElements>
<ioSpecification>
@@ -116,16 +116,16 @@
<userTask id="_12" name="User Task 4" >
<extensionElements>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry1");</script>
<tns:script>System.out.println("On-entry1");</tns:script>
</tns:onEntry-script>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-entry2");</script>
<tns:script>System.out.println("On-entry2");</tns:script>
</tns:onEntry-script>
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit1");</script>
<tns:script>System.out.println("On-exit1");</tns:script>
</tns:onExit-script>
<tns:onExit-script scriptFormat="http://www.java.com/java">
<script>System.out.println("On-exit2");</script>
<tns:script>System.out.println("On-exit2");</tns:script>
</tns:onExit-script>
</extensionElements>
<ioSpecification>