Package javax.naming

Examples of javax.naming.InitialContext.list()


   * This returns an enumeration of component id -> component class name pairs
   */
  @Test
  public void testList() throws Exception {
    InitialContext ctx = new InitialContext();
    NamingEnumeration<NameClassPair> compList = ctx.list("blueprint:comp");
   
    Set<String> expectedCompIds = new BlueprintContainerStub().getComponentIds();
    while (compList.hasMore()) {
      NameClassPair ncp = compList.next();
      String compId = ncp.getName();
View Full Code Here


   */
  public void listRepositoryContents() throws NamingException
  {
    InitialContext ctx = new InitialContext();
   
    NamingEnumeration<NameClassPair> serviceList = ctx.list("aries:services/java.lang.Runnable/(rubbish=smelly)");
   
    checkThreadRetrievedViaListMethod(serviceList);
   
    assertFalse("The repository contained more objects than we expected", serviceList.hasMoreElements());
   
View Full Code Here

   
    //Now add a second service
   
    registerService(new Thread());
   
    serviceList = ctx.list("aries:services/java.lang.Runnable/(rubbish=smelly)");
   
    checkThreadRetrievedViaListMethod(serviceList);
   
    checkThreadRetrievedViaListMethod(serviceList);
   
View Full Code Here

    reg.unregister();
   
    ServiceRegistration reg = bc.registerService(className, t, null);
    ServiceRegistration reg2 = bc.registerService(className, new Thread(), null);
   
    NamingEnumeration<NameClassPair> ne = ctx.list("osgi:servicelist/" + className);
   
    assertTrue(ne.hasMoreElements());
   
    NameClassPair ncp = ne.nextElement();
   
View Full Code Here

    */
   public void testListing() throws Exception
   {
      log.debug("+++ testListing");
      InitialContext ctx = getInitialContext();
      NamingEnumeration names = ctx.list("");
      int count = 0;
      while( names.hasMore() )
      {
         NameClassPair ncp = (NameClassPair) names.next();
         log.info(ncp);
View Full Code Here

  public void contextInitialized(ServletContextEvent sce) {
   try {
      InitialContext ctx = new InitialContext();
      boolean present = false;
      try {
        NamingEnumeration<NameClassPair> entries = ctx.list(RESOURCES_CONTEXT);
        while (entries.hasMoreElements()) {
          try {
            NameClassPair e = entries.next();
            if (e.getName().equals(BEAN_MANAGER_JNDI_NAME) && e.getClassName().equals(BeanManager.class)) {
              present = true;
View Full Code Here

    public void contextInitialized(ServletContextEvent sce) {
        try {
            InitialContext ctx = new InitialContext();
            boolean present = false;
            try {
                NamingEnumeration<NameClassPair> entries = ctx.list(RESOURCES_CONTEXT);
                while (entries.hasMoreElements()) {
                    try {
                        NameClassPair e = entries.next();
                        if (e.getName().equals(BEAN_MANAGER_JNDI_NAME) && e.getClassName().equals(BeanManager.class)) {
                            present = true;
View Full Code Here

            //test java:/comp/env/stuff
            assertEquals ("xyz", initCtx.lookup("java:/comp/env/poubelle/"));

            //test list Names
            NamingEnumeration nenum = initCtx.list ("java:comp/env");
            HashMap results = new HashMap();
            while (nenum.hasMore())
            {
                NameClassPair ncp = (NameClassPair)nenum.next();
                results.put (ncp.getName(), ncp.getClassName());
View Full Code Here

            assertEquals ("javax.naming.LinkRef", results.get("poubelle"));
            assertEquals ("java.lang.String", results.get("mullheim"));
            assertEquals ("javax.naming.Reference", results.get("quatsch"));

            //test list Bindings
            NamingEnumeration benum = initCtx.list("java:comp/env");
            assertEquals (4, results.size());

            //test NameInNamespace
            assertEquals ("comp/env", sub2.getNameInNamespace());
View Full Code Here

            Properties props = new Properties();
            props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
            props.put("java.naming.provider.url", "ejbd://127.0.0.1:" + port);
            Context context = new InitialContext(props);

            assertNameClassPair(context.list(""));
            assertNameClassPair(context.list("ejb"));

            assertBindings(context.listBindings(""));
            assertBindings(context.listBindings("ejb"));
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.