Package org.apache.openejb.core.ivm.naming

Examples of org.apache.openejb.core.ivm.naming.IvmContext


import static org.junit.Assert.fail;

public class IvmContextTest {
    @Test
    public void unbind() throws NamingException {
        final IvmContext context = new IvmContext();
        context.bind("global/foo/Bar", "Bar");

        assertEquals("Bar", context.lookup("global/foo/Bar"));

        context.unbind("global/foo/Bar");

        try {
            context.lookup("global/foo/Bar");
            fail();
        } catch (NamingException ne) {
            // ok
        }

        try {
            final Context subCtx = (Context) context.lookup("global/foo");
            subCtx.lookup("Bar");
            fail();
        } catch (NamingException ne) {
            // ok
        }
View Full Code Here


        }
    }

    @Test
    public void unbindWithSubContext() throws NamingException {
        final IvmContext context = new IvmContext("");
        context.bind("global/foo/Bar", "Bar");

        Contexts.createSubcontexts(context, "global/foo/Bar").bind("Bar", "Foo");

        assertEquals("Bar", context.lookup("global/foo/Bar"));

        context.unbind("global/foo/Bar");

        try {
            context.lookup("global/foo/Bar");
            fail();
        } catch (NamingException ne) {
            // ok
        }

        try {
            ((Context) ((Context) context.lookup("global")).lookup("foo"))
                .lookup("Bar");
            fail();
        } catch (NamingException ne) {
            // ok
        }
View Full Code Here

                    } // else an error but not that important
                }
            }
            try {
                if (globalContext instanceof IvmContext) {
                    final IvmContext ivmContext = (IvmContext) globalContext;
                    ivmContext.prune("openejb/Deployment");
                    ivmContext.prune("openejb/local");
                    ivmContext.prune("openejb/remote");
                    ivmContext.prune("openejb/global");
                }
            } catch (final NamingException e) {
                undeployException.getCauses().add(new Exception("Unable to prune openejb/Deployments and openejb/local namespaces, this could cause future deployments to fail.",
                    e));
            }
View Full Code Here

        // dumpJndiTree(globalContext, "-->");

        try {
            if (globalContext instanceof IvmContext) {
                final IvmContext ivmContext = (IvmContext) globalContext;
                ivmContext.prune("openejb/Deployment");
                ivmContext.prune("openejb/local");
                ivmContext.prune("openejb/remote");
                ivmContext.prune("openejb/global");
            }
        } catch (NamingException e) {
            undeployException.getCauses().add(new Exception("Unable to prune openejb/Deployments and openejb/local namespaces, this could cause future deployments to fail.", e));
        }
View Full Code Here

        }
        moduleIds.clear();

        try {
            if (globalContext instanceof IvmContext) {
                IvmContext ivmContext = (IvmContext) globalContext;
                ivmContext.prune("openejb/Deployment");
                ivmContext.prune("openejb/local");
                ivmContext.prune("openejb/remote");
                ivmContext.prune("openejb/global");
            }
        } catch (NamingException e) {
            undeployException.getCauses().add(new Exception("Unable to prune openejb/Deployments and openejb/local namespaces, this could cause future deployments to fail.", e));
        }
View Full Code Here

        }
    }

    private BeanContext createDeployment(Class<?> testClass) {
        try {
            return new BeanContext(null, new IvmContext(), new ModuleContext("", null, "", new AppContext("", SystemInstance.get(), testClass.getClassLoader(), new IvmContext(), new IvmContext(), false), new IvmContext()), testClass, null, null, null, null, null, null, null, null, null, BeanType.MANAGED, false);
        } catch (SystemException e) {
            throw new IllegalStateException(e);
        }
    }
View Full Code Here

        // dumpJndiTree(globalContext, "-->");

        try {
            if (globalContext instanceof IvmContext) {
                IvmContext ivmContext = (IvmContext) globalContext;
                ivmContext.prune("openejb/Deployment");
                ivmContext.prune("openejb/local");
                ivmContext.prune("openejb/remote");
                ivmContext.prune("openejb/global");
            }
        } catch (NamingException e) {
            undeployException.getCauses().add(new Exception("Unable to prune openejb/Deployments and openejb/local namespaces, this could cause future deployments to fail.", e));
        }
View Full Code Here

TOP

Related Classes of org.apache.openejb.core.ivm.naming.IvmContext

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.