Package javax.naming

Examples of javax.naming.InitialContext.unbind()


            JNDIDataSourceFactory factory = new JNDIDataSourceFactory();
            assertSame(dataSource, factory.getDataSource(descriptor));
        }
        finally {
            // since the context is shared, must clear it after the test
            context.unbind("java:comp/env/" + descriptor.getParameters());
        }
    }

    public void testGetDataSource_NameNotBound() throws Exception {
View Full Code Here


    private void stop() {
        String jndiName = getJndiName();
        if (jndiName != null && jndiName.length() > 0) {
            try {
                Context context = new InitialContext();
                context.unbind(jndiName);
                log.info("JavaMail session unbound from " + jndiName);
            } catch (NamingException e) {
                // we tried... this is a common error which occurs during shutdown due to ordering
            }
        }
View Full Code Here

       
        Object o = ic.lookup("foo");
        assertNotNull(o);
        assertEquals("xxx", (String)o);
       
        ic.unbind("foo");
        try
        {
            ic.lookup("foo");
            fail("Foo exists");
        }
View Full Code Here

    public void release ()
    {
        try
        {
            InitialContext ic = new InitialContext();
            ic.unbind(objectNameString);
            ic.unbind(namingEntryNameString);
            this.jndiName=null;
            this.namingEntryNameString=null;
            this.objectNameString=null;
            this.objectToBind=null;
View Full Code Here

    {
        try
        {
            InitialContext ic = new InitialContext();
            ic.unbind(objectNameString);
            ic.unbind(namingEntryNameString);
            this.jndiName=null;
            this.namingEntryNameString=null;
            this.objectNameString=null;
            this.objectToBind=null;
        }
View Full Code Here

    {
        InitialContext _context = new InitialContext();

        try
        {
            _context.unbind("java:/" + name);
        } finally
        {
            _context.close();
        }
    }
View Full Code Here

        InitialContext context = new InitialContext(new Hashtable(_environment));
       
        try
        {
            context.unbind("COSNotification");
        }
        finally
        {
            context.close();
        }
View Full Code Here

            {
               String bindAddress = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
               env.put(Context.PROVIDER_URL, bindAddress + ":" + getHaJndiPort());
               InitialContext haCtx = new InitialContext(env);
               haCtx.bind("HA_TEST", null);
               haCtx.unbind("HA_TEST");
               haContext = haCtx;
            }
            catch (Exception e)
            {
               log.debug("Unable to access HA JNDI: " + e);
View Full Code Here

      {
         // expected exception
      }
      assertEquals("foo", ctx.lookup(name));
      assertEquals("foo", ctx.lookup("java:comp/env/jdbc/jcr"));
      ctx.unbind(name);
      try
      {
         ctx.lookup(name);
         fail("A NameNotFoundException is expected here");
      }
View Full Code Here

      catch (NameNotFoundException e)
      {
         // expected exception
      }
      assertEquals("test4", ctx.lookup("test"));
      ctx.unbind("test");
      try
      {
         ctx.lookup("test");
         fail("A NameNotFoundException is expected here");
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.