Access Keys:
Skip to content (Access Key - 0)

Step 5: Implement the getIdentifier Test


With the operation implemented, the next step is to create a test for the operation. To do this, the Introduce-generated client will be modified to invoke the service operation. By adding a call with the getIdentifier operation in the client main method, an identifier will be created for the portfolio and then displayed.

Edit the client main method so we can use it for a quick test

  • Open the <STOCKMANAGER>/src/org/cagrid/introduce/tutorial/stockmanager/client/StockManagerClient.java class for editing
  • Add the following import:
import org.cagrid.introduce.tutorial.stockmanager.portfolio.client.StockPortfolioManagerClient;
  • Locate the main method.
  • After:
      		// Sleep to allow for update, then print the portfolio
    		Thread.sleep(5000);
    		System.out.println("Getting Quotes");
    			    System.out.println(org.cagrid.introduce.tutorial.tools.QuoteTools.PortfolioInstance2String(portfolio3.getPortfolioQuote()));
  • Add:
    		//request an identifier for the portfolio and display it
    		String identifierURL = portfolio3.getIdentifier();
    	System.out.println("Portfolio 3 Identifier: " + identifierURL);	  
    
  • Delete the following:
    	  	    // now use the destroy method to remove the portfolio
    			System.out.println("Destroying Portfolio 3");
    			 portfolio3.destroy();
    
  • Save the modified file.

Validate the implementation

  • Open a terminal, change directory to the generated service, and run ant all.

    %> cd STOCKMANAGER_LOCATION
    %> ant all

If ant does not return a BUILD SUCCESSFUL, make sure you do not have a typo in the client implementation file.

Last edited by
Sarah Honacki (415 days ago)
Adaptavist Theme Builder Powered by Atlassian Confluence