Package net.jini.iiop

Examples of net.jini.iiop.IiopExporter


                + "IiopExporter:");

        switch (cType) {
        case NOARG_FACTORY:
            logger.log(Level.FINE, "        IiopExporter()");
            return new IiopExporter();
        case ORB_FACTORY:
            logger.log(Level.FINE, "        IiopExporter(" + orb + ")");
            return new IiopExporter(orb);
        default:
            throw new java.lang.AssertionError(
                    "ERROR: unknown type of constructor " + cType
                    + " for constructing IiopExporter in createIiopExporter"
                    + " method.");
View Full Code Here


public class NonIiopExport {
    public static void main(String[] args) throws Exception {
  ORB orb = ORB.init(new String[0], null);
  EchoImpl impl = new EchoImpl();
  try {
      new IiopExporter().export(impl);
      throw new Error();
  } catch (ExportException ex) {
  }
  try {
      new IiopExporter(orb).export(impl);
      throw new Error();
  } catch (ExportException ex) {
  }
  orb.destroy();
    }
View Full Code Here

      // tnameserv writes to stdout once started
      tnameserv.getInputStream().read();
      try { Thread.sleep(1000); } catch (InterruptedException ex) {}

      InitialContext context = new InitialContext();
      IiopExporter exporter = new IiopExporter();
      EchoImpl impl = new EchoImpl();
      context.bind("echo", exporter.export(impl));
      Echo stub = (Echo) context.lookup("echo");

      for (int i = 0; i < REPS; i++) {
    if (stub.echo(i) != i) {
        throw new Error();
    }
      }
      if (!exporter.unexport(true)) {
    throw new Error();
      }
      try {
    stub.echo(0);
    throw new Error();
View Full Code Here

public class ConnectedExport {
    public static void main(String[] args) throws Exception {
  final int REPS = 100;
  ORB orb = ORB.init(new String[0], null);
  IiopExporter exporter = new IiopExporter(orb);
  EchoImpl impl = new EchoImpl();
  Echo stub = (Echo) exporter.export(impl);
  for (int i = 0; i < REPS; i++) {
      if (stub.echo(i) != i) {
    throw new Error();
      }
  }
  if (!exporter.unexport(true)) {
      throw new Error();
  }
  try {
      stub.echo(0);
      throw new Error();
View Full Code Here

                + "IiopExporter:");

        switch (cType) {
        case NOARG_FACTORY:
            logger.log(Level.FINE, "        IiopExporter()");
            return new IiopExporter();
        case ORB_FACTORY:
            logger.log(Level.FINE, "        IiopExporter(" + orb + ")");
            return new IiopExporter(orb);
        default:
            throw new java.lang.AssertionError(
                    "ERROR: unknown type of constructor " + cType
                    + " for constructing IiopExporter in createIiopExporter"
                    + " method.");
View Full Code Here

    /**
     * This method performs all actions mentioned in class description.
     *
     */
    public void run() throws Exception {
        IiopExporter ie = createIiopExporter();
        TestRemoteObject tro1 = new TestRemoteObject("TestObject1");
        TestRemoteObject tro2 = new TestRemoteObject("TestObject2");
        ie.export(tro1);

        try {
            ie.export(tro1);

            // FAIL
            throw new TestException(
                    "IllegalStateException has not been thrown during "
                    + "second invocation of export method with the same "
                    + tro1 + " as a parameter.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.log(Level.FINE,
                    "IllegalStateException has been thrown during "
                    + "second invocation of export method with the same "
                    + tro1 + " as a parameter as expected.");
        }

        try {
            ie.export(tro2);

            // FAIL
            throw new TestException(
                    "IllegalStateException has not been thrown "
                    + "during invocation of export method with another"
                    + tro2 + " as a parameter.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.log(Level.FINE,
                    "IllegalStateException has been thrown "
                    + "during invocation of export method with another "
                    + tro2 + " as a parameter as expected.");
        }

        // unexport test object
        ie.unexport(true);

        try {
            ie.export(tro2);

            // FAIL
            throw new TestException(
                    "IllegalStateException has not been thrown "
                    + "during invocation of export method after unexport "
View Full Code Here

    /**
     * This method performs all actions mentioned in class description.
     *
     */
    public void run() throws Exception {
        IiopExporter ie = createIiopExporter();

        try {
            ie.export(null);

            // FAIL
            throw new TestException(
                    "NullPointerException has not been thrown "
                    + "during invocation of export method with "
View Full Code Here

     *
     */
    public void run() throws Exception {
        int i;
        int res;
        IiopExporter ie = createIiopExporter();
        TestRemoteObject tro = new TestRemoteObject();
        TestRemoteInterface stub;
        logger.log(Level.FINE,
                "Invoke export method of constructed IiopExporter with "
                + tro + " object as a parameter.");
        stub = (TestRemoteInterface) ie.export(tro);

        // PASS
        logger.log(Level.FINE,
                "Export method did not throw any exceptions "
                + "as expected.");

        // connect stub to the ORB manually if needed
        if ((cType == NOARG_FACTORY) || useNullOrb) {
            connectStub(stub);
        }

        for (i = 0; i < 5; ++i) {
            res = stub.incr(i);

            // PASS
            logger.log(Level.FINE,
                    "Incr method with " + i + " as a parameter did not "
                    + " throw any exceptions as expected.");

            if (res != (i + 1)) {
                // FAIL
                throw new TestException(
                        "performed incr method invocation with " + i
                        + " as a parameter returned " + res
                        + " while " + (i + 1) + " is expected.");
            } else {
                // PASS
                logger.log(Level.FINE,
                        "Performed incr method with " + i
                        + " as a parameter returned " + res
                        + " as expected.");
            }
        }
        ie.unexport(true);

        // PASS
        logger.log(Level.FINE,
                "Unexport method did not throw any exceptions "
                + "as expected.");
View Full Code Here

    /**
     * This method performs all actions mentioned in class description.
     *
     */
    public void run() throws Exception {
        IiopExporter ie1 = createIiopExporter();

        try {
            ie1.unexport(true);

            // FAIL
            throw new TestException(
                    "IllegalStateException has not been thrown "
                    + "during invocation of unexport method with "
                    + "true as a parameter when no objects were previously "
                    + "exported via this IiopExporter1.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.log(Level.FINE,
                    "IllegalStateException has been thrown "
                    + "during invocation of unexport method with "
                    + "true as a parameter of IiopExporter1 as expected.");
        }

        try {
            ie1.unexport(false);

            // FAIL
            throw new TestException(
                    "IllegalStateException has not been thrown "
                    + "during invocation of unexport method with "
                    + "false as a parameter when no objects were "
                    + "previously exported via this IiopExporter1.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.log(Level.FINE,
                    "IllegalStateException has been thrown "
                    + "during invocation of unexport method with "
                    + "false as a parameter of IiopExporter1 as expected.");
        }
        IiopExporter ie2 = createIiopExporter();

        try {
            ie2.unexport(false);

            // FAIL
            throw new TestException(
                    "IllegalStateException has not been thrown "
                    + "during invocation of unexport method with "
                    + "false as a parameter when no objects were previously"
                    + " exported via this IiopExporter2.");
        } catch (IllegalStateException ise) {
            // PASS
            logger.log(Level.FINE,
                    "IllegalStateException has been thrown "
                    + "during invocation of unexport method with "
                    + "false as a parameter of IiopExporter2 as expected.");
        }

        try {
            ie2.unexport(true);

            // FAIL
            throw new TestException(
                    "IllegalStateException has not been thrown "
                    + "during invocation of unexport method with "
View Full Code Here

    /**
     * This method performs all actions mentioned in class description.
     *
     */
    public void run() throws Exception {
        IiopExporter ie1 = createIiopExporter();
        TestRemoteObject tro = new TestRemoteObject();
        ie1.export(tro);
        logger.log(Level.FINE,
                "Invoke unexport method of constructed"
                + " IiopExporter1 with 'true' value...");
        boolean uRes = ie1.unexport(true);

        if (!uRes) {
            // FAIL
            throw new TestException(
                    "performed unexport method invocation of constructed "
                    + "IiopExporter1 with 'true' value has returned false "
                    + "while true is expected.");
        } else {
            // PASS
            logger.log(Level.FINE, "Method returned true as expected.");
        }
        logger.log(Level.FINE,
                "Invoke unexport method of constructed"
                + " IiopExporter1 with 'true' value again...");
        uRes = ie1.unexport(true);

        if (!uRes) {
            // FAIL
            throw new TestException(
                    "performed unexport method invocation of constructed "
                    + "IiopExporter1 with 'true' value again has returned "
                    + "false while true is expected.");
        } else {
            // PASS
            logger.log(Level.FINE, "Method returned true as expected.");
        }
        logger.log(Level.FINE,
                "Invoke unexport method of constructed"
                + " IiopExporter1 with 'false' value...");
        uRes = ie1.unexport(false);

        if (!uRes) {
            // FAIL
            throw new TestException(
                    "performed unexport method invocation of constructed "
                    + "IiopExporter1 with 'false' value has returned false "
                    + "while true is expected.");
        } else {
            // PASS
            logger.log(Level.FINE, "Method returned true as expected.");
        }
        IiopExporter ie2 = createIiopExporter();
        ie2.export(tro);
        logger.log(Level.FINE,
                "Invoke unexport method of constructed"
                + " IiopExporter2 with 'false' value...");
        uRes = ie2.unexport(false);

        if (!uRes) {
            // FAIL
            throw new TestException(
                    "performed unexport method invocation of constructed "
                    + "IiopExporter2 with 'false' value has returned false "
                    + "while true is expected.");
        } else {
            // PASS
            logger.log(Level.FINE, "Method returned true as expected.");
        }
        logger.log(Level.FINE,
                "Invoke unexport method of constructed"
                + " IiopExporter2 with 'false' value again...");
        uRes = ie2.unexport(false);

        if (!uRes) {
            // FAIL
            throw new TestException(
                    "performed unexport method invocation of constructed "
                    + "IiopExporter2 with 'false' value again has returned "
                    + "false while true is expected.");
        } else {
            // PASS
            logger.log(Level.FINE, "Method returned true as expected.");
        }
        logger.log(Level.FINE,
                "Invoke unexport method of constructed"
                + " IiopExporter2 with 'true' value...");
        uRes = ie2.unexport(true);

        if (!uRes) {
            // FAIL
            throw new TestException(
                    "performed unexport method invocation of constructed "
                    + "IiopExporter2 with 'true' value has returned false "
                    + "while true is expected.");
        } else {
            // PASS
            logger.log(Level.FINE, "Method returned true as expected.");
        }
        IiopExporter ie3 = createIiopExporter();
        TestRemoteInterface stub = (TestRemoteInterface) ie3.export(tro);

        // bind stub to the ORB manually if needed
        if ((cType == NOARG_FACTORY) || useNullOrb) {
            connectStub(stub);
        }
        Unexporter u = new Unexporter(ie3, false);
        logger.log(Level.FINE,
                "Start thread which will invoke unexport method"
                + " of constructed IiopExporter3 with 'false' value...");
        u.start();
        stub.wait(new Integer(5000));
        uRes = u.getResult();

        if (!uRes) {
            // FAIL
            throw new TestException(
                    "performed unexport method invocation of constructed "
                    + "IiopExporter3 with 'false' value while remote "
                    + "call is in progress has returned false "
                    + "while true is expected.");
        } else {
            // PASS
            logger.log(Level.FINE, "Method returned true as expected.");
        }
        IiopExporter ie4 = createIiopExporter();
        stub = (TestRemoteInterface) ie4.export(tro);

        // bind stub to the ORB manually if needed
        if ((cType == NOARG_FACTORY) || useNullOrb) {
            connectStub(stub);
        }
View Full Code Here

TOP

Related Classes of net.jini.iiop.IiopExporter

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.