< Previous | Next >

Lesson 1.4: Deploy your application

Lesson 1.4 leads you through the creation of a Java™ class to test your application.

Before you begin, you must complete Lesson 1.3. In this lesson you will:
  1. First you will create the TestECIMPO file: Expand the CustomerProj project, expand the Java Resources section and select the sample.cics package.
  2. Right click and select New. Select the class icon class option to create a new Java class.
  3. In the Java class name field, type TestECIMPO
  4. Open TestECIMPO in the Java editor.
  5. Replace all the code in the editor with the following:
    Note: The TestECIMPO.java Java class was created for an English locale; you may have to make modifications in the code for other locales.
    /***************************************************************
     * Licensed Materials - Property of IBM
     *  
     * com.ibm.j2c.cheatsheet.content
     *  
     * Copyright IBM Corporation 2004. All Rights Reserved. 
     * 
     * Note to U.S. Government Users Restricted Rights:  Use, duplication or disclosure restricted by GSA ADP  Schedule Contract with IBM Corp. 
     *************************************************************/
    package sample.cics;
    
    import sample.cics.data.*;
    public class TestECIMPO
    {
    
    	
    
    	public static void process(InputComm input)
    	{
    		
    	 System.out.println("processing....");
         try {
    		//CustomerInfoMOImpl proxy = new CustomerInfoMOImpl();
    		CustomerInfoMOImpl proxy = new CustomerInfoMOImpl();
         	OutputComm output = proxy.getCustomerInfo (input);
    
    		BadCust badCust = output.getBadCust();
    		PrefCust prefCust = output.getPrefCust();
    		RegCust regCust = output.getRegCust();
    
    		if (regCust != null)
    		{
    			System.out.println("Reg Customer");
    			System.out.println("account name:  " + regCust.getAccountname());
    			System.out.println("balance:  " + regCust.getBalance());
    			System.out.println("cust code:  " + regCust.getRcustcode());
    			System.out.println("cust no:  " + regCust.getRcustno());
    		}
    		else if (prefCust != null)
    		{
    			System.out.println("Pref Customer");
    			System.out.println("assets:  " + prefCust.getAssets());
    			System.out.println("cust code:  " + prefCust.getPcustcode());
    			System.out.println("cust no:  " + prefCust.getPcustno());
    		}
    		else if (badCust != null)
    		{
    			System.out.println("Bad Customer");
    			System.out.println("amount:  " + badCust.getAmount());
    			System.out.println("cust code:  " + badCust.getBcustcode());
    			System.out.println("cust no:  " + badCust.getBcustno());
    			System.out.println("days overdue:  " + badCust.getDaysoverdue());
    		}
    		else
    			System.out.println("No match");
    	}
    	catch (Exception exc)
    	{
    		System.out.println (exc);
    		exc.printStackTrace();
    	}
    		
    	}
    	
    	public static void testPrefCust()
    	{
    	   System.out.println("===========testPreCust==============");
    	try {
    		InputComm input = new InputComm();
    		String prefC = "12345";
    		input.setICustNo (prefC);
    		process(input);
    	}
    	catch (Exception exc)
    	{
    		System.out.println (exc);
    		exc.printStackTrace();
    	}	
    		
    				
    	}
    	
    	public static void testRegCust()
    	{
    	   System.out.println("===========testRegCust==============");
    	try {
    		InputComm input = new InputComm();
    		String regC = "34567";
    		input.setICustNo (regC);
    		process(input);
    	}
    	catch (Exception exc)
    	{
    		System.out.println (exc);
    		exc.printStackTrace();
    	}
    	
    	}
    	
    	public static void testBadCust()
    	{
    	  
    		System.out.println("===========testBadCust==============");
    	try {
    		
    		InputComm input = new InputComm();
    		String badC = "123";
    		input.setICustNo (badC);
    		process(input);
    		
    	}
    	catch (Exception exc)
    	{
    		System.out.println (exc);
    		exc.printStackTrace();
    	}
    	}
    	
    	
    	public static void main (String[] args)
    	{
    		testPrefCust();
    		testRegCust();
    		testBadCust();
    		
    	}
    }
  6. Next you will test the application
  7. Right-click TestECIMPO.java and select Run as> Java Application.
  8. The console should display the following output:

    application output

Congratulations! You have completed the CICS® Taderc25 tutorial.
< Previous | Next >