Package gnu.testlet.org.omg.PortableServer.POAOperations.communication

Examples of gnu.testlet.org.omg.PortableServer.POAOperations.communication.poa_comTester


  public void test_RETAIN_Activation()
  {
    server.once_activated.incarnations.clear();
    server.once_activated.etherializations.clear();

    poa_comTester uobject =
      poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE0, orb));
    uobject.sayHello();

    for (int j = 0; j < 3; j++)
      for (int i = 0; i < allServants.length; i++)
        {
          poa_comTester object =
            poa_comTesterHelper.narrow(readIOR(allServants [ i ], orb));
          String r = object.passCharacters("abba", "baba");
          assertEquals("wide/narrow strings", "return 'baba' and 'abba'", r);
        }

    Iterator iter = server.once_activated.incarnations.iterator();

    assertEquals("Must be activated once", 1,
                 server.once_activated.incarnations.size()
                );
    assertEquals("Must not be deactivated", 0,
                 server.once_activated.etherializations.size()
                );
    assertEquals("Activated object", "4 5 2 5 7 2 /1",
                 server.once_activated.incarnations.get(0)
                );

    // Ensure that all requests are served by the same servant.
    poa_comTester object =
      poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE0, orb));

    String s = object.sayHello();
    assertTrue("Object key", s.startsWith("4 5 2 5 7 2 :"));

    String n;

    for (int i = 0; i < 10; i++)
      {
        n = object.sayHello();
        assertEquals("Must be same servant", s, n);
      }
  }
View Full Code Here


      }
  }

  public void testActivatedPoaAccess()
  {
    poa_comTester object =
      poa_comTesterHelper.narrow(readIOR("xactivated", orb));
  }
View Full Code Here

  /**
   * Get the object reference.
   */
  public void testPOA()
  {
    poa_comTester object;

    try
      {
        ORB orb = org.omg.CORBA.ORB.init(new String[ 0 ], null);

        object = poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE0, orb));
        control = remotePoaControlHelper.narrow(readIOR(CONTROL_IOR_FILE, orb));

        object = poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE1, orb));

        assertEquals("testPOA", 17, object.theField());

        object.sayHello();
        object = poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE2, orb));
        object.sayHello();
      }
    catch (Throwable t)
      {
        t.printStackTrace();
        fail("" + t);
View Full Code Here

  public void test_NO_RETAIN()
  {
    // The POA of this object uses NO_RETAIN with servant locator.
    // That locator must be requested to find each time a new servant.
    poa_comTester object =
      poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE3, orb));

    server.m575.preinvokes.clear();
    server.m575.postinvokes.clear();

    String s1 = object.sayHello();
    String s2 = object.sayHello();
    String s3 = object.sayHello();

    assertTrue("NO_RETAIN key", s1.startsWith("5 7 5 :"));
    assertTrue("NO_RETAIN key", s2.startsWith("5 7 5 :"));
    assertTrue("NO_RETAIN key", s3.startsWith("5 7 5 :"));
View Full Code Here

    return orb.string_to_object(ior);
  }

  public void testFieldAccess()
  {
    poa_comTester object =
      poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE0, orb));

    object.theField(222);
    assertEquals("fieldAccess:1", 222, object.theField());
    object.theField(17);
    assertEquals("fieldAccess:2", 17, object.theField());
  }
View Full Code Here

   * retain policy. One object is activated with a separate servant.
   * The others two use the default servant.
   */
  public void testCombinedActivation()
  {
    poa_comTester t1 = poa_comTesterHelper.narrow(readIOR("T1", orb));
    poa_comTester t2 = poa_comTesterHelper.narrow(readIOR("T2", orb));
    poa_comTester tx = poa_comTesterHelper.narrow(readIOR("TX", orb));

    String s1 = t1.sayHello();
    String s2 = t2.sayHello();
    String sx = tx.sayHello();

    String h1 = s1.substring(s1.lastIndexOf(":"));
    String h2 = s2.substring(s2.lastIndexOf(":"));
    String hx = sx.substring(sx.lastIndexOf(":"));

View Full Code Here

    assertTrue("combinedActivation:3", sx.startsWith("4 4 4 5 5 5 5 :"));
  }

  public void testPOAControl()
  {
    poa_comTester object =
      poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE0, orb));

    poa_comTester other_poa =
      poa_comTesterHelper.narrow(readIOR(ssTARGET_IOR_FILE1, orb));

    control = remotePoaControlHelper.narrow(readIOR(CONTROL_IOR_FILE, orb));

    try
      {
        object.sayHello();
      }
    catch (Exception ex)
      {
        fail("First invocation " + ex);
      }

    server.once_activated.incarnations.clear();
    server.once_activated.etherializations.clear();

    control.setControlTarget("1");
    control.setPoaMode(State._DISCARDING);

    try
      {
        object.sayHello();
        fail("Expected throwing TRANSIENT, minor 1");
      }
    catch (TRANSIENT ex)
      {
        // OK.
      }
    catch (Exception other)
      {
        fail("Expected TRANSIENT, not " + other);
      }

    try
      {
        other_poa.sayHello();
        try
          {
            other_poa.throwException(555);
            fail("Must throw exception");
          }
        catch (ourUserException ex)
          {
            assertEquals("Exception code", 555, ex.ourField);
View Full Code Here

  public void testExceptions()
  {
    for (int i = 0; i < allServants.length; i++)
      {
        poa_comTester object =
          poa_comTesterHelper.narrow(readIOR(allServants [ i ], orb));
        try
          {
            object.throwException(64);
            fail("User exception is not thrown");
          }
        catch (ourUserException ex)
          {
            assertEquals("Wrong field in user exception.", 64, ex.ourField);
          }

        try
          {
            object.throwException(-1);
            fail("System exception is not thrown");
          }
        catch (BAD_OPERATION ex)
          {
            assertEquals("SysEx minor code", 456, ex.minor);
View Full Code Here

      }
  }

  public void testRedirectionWithActivator()
  {
    poa_comTester r =
      poa_comTesterHelper.narrow(readIOR("willRedirActivator.txt", orb));

    // Ensure the repetetive calls are also redirected.
    for (int i = 0; i < 5; i++)
      {
        String s = r.sayHello();
        assertEquals("Redir with activator", "{redirection handler} 7 7 7 ", s);
      }
  }
View Full Code Here

      }
  }

  public void testRedirectionWithLocator()
  {
    poa_comTester r =
      poa_comTesterHelper.narrow(readIOR("willRedirLocator.txt", orb));

    // Ensure the repetetive calls are also redirected.
    for (int i = 0; i < 5; i++)
      {
        String s = r.sayHello();
        assertEquals("Redir with locator", "{redirection handler} 7 7 7 ", s);
      }
  }
View Full Code Here

TOP

Related Classes of gnu.testlet.org.omg.PortableServer.POAOperations.communication.poa_comTester

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.