2 Replies Latest reply on Sep 18, 2012 11:04 AM by Jesper Pedersen

    Accessing JCA from junit testcase

    Dimitri Bouras Newbie

      I have deployed the HelloWorld example provided by ironjacamar on jboss 7.1.

      I would like to call it from a junit test  is this possible?

       

       

      private static final String INITIAL_CONTEXT_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory";
          private static final String PROVIDER_URL = "remote://localhost:4447";
        
                @Test
                public void testHelloWorldNoArgs() throws Throwable {
      
      
        
                           final Properties env = new Properties();
               env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
               env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, PROVIDER_URL));
      
      
               final InitialContext context = new InitialContext(env);
               
                          final Object ref = context.lookup("java:/eis/HelloWorld");
                          System.out.println("echo, ra/DirContextFactory=" + ref);
      
      
                          final HelloWorldConnectionFactory dcf = (HelloWorldConnectionFactory) ref;
                          System.out.println("echo, found dcf=" + dcf);
      
      
                          final HelloWorldConnection dc = dcf.getConnection();
                          System.out.println("echo, lookup dc=" + dc);
                          dc.helloWorld("Dimtris");
                          dc.close();
                          }
      
      

       

      I am getting...

      Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed

       

      Is there any i call the JCA adapter from a nonmaneged enviroment?

       

      thanks in advance