Package org.exolab.jms.net.orb

Examples of org.exolab.jms.net.orb.ORB


     *
     * @throws Exception for any error
     */
    public void testClientDisconnect() throws Exception {
        Latch latch = new Latch();
        ORB server = getORB();
        CallbackServer serviceImpl = new CallbackServer(server, latch);

        Proxy proxy = server.exportObject(serviceImpl);
        server.getRegistry().bind("service", proxy);

        ORB client = getClientORB();
        Registry registry = client.getRegistry(getConnectionProperties());
        CallbackService service = (CallbackService) registry.lookup("service");

        LoggingCallback callback = new LoggingCallback();
        Callback callbackProxy = (Callback) client.exportObjectTo(callback,
                                                                  getServerURI());
        service.addCallback(callbackProxy);

        assertNull(serviceImpl.getException());
        client.shutdown();

        if (!latch.attempt(10 * 1000)) {
            fail("CallerListener not notified of disconnection");
        }
        assertNull(serviceImpl.getException());
View Full Code Here


            public void disconnected(Caller caller) {
                latch.release();
            }
        };

        ORB server = getORB();
        CallbackServer serviceImpl = new CallbackServer(server, latch);

        Proxy proxy = server.exportObject(serviceImpl);
        server.getRegistry().bind("service", proxy);

        ORB client = getClientORB();
        client.addCallerListener(getServerURI(), listener);

        Registry registry = getRegistry(); // will establish a connection
        assertNotNull(registry);
        CallbackService service = (CallbackService) registry.lookup("service");
        assertNotNull(service);
View Full Code Here

     *
     * @throws Exception for any error
     */
    public void testCallback() throws Exception {
        final int count = 10;
        ORB client = getClientORB();
        Registry registry = client.getRegistry(getConnectionProperties());
        CallbackService service =
                (CallbackService) registry.lookup(CALLBACK_SERVICE);

        LoggingCallback callback = new LoggingCallback();
        Callback proxy = (Callback) client.exportObjectTo(callback,
                                                          getServerURI());
        service.addCallback(proxy);

        for (int i = 0; i < count; ++i) {
            _service.invoke(new Integer(i));
View Full Code Here

     */
    public void testRecursion() throws Exception {
        final int count = 10;
        final int depth = 4; // recursion depth

        ORB client = getClientORB();
        Registry registry = client.getRegistry(getConnectionProperties());
        CallbackService service =
                (CallbackService) registry.lookup(CALLBACK_SERVICE);

        RecursiveCallback callback = new RecursiveCallback(service, depth);
        Callback proxy = (Callback) client.exportObjectTo(callback,
                                                          getServerURI());
        service.addCallback(proxy);

        for (int i = 0; i < count; ++i) {
            _service.invoke(new Integer(i));
View Full Code Here

     * <code>ExportException</code> when there is no current caller.
     *
     * @throws Exception for any error
     */
    public void testExportObjectToNoCaller() throws Exception {
        ORB orb = getORB();
        EchoServiceImpl impl = new EchoServiceImpl();
        try {
            orb.exportObjectTo(impl);
            fail("Expected exportObjectTo() to fail with ExportException");
        } catch (ExportException expected) {
            // expected behaviour
        }
    }
View Full Code Here

     * @throws Exception for any error
     */
    private void checkExportObject(BasicPrincipal principal)
            throws Exception {
        Authenticator authenticator = new TestAuthenticator(principal);
        ORB orb = createORB(authenticator);
        EchoServiceImpl impl = new EchoServiceImpl();
        Proxy proxy = orb.exportObject(impl);
        orb.getRegistry().bind("service", proxy);

        Registry registry = getRegistry(principal);
        EchoService service = (EchoService) registry.lookup("service");

        assertTrue(service.echoBoolean(true));
View Full Code Here

     * @throws Exception for any error
     */
    private void checkExportObjectURI(BasicPrincipal principal)
            throws Exception {
        Authenticator authenticator = new TestAuthenticator(principal);
        ORB orb = createORB(authenticator);
        EchoServiceImpl impl = new EchoServiceImpl();
        Proxy proxy = orb.exportObject(impl, getExportURI());
        orb.getRegistry().bind("service", proxy);

        Registry registry = getRegistry(principal);
        EchoService service = (EchoService) registry.lookup("service");

        assertTrue(service.echoBoolean(true));
View Full Code Here

     * @throws Exception for any error
     */
    private void checkExportObjectTo(BasicPrincipal principal)
            throws Exception {
        Authenticator authenticator = new TestAuthenticator(principal);
        ORB orb = createORB(authenticator);
        EchoServiceImpl echoImpl = new EchoServiceImpl();

        ExportServiceImpl exporterImpl = new ExportServiceImpl(echoImpl, orb);
        Proxy proxy = orb.exportObject(exporterImpl);
        orb.getRegistry().bind("service", proxy);

        Registry registry = getRegistry(principal);
        ExportService exporter = (ExportService) registry.lookup("service");
        EchoService echoer = (EchoService) exporter.exportObjectTo();

View Full Code Here

            user = principal.getName();
            password = principal.getPassword();
        }

        Authenticator authenticator = new TestAuthenticator(principal);
        ORB orb = createORB(authenticator);

        CallbackService serviceImpl = new CallbackServiceImpl();
        Proxy proxy = orb.exportObject(serviceImpl);
        orb.getRegistry().bind("service", proxy);

        ORB client = getClientORB();
        Registry registry = getRegistry(principal);
        CallbackService service = (CallbackService) registry.lookup("service");

        LoggingCallback callback = new LoggingCallback();
        Callback callbackProxy = (Callback) client.exportObjectTo(
                callback, getServerURI(), user, password);
        service.addCallback(callbackProxy);

        for (int i = 0; i < count; ++i) {
            service.invoke(new Integer(i));
        }

        Integer[] objects = (Integer[]) callback.getObjects().toArray(
                new Integer[0]);
        assertEquals(count, objects.length);
        for (int i = 0; i < count; ++i) {
            assertEquals(i, objects[i].intValue());
        }

        client.unexportObject(callback);
        try {
            service.invoke(new Integer(0));
        } catch (RemoteInvocationException expected) {
            // expected behaviour
            assertTrue(expected.getTargetException()
View Full Code Here

     * @throws Exception for any error
     */
    protected void setUp() throws Exception {
        super.setUp();

        ORB server = getORB();
        Proxy proxy = server.exportObject(_service);
        server.getRegistry().bind(CALLBACK_SERVICE, proxy);
    }
View Full Code Here

TOP

Related Classes of org.exolab.jms.net.orb.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.