Package org.apache.openejb.client

Examples of org.apache.openejb.client.EJBRequest


    }

    @Test
    public void testGetDeploymentEJBRequest() throws RemoteException {
        final EJBMetaDataImpl ejbMetadataWithId = new EJBMetaDataImpl(null, null, null, null, null, 1, InterfaceType.BUSINESS_REMOTE, null, null);
        final EJBRequest request = new EJBRequest(null, ejbMetadataWithId, method, null, null, null);
        final BeanContext info = deploymentIndex.getDeployment(request);

        Assert.assertEquals(beanContext, info);
        Assert.assertEquals(request.getDeploymentId(), info.getDeploymentID());
    }
View Full Code Here


    @Test(expected = RemoteException.class)
    public void testGetDeploymentEJBRequestRemoteException() throws RemoteException {
        // 0 causes DeploymentIndex to move further
        final EJBMetaDataImpl ejbMetadata = new EJBMetaDataImpl(null, null, null, null, null, 0, InterfaceType.BUSINESS_REMOTE, null, null);
        final EJBRequest request = new EJBRequest(null, ejbMetadata, method, null, null, null);
        deploymentIndex.getDeployment(request);
    }
View Full Code Here

    }

    @Test
    public void testGetDeploymentEJBRequest() throws RemoteException {
        final EJBMetaDataImpl ejbMetadataWithId = new EJBMetaDataImpl(null, null, null, null, null, 1, InterfaceType.BUSINESS_REMOTE, null, null);
        final EJBRequest request = new EJBRequest(null, ejbMetadataWithId, method, null, null);
        final BeanContext info = deploymentIndex.getDeployment(request);

        Assert.assertEquals(beanContext, info);
        Assert.assertEquals(request.getDeploymentId(), info.getDeploymentID());
    }
View Full Code Here

    @Test(expected = RemoteException.class)
    public void testGetDeploymentEJBRequestRemoteException() throws RemoteException {
        // 0 causes DeploymentIndex to move further
        final EJBMetaDataImpl ejbMetadata = new EJBMetaDataImpl(null, null, null, null, null, 0, InterfaceType.BUSINESS_REMOTE, null, null);
        final EJBRequest request = new EJBRequest(null, ejbMetadata, method, null, null);
        deploymentIndex.getDeployment(request);
    }
View Full Code Here

        // Setup the client proxy replacement to replace
        // the proxies with the IntraVM proxy implementations
        EJBHomeProxyHandle.resolver.set(SERVER_SIDE_RESOLVER);
        EJBObjectProxyHandle.resolver.set(SERVER_SIDE_RESOLVER);

        final EJBRequest req = new EJBRequest();
        byte version = req.getVersion();
        final EJBResponse res = new EJBResponse();

        res.start(EJBResponse.Time.TOTAL);

        try {
            req.readExternal(in);
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Bad request");
            return;
        }

        final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
        try {
            final Object clientIdentity = req.getClientIdentity();
            if (clientIdentity != null) {//noinspection unchecked
                securityService.associate(clientIdentity);
            }
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Client identity is not valid - " + req);
            return;
        }

        final CallContext call;
        final BeanContext di;

        try {
            di = this.daemon.getDeployment(req);
        } catch (RemoteException e) {
            replyWithFatalError(version, out, e, "No such deployment");
            return;
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Unkown error occured while retrieving deployment");
            return;
        }

        //  Need to set this for deserialization of the body
        final ClassLoader classLoader = di.getBeanClass().getClassLoader();
        Thread.currentThread().setContextClassLoader(classLoader);

        try {
            res.start(EJBResponse.Time.DESERIALIZATION);

            req.getBody().readExternal(in);
            version = req.getVersion();

            res.stop(EJBResponse.Time.DESERIALIZATION);
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Error caught during request processing");
            return;
        }

        try {
            call = CallContext.getCallContext();
            call.setEJBRequest(req);
            call.setBeanContext(di);
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Unable to set the thread context for this request");
            return;
        }

        res.start(EJBResponse.Time.CONTAINER);
        boolean respond = true;
        try {
            switch (req.getRequestMethod()) {
                // Remote interface methods
                case EJB_OBJECT_BUSINESS_METHOD:
                    doEjbObject_BUSINESS_METHOD(req, res);
                    updateServer(req, res);
                    break;
View Full Code Here

        // Setup the client proxy replacement to replace
        // the proxies with the IntraVM proxy implementations
        EJBHomeProxyHandle.resolver.set(SERVER_SIDE_RESOLVER);
        EJBObjectProxyHandle.resolver.set(SERVER_SIDE_RESOLVER);

        final EJBRequest req = new EJBRequest();
        byte version = req.getVersion();
        final EJBResponse res = new EJBResponse();

        res.start(EJBResponse.Time.TOTAL);

        try {
            req.readExternal(in);
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Bad request");
            return;
        }

        final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
        try {
            final Object clientIdentity = req.getClientIdentity();
            if (clientIdentity != null) {//noinspection unchecked
                securityService.associate(clientIdentity);
            }
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Client identity is not valid - " + req);
            return;
        }

        final CallContext call;
        final BeanContext di;

        try {
            di = this.daemon.getDeployment(req);
        } catch (RemoteException e) {
            replyWithFatalError(version, out, e, "No such deployment");
            return;
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Unkown error occured while retrieving deployment");
            return;
        }

        //  Need to set this for deserialization of the body
        final ClassLoader classLoader = di.getBeanClass().getClassLoader();
        Thread.currentThread().setContextClassLoader(classLoader);

        try {
            res.start(EJBResponse.Time.DESERIALIZATION);

            req.getBody().readExternal(in);
            version = req.getVersion();

            res.stop(EJBResponse.Time.DESERIALIZATION);
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Error caught during request processing");
            return;
        }

        try {
            call = CallContext.getCallContext();
            call.setEJBRequest(req);
            call.setBeanContext(di);
        } catch (Throwable t) {
            replyWithFatalError(version, out, t, "Unable to set the thread context for this request");
            return;
        }

        res.start(EJBResponse.Time.CONTAINER);
        boolean respond = true;
        try {
            switch (req.getRequestMethod()) {
                // Remote interface methods
                case EJB_OBJECT_BUSINESS_METHOD:
                    doEjbObject_BUSINESS_METHOD(req, res);
                    updateServer(req, res);
                    break;
View Full Code Here

    }

    @Test
    public void testGetDeploymentEJBRequest() throws RemoteException {
        EJBMetaDataImpl ejbMetadataWithId = new EJBMetaDataImpl(null, null, null, null, null, 1, InterfaceType.BUSINESS_REMOTE, null, null);
        EJBRequest request = new EJBRequest(null, ejbMetadataWithId, method, null, null);
        BeanContext info = deploymentIndex.getDeployment(request);
        assert beanContext.equals(info);
        assert request.getDeploymentId().equals(info.getDeploymentID());
    }
View Full Code Here

    @Test(expected = RemoteException.class)
    public void testGetDeploymentEJBRequestRemoteException() throws RemoteException {
        // 0 causes DeploymentIndex to move further
        EJBMetaDataImpl ejbMetadata = new EJBMetaDataImpl(null, null, null, null, null, 0, InterfaceType.BUSINESS_REMOTE, null, null);
        EJBRequest request = new EJBRequest(null, ejbMetadata, method, null, null);
        deploymentIndex.getDeployment(request);
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.client.EJBRequest

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.