Creating a Test Client to Test SAW(Simple Api for Workflow)

    

    Pre-requisites to create a Test Client(Using Netbeans 6.0 M10 on windows) :

        SAW Project Site can be Accessed at the following URL
 

  1. JCAPS 5.1.3 should be installed. Please see this blog entry
  2. Download the saw api 0.2 version from the SAW Project Site
  3. Download Netbeans 6.0 M10 for windows
  4. TestClient Netbeans Project :

     The TestClient Netbeans project is uploaded here. If you dont want to read the steps below, just add the nbproject to your Netbeans, change the property files accordingly and add your generated stub(WorkflowServiceClient.jar) and start using it. However you have to add your own stub and change the property files accordingly. 

         Creating a TestClient to Test SAW api version 0.2 :

  1. In the Netbeans 6.0 m10 ide click on New Project
  2. Choose Java -> Java Application. See the image
  3. Give the name TestClient to the Java App. Image
  4. Copy ImplementationType.properties, JCAPSWorkflowConfig.properties and WorkflowConfig.properties directly under Source Packages (Image)
  5. Change the following ImplementationType.properties
    • ImplementationType=JCAPS

     6.  Change the following in JCAPSWorkflowConfig.properties

  •  appserverhost=<integration server where jcaps is running>
  • appserverport=18002
  • appserverusername=Administrator
  • appserverpassword=<password>
  • contextfactory=com.sun.jndi.cosnaming.CNCtxFactory
  • serviceJndi=WorkflowService                

    7.   Change the following in WorkflowConfig.properties

                   businessProcess=com.sun.saw.impls.jcaps.JCAPSWorkflow

                    logFileLocation=D:\\\\b7log.txt

    8.   Now right click on the Java App name, in this case TestClient and select properties

    9.   Then click on Libraries on the Left Hand menu(Image)

    10. Add saw-api-0.2.jar under the compile tab (Image)

    11. Then add saw-api-0.2.jar, saw-imp-jcaps-0.2.jar, WorkflowServiceClient.jar, javaee.jar under the run tab (Image)

    12. To checkOut Tasks following code should be written in the main :

 

                public class TestClient {
                public TestClient() {
                }
                      public static void main(String[] args) {
                        TestClient client = new TestClient();
                        List taskIdList = new ArrayList();
                        taskIdList.add(0,"-24fb26e7:1157fe0cdcb:-7ec6") ;
                        taskIdList.add(1,"-24fb26e7:1157fe0cdcb:-7eca") ;
                try {
                        com.sun.saw.vo.OutputVO output = null;
                        output = client.checkOutTasks("CPina", taskIdList) ;
               
                        if(output.isOperationStatus())
                        {
                            System.out.println("checkout : success") ;
                        }
                        else
                       {
                            System.out.println("checkout : Failed") ;
                        }
              
                        } catch (com.sun.saw.WorkflowException e) {
                            e.printStackTrace();
                        }
              }
    
        public com.sun.saw.vo.OutputVO checkOutTasks(String userId, java.util.List taskIdList) throws         com.sun.saw.WorkflowException {
        com.sun.saw.WorkFlowManager workFlowManager = com.sun.saw.WorkFlowManager.getInstance();
        com.sun.saw.vo.CheckoutTaskVO checkoutTaskVO = new com.sun.saw.vo.CheckoutTaskVO();
        checkoutTaskVO.setTaskIdList(taskIdList);
        checkoutTaskVO.setUserId(userId);
        com.sun.saw.vo.OutputVO outputVO = null;
        outputVO = workFlowManager.checkoutTasks(checkoutTaskVO);
        return outputVO;
    }

}


 

 

 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

siddeshk123

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today