Package com.arjuna.orbportability

Examples of com.arjuna.orbportability.ORB


     * @param args Not used in this example.
     */
    public static void main(String[] args)
    {
        // Define an ORB suitable for use by the JBoss Transactions product ORB portability layer.
        ORB myORB = null;
        // Define an object adapter suitable for use by the JBoss Transactions product ORB portability layer.
        RootOA myOA = null;
        try
        {
            // Initialize the ORB reference using the JBoss Transactions product ORB portability layer.
            myORB = ORB.getInstance("test");
            // Initialize the object adapter reference using the JBoss Transactions product ORB portability layer.
            myOA = OA.getRootOA(myORB);
            // Initialize the ORB using the JBoss Transactions product ORB portability layer.
            myORB.initORB(args, null);
            // Initialize the object adapter reference using the JBoss Transactions product ORB portability layer.
            myOA.initOA();
        }
        catch (Exception e)
        {
View Full Code Here


     * @param args Not used by this entry point.
     */
    public static void main(String[] args)
    {
        // Define an ORB suitable for use by the JBoss Transactions product ORB portability layer.
        ORB myORB = null;
        // Define an object adapter suitable for use by the JBoss Transactions product ORB portability layer.
        RootOA myOA = null;
        try
        {
            // Initialize the ORB reference using the JBoss Transactions product ORB portability layer.
            myORB = ORB.getInstance("ClientSide");
            // Initialize the object adapter reference using the JBoss Transactions product ORB portability layer.
            myOA = OA.getRootOA(myORB);
            // Initialize the ORB using the JBoss Transactions product ORB portability layer.
            myORB.initORB(args, null);
            // Initialize the object adapter reference using the JBoss Transactions product ORB portability layer.
            myOA.initOA();
        }
        catch (Exception e)
        {
            // The ORB has not been correctly configured!
            // Display as much help as possible to the user track down the configuration problem
            System.err.println("Trailmap Error: ORB Initialisation failed: " + e);
            e.printStackTrace();
            System.exit(0);
        }

        // Obtain a reference to the BankImpl CORBA representation inorder to be able to use it to transactionally
        // invoke banking operations as part of the JBoss Transactions product trailmap
        // Define the reference to invoke
        Bank bank = null;
        // Obtain the reference for bank
        try
        {
            // Read the IOR from file
            java.io.FileInputStream file = new java.io.FileInputStream("ObjectId");
            java.io.InputStreamReader input = new java.io.InputStreamReader(file);
            java.io.BufferedReader reader = new java.io.BufferedReader(input);
            // This contains the IOR
            String stringTarget = reader.readLine();

            // Convert the IOR into a CORBA object
            org.omg.CORBA.Object obj = myORB.orb().string_to_object(stringTarget);
            // Narrow the object into an object implementing <CODE>Hello</CODE>
            System.out.println("Try to convert the obj ref to a Bank object !");
            bank = BankHelper.narrow(obj);
        }
        catch (java.io.IOException ioe)
View Full Code Here

    /**
     * The main test method which must assert either a pass or a fail.
     */
    public void run(String[] args)
    {
        ORB orb = null,
            orb2 = null;
        Properties testProps = System.getProperties();

        testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
                        "com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisationUsingInterface");
        testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
                        "com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisationUsingInterface");
        testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME_2),
                        "com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisationUsingInterface");
        testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME_2),
                        "com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisationUsingInterface");

        try
        {
            orb = ORB.getInstance(ORB_INSTANCE_NAME);
            logInformation("Initialising ORB("+ORB_INSTANCE_NAME+")");
            orb.initORB(args, null);

            if ( PreInitialisationUsingInterface.getObject() == orb )
            {
                logInformation("PreInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME+")");
                assertSuccess();
            }
            else
            {
                logInformation("PreInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME+")");
                assertFailure();
            }

            if ( PostInitialisationUsingInterface.getObject() == orb )
            {
                logInformation("PostInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME+")");
                assertSuccess();
            }
            else
            {
                logInformation("PostInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME+")");
                assertFailure();
            }

            orb2 = ORB.getInstance(ORB_INSTANCE_NAME_2);
            logInformation("Initialising ORB("+ORB_INSTANCE_NAME_2+")");
            orb2.initORB(args, null);

            if ( PreInitialisationUsingInterface.getObject() == orb2 )
            {
                logInformation("PreInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME_2+")");
                assertSuccess();
            }
            else
            {
                logInformation("PreInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME_2+")");
                assertFailure();
            }

            if ( PostInitialisationUsingInterface.getObject() == orb2 )
            {
                logInformation("PostInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME_2+")");
                assertSuccess();
            }
            else
            {
                logInformation("PostInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME_2+")");
                assertFailure();
            }
        }
        catch (Exception e)
        {
            logInformation("ERROR - "+e);
            e.printStackTrace(System.err);
            assertFailure();
        }

        try
        {
            orb.destroy();
            orb2.destroy();
        }
        catch (Exception e)
        {
            logInformation("ERROR - "+e);
View Full Code Here

  public void run(String[] args)
  {
    try
    {
      /** Create ORB and OA **/
      ORB testORB = ORB.getInstance( ORB_INSTANCE_NAME );
      OA testOA = OA.getRootOA( testORB );

      /** Initialise ORB and OA **/
      testORB.initORB(args, null);
      testOA.initPOA(args);

      /** Create services object **/
      Services testServ = new Services(testORB);

View Full Code Here

public class SimpleServer extends Test
{
    public void run(String[] args)
    {
        ORB orb = ORB.getInstance("main_orb");
        ORB orb2 = ORB.getInstance("main_orb_2");
        RootOA oa = RootOA.getRootOA(orb);
        RootOA oa2 = RootOA.getRootOA(orb2);

        try
        {
            orb.initORB(args,null);
            oa.initOA(args);

            orb2.initORB(args,null);
            oa2.initOA(args);
        }
        catch (Exception e)
        {
            logInformation("ERROR - During ORB and OA initialisation ("+e+")");
            e.printStackTrace(System.err);
            assertFailure();
        }

        try
        {
            SimpleObjectImpl obj = new SimpleObjectImpl();

            oa.objectIsReady(obj);

            if (oa.objectIsReady(obj))
            {
                logInformation("Manage to activate a servant on the same OA twice - this is incorrect");
                assertFailure();
            }
            else
            {
                logInformation("Didn't managed to activate a servant on the same OA twice - correct");
            }

            if (oa2.objectIsReady(obj))
            {
                logInformation("OA2 did not contain the servant registered on OA - correct");
                oa2.shutdownObject(obj);
            }
            else
            {
                logInformation("OA2 already contained the servant registered on OA - this is incorrect");
                assertFailure();
            }
            assertSuccess();
        }
        catch (Exception e)
        {
            logInformation("ERROR - During object initialisation ("+e+")");
            e.printStackTrace(System.err);
            assertFailure();
        }
        oa.destroy();
  orb.shutdown();
        oa2.destroy();
  orb2.shutdown();
    }
View Full Code Here

        testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb",ORB_INSTANCE_NAME_2),
                "com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisation2");
        testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb",ORB_INSTANCE_NAME_2),
                "com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisation2");

        ORB orb = null;

        try
        {
            orb = ORB.getInstance(ORB_INSTANCE_NAME);
            logInformation("Initialising First ORB Instance");
            orb.initORB(args, testProps);
        }
        catch (Exception e)
        {
            logInformation("ERROR - "+e);
            assertFailure();
        }

        if (!PreInitialisation._called)
        {
            logInformation("FAILED: First ORB instance pre-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("First ORB instance pre-initialisation called");
        }

        if (!PostInitialisation._called)
        {
            logInformation("FAILED: First ORB instance post-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("First ORB instance post-initialisation called");
        }

        if (!PreInitialisation2._called)
        {
            logInformation("Second ORB instance pre-initialisation not called");
        }
        else
        {
            logInformation("FAILED: Second ORB instance pre-initialisation called");
            assertFailure();
        }

        if (!PostInitialisation2._called)
        {
            logInformation("Second ORB instance post-initialisation not called");
        }
        else
        {
            logInformation("FAILED: Second ORB instance post-initialisation called");
            assertFailure();
        }

        if (!AllPreInitialisation._called)
        {
            logInformation("FAILED: All ORB instances pre-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("All ORB instances pre-initialisation called");
        }

        if (!AllPostInitialisation._called)
        {
            logInformation("FAILED: All ORB instances post-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("All ORB instances post-initialisation called");
        }

        try
        {
            /**
             * Reset called flags on All ORB instance pre-initialisation
             */
            AllPreInitialisation._called = false;
            AllPostInitialisation._called = false;
            orb = ORB.getInstance(ORB_INSTANCE_NAME_2);
            logInformation("Initialising Second ORB Instance");
            orb.initORB(args, testProps);
        }
        catch (Exception e)
        {
            logInformation("ERROR - "+e);
            assertFailure();
        }

        if (!PreInitialisation2._called)
        {
            logInformation("FAILED: Second ORB instance pre-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("Second ORB instance pre-initialisation called");
        }

        if (!PostInitialisation2._called)
        {
            logInformation("FAILED: Second ORB instance post-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("Second ORB instance post-initialisation called");
        }

        if (!AllPreInitialisation._called)
        {
            logInformation("FAILED: All ORB instances pre-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("All ORB instances pre-initialisation called");
        }

        if (!AllPostInitialisation._called)
        {
            logInformation("FAILED: All ORB instances post-initialisation not called");
            assertFailure();
        }
        else
        {
            logInformation("All ORB instances post-initialisation called");
        }

        try
        {
            orb.destroy();
        }
        catch (Exception e)
        {
            logInformation("ERROR - "+e);
            assertFailure();
View Full Code Here

        return(returnValue);
    }

    public void run(String[] args)
    {
        ORB orbInstance[] = new ORB[NUMBER_OF_ORBOAS];
        RootOA oaInstance[] = new RootOA[NUMBER_OF_ORBOAS];

        for (int count=0;count<NUMBER_OF_ORBOAS;count++)
        {
            logInformation("Creating ORB and OA #"+count);
            orbInstance[count] = ORB.getInstance("orb_"+count);

            oaInstance[count] = RootOA.getRootOA(orbInstance[count]);

            if (!initialiseORBandOA(args,orbInstance[count],oaInstance[count]))
            {
                logInformation("Failed to create ORB and OA #"+count);
                assertFailure();
            }
        }

        if (!ensureAllORBReferencesAreUnique(orbInstance, oaInstance))
        {
            assertFailure();
        }

        logInformation("Retrieving all ORBs and OAs");

        for (int count=0;count<NUMBER_OF_ORBOAS;count++)
        {
            logInformation("Retrieving ORB and OA #"+count);
            ORB orb = ORB.getInstance("orb_"+count);

            if ( orb == null)
            {
                logInformation("Failed to retrieve ORB #"+count);
                assertFailure();
View Full Code Here

      logInformation( " Current State : "+ PrettyPrintState( _currentState ) );
    }
 
    public void run(String[] args)
    {
        ORB orb = ORB.getInstance("main_orb");
        RootOA oa = RootOA.getRootOA(orb);
  try
  {
/*
       * Initialise the ORB and OA
       */
      logInformation("Initialising ORB and OA");
     
      orb.initORB(args, null);
      oa.initOA();
     
      _currentState = NONE;
  }
  catch (Exception e)
  {
      logInformation("Initialisation failed: "+e);
      e.printStackTrace();
      assertFailure();
  }
 
  /**
   * Register pre and post shutdown handlers
   */
  oa.addPreShutdown( new TestPreShutdown( "PreShutdown", this ) );
  oa.addPostShutdown( new TestPostShutdown( "PostShutdown", this ) );

        /*
   * Shutdown ORB and OA
   */
  logInformation("Shutting down ORB and OA");
  oa.destroy();
  orb.shutdown();
 
  /*
   * Ensure final state is correct
   */
  logInformation("Final state: " + PrettyPrintState(_currentState) );
View Full Code Here

     */
    public void run(String[] args)
    {
        try
        {
            ORB orb = ORB.getInstance( ORB_NAME );
            OA oa = OA.getRootOA( orb );

            orb.initORB(args, null);
            oa.initOA(args);

            logInformation("          ORBInfo.getOrbName: "+ORBInfo.getOrbName());
            logInformation("  ORBInfo.getOrbMajorVersion: "+ORBInfo.getOrbMajorVersion());
            logInformation("  ORBInfo.getOrbMinorVersion: "+ORBInfo.getOrbMinorVersion());
            logInformation("ORBInfo.getCorbaMajorVersion: "+ORBInfo.getCorbaMajorVersion());
            logInformation("ORBInfo.getCorbaMinorVersion: "+ORBInfo.getCorbaMinorVersion());
            logInformation("     ORBInfo.getOrbEnumValue: "+ORBInfo.getOrbEnumValue());

            oa.destroy();
            orb.destroy();

            assertSuccess();
        }
        catch (Exception e)
        {
View Full Code Here

            long myPoaExceptedValue = 0;

            for (int orbCount=0;orbCount<numberOfORBs;orbCount++)
            {
                String orbId = ORB_INSTANCE_NAME+orbCount;
                ORB orb = ORB.getInstance(orbId);
                logInformation("Initialising ORB Instance '"+orbId+"'");
                orb.initORB(args, null);
                RootOA rootOA = RootOA.getRootOA(orb);
                rootOA.initPOA(args);
                preInitExpectedValue++;

                if (PreInitialisation._count != preInitExpectedValue)
                {
                    logInformation("Checking: Failed, Pre-initialisation class not called as expected");
                    assertFailure();
                }
                else
                {
                    logInformation("Checking: Correct ("+preInitExpectedValue+")");
                }

                for (int oaCount=0;oaCount<numberOfOAsPerORB;oaCount++)
                {
                    String oaId = OA_INSTANCE_NAME+oaCount;
                    logInformation("Initialising OA instance '"+oaId+"' for ORB Instance '"+orbId+"'");

                    Policy p[] = new Policy[1];
                    p[0] = rootOA.rootPoa().create_implicit_activation_policy(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION);
                    OA oa = rootOA.createPOA(oaId, p);
                    preInitExpectedValue++;
                    myPoaExceptedValue++;
                }

                if (PreInitialisation2._count != myPoaExceptedValue)
                {
                    logInformation("Checking: Failed, Pre-initialisation of mypoa class not called as expected");
                    assertFailure();
                }
                else
                {
                    logInformation("Checking: myPOA Correct ("+myPoaExceptedValue+")");
                }


                if (PreInitialisation._count != preInitExpectedValue)
                {
                    logInformation("Checking: Failed, Pre-initialisation class not called as expected");
                    assertFailure();
                }
                else
                {
                    logInformation("Checking: Correct ("+preInitExpectedValue+")");
                }
            }
        }
        catch (Exception e)
        {
            logInformation("ERROR - "+e);
            e.printStackTrace(System.err);
            assertFailure();
        }

        for (int orbCount=0;orbCount<numberOfORBs;orbCount++)
        {
            try
            {
                String orbId = ORB_INSTANCE_NAME+orbCount;
                ORB orb = ORB.getInstance(orbId);

                RootOA oa = RootOA.getRootOA(orb);
                oa.destroy();
                orb.destroy();
            }
            catch (Exception e)
            {
                logInformation("ERROR - While destroying ORB instance '"+ORB_INSTANCE_NAME+orbCount+"' ("+e+")");
                e.printStackTrace(System.err);
View Full Code Here

TOP

Related Classes of com.arjuna.orbportability.ORB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.