Package org.apache.harmony.jndi.tests.javax.naming.spi.mock

Examples of org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockContext


        mockAddr = new MockRefAddr(null, "dire://www.apache.org/");
        r.add(mockAddr);
        Attributes a = new BasicAttributes();

        Object obj = DirectoryManager.getObjectInstance(r, new CompositeName(
                "compositename"), new MockContext(new Hashtable<String, String>()), env, a);
        assertSame(obj, r);
    }
View Full Code Here


        r.add(nullTypeAddr);
        Attributes a = new BasicAttributes();

        try {
            DirectoryManager.getObjectInstance(r,
                    new CompositeName("compositename"), new MockContext(
                            new Hashtable<String, String>()), env, a);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
            //
        }

        // test Referenceable
        MockReferenceable mr = new MockReferenceable(r);
        try {
            DirectoryManager.getObjectInstance(mr,
                    new CompositeName("compositename"), new MockContext(
                            new Hashtable<String, String>()), env, a);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
            //
        }
View Full Code Here

                "dire://www.apache.org/");
        r.add(validFactoryAddr);
        Attributes a = new BasicAttributes();
        Hashtable<String, String> temp = new Hashtable<String, String>();
        temp.put("mockkey", "mockobj");
        MockContext c = new MockContext(temp);
        Name n = new CompositeName("compositename");

        MockDirContext3 ctx = (MockDirContext3) DirectoryManager
                .getObjectInstance(r, n, c, env, a);
View Full Code Here

            // "tests.api.javax.naming.spi.dummy",
            // ctxEnv);
            try {
                NamingManagerTest.indicateNullPointerException(env);
                DirectoryManager.getObjectInstance(r,
                        new CompositeName("compositename"), new MockContext(
                                ctxEnv), env, a);
                fail("Should throw NamingException.");
            } catch (NamingException e) {
                assertTrue(e.getRootCause() instanceof NullPointerException);
            }

            // test Referenceable
            MockReferenceable mr = new MockReferenceable(r);
            try {
                NamingManagerTest.indicateNamingException(env);
                DirectoryManager
                        .getObjectInstance(mr, new CompositeName(
                                "compositename"), new MockContext(ctxEnv), env,
                                a);

                fail("Should throw NamingException.");
            } catch (NamingException e) {
                assertNull(e.getRootCause());
View Full Code Here

                    "org.apache.harmony.jndi.tests.javax.naming.spi.dummy", ctxEnv);
            Attributes a = new BasicAttributes();
            try {
                NamingManagerTest.indicateNullPointerException(ctxEnv);
                DirectoryManager.getObjectInstance(r,
                        new CompositeName("compositename"), new MockContext(
                                ctxEnv), ctxEnv, a);
                fail("Should throw NamingException.");
            } catch (NamingException e) {
                assertTrue(e.getRootCause() instanceof NullPointerException);
            }

            // test Referenceable
            MockReferenceable mr = new MockReferenceable(r);
            try {
                NamingManagerTest.indicateNamingException(ctxEnv);
                DirectoryManager
                        .getObjectInstance(mr, new CompositeName(
                                "compositename"), new MockContext(ctxEnv),
                                ctxEnv, a);
                fail("Should throw NamingException.");
            } catch (NamingException e) {
                assertNull(e.getRootCause());
            }
View Full Code Here

                            "org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockDirObjectFactoryNoException");
            ctxEnv.put(Context.URL_PKG_PREFIXES,
                    "org.apache.harmony.jndi.tests.javax.naming.spi.mock");
            NamingManagerTest.writeProviderResource(
                    "org.apache.harmony.jndi.tests.javax.naming.spi.dummy", ctxEnv);
            Context ctx = new MockContext(ctxEnv);
            Attributes a = new BasicAttributes();
            assertGetObjectResult("Junk", new CompositeName("compositeName"),
                    ctx, env, a);
        } finally {
            NamingManagerTest.writeProviderResource(
View Full Code Here

            ctxEnv.put(Context.URL_PKG_PREFIXES,
                    "org.apache.harmony.jndi.tests.javax.naming.spi.mock");
            NamingManagerTest.writeProviderResource(
                    "org.apache.harmony.jndi.tests.javax.naming.spi.dummy", ctxEnv);
            Attributes a = new BasicAttributes();
            Context ctx = new MockContext(ctxEnv);

            Hashtable<String, String> env = new Hashtable<String, String>();
            /*
             * env.put( Context.INITIAL_CONTEXT_FACTORY,
             * "dazzle.jndi.testing.spi.DazzleContextFactory");
 
View Full Code Here

        try {
            Hashtable<String, String> ctxEnv = new Hashtable<String, String>();
            NamingManagerTest.writeProviderResource(
                    "org.apache.harmony.jndi.tests.javax.naming.spi.dummy", ctxEnv);

            Context ctx = new MockContext(ctxEnv);

            Hashtable<String, String> env = new Hashtable<String, String>();
            env
                    .put(Context.URL_PKG_PREFIXES,
                            "org.apache.harmony.jndi.tests.javax.naming.spi.mock");
View Full Code Here

    public void testGetStateToBind_f1BadClassName_Success() {
       
        Object o = "object";
        Name n = new CompositeName();
        Context c = new MockContext(new Hashtable<String, String>()); // no state factory
        Hashtable<Object, Object> h = new Hashtable<Object, Object>();
        Attributes a = null;
        h.put(Context.STATE_FACTORIES, "bad.class.Name" + ":"
                + "org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockDirStateFactory");
View Full Code Here

    public void testGetStateToBind_f1ReturnNull_Success() {
       
        Object o = "object";
        Name n = new CompositeName();
        Context c = new MockContext(new Hashtable<String, String>()); // no state factory
        Hashtable<Object, Object> h = new Hashtable<Object, Object>();
        Attributes a = null;
        h
                .put(
                        Context.STATE_FACTORIES,
View Full Code Here

TOP

Related Classes of org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockContext

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.