Testing Business Components Using Naming Service

  1. In the Navigator, select the appropriate business components project.
  2. Choose Project | Project Settings from the main menu, or right-click and choose Settings.
  3. The Project Settings dialog opens with the common input paths displayed.
  4. Under Development, click the Libraries or Production node, depending on what was set for the Project Settings' Active Configuration under the Configuration node.
  5. Select the desired library or libraries from the Available libraries listing and click the single shuttle button to move them to the Selected libraries listing. To move the entire listing, click the double shuttle button.
  6. Add the following libraries:

    JBO VB Runtime
    JBO VB Client
    JBO Runtime
    Your business components common library

    If you need assistance adding libraries, click Help.
  7. Create a VisiBroker naming mode configuration for your business components project. For information on how to do this, see Defining BC4J JSP Runtime Properties in the bc4j.xcfg File.
  8. Choose File | New.
  9. Select Class.
  10. Name your class BC4J_VBREMOTE_Test and click OK.
  11. In the Navigator, double-click your new class to open the Source view.
  12. Paste the following code into your class. You'll need to replace the names in this sample to reflect the names you've used in your your own test client.
    
    package mypackage;
    
    import oracle.jbo.*;
    import oracle.jbo.client.Configuration;
    
    public class BC4J_VBREMOTE_Test
    {
      public BC4J_VBREMOTE_Test()
      {
      }
      public static void main(String arg[]) {
    
      String _am = "mypackage.MypackageModule"; //App Module name
      String _cf = "MypackageModule"; // VisiBroker Naming Config name specfied in step 7 above.
      String voMemberName = "DeptView"; // Name of the View Object
    
    
      ApplicationModule myam =
        (ApplicationModule)Configuration.createRootApplicationModule(_am,_cf);
    
      // Find the viewobject included in the appmodule
        ViewObject vo = myam.findViewObject(voMemberName);
    
      // Iterate over the viewobject to get the rows
    
            Row r = vo.first();
             while (r != null)
             {
                // Iterate over the current row and get 
                // all the attributes
                for (int i = 0; i < vo.getAttributeCount(); i++)
                {
                   String attrName = vo.getAttributeDef(i).getName();
                   String attrVal  = r.getAttribute(i).toString();
                   System.out.println(attrName + " = " + attrVal);
                }
                r = vo.next();             
             }
    
    
      
    
      }
    }
    
    
  13. Choose Run | Run <name of project>.

Related topics

Deploying CORBA Objects on VisiBroker
Starting CORBA Objects on VisiBroker