Tabnine Logo
TestRemote
Code IndexAdd Tabnine to your IDE (free)

How to use
TestRemote
in
ch.inftec.ju.ee.test

Best Java code snippets using ch.inftec.ju.ee.test.TestRemote (Showing top 8 results out of 315)

origin: ch.inftec.ju/ju-ee

/**
 * Note that the remote naming tests were not really using the properties submitted to them
 * by the Properties instance. Instead, the file jboss-ejb-client.properties was read, same as
 * with the EJB Client API...
 * @throws Exception
 */
@Ignore("PR-285 Not working with WildFly 10, didn't investigate further. We probably don't need this...")
@Test
public void canLookup_testFacadeBean_usingRemoteNaming() throws Exception {
  // https://docs.jboss.org/author/display/AS72/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project
  
  Properties jndiProps = new Properties();
  jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
  jndiProps.put(Context.PROVIDER_URL, "remote://localhost:14447");
  // jndiProps.put("remote.connection.default.port", "8080");
  // create a context passing these properties
  Context ctx = new InitialContext(jndiProps);
  // Important: We can either use 'java:' as prefix or none
  TestRemote testRemote = (TestRemote) ctx.lookup("test/TestRemoteInterfaceBean!" + TestRemote.class.getName());
  Assert.assertEquals("TestRemoteBean says hello to RemoteNamingWithoutPrefix", testRemote.getGreeting("RemoteNamingWithoutPrefix"));
  
  testRemote = (TestRemote) ctx.lookup("java:ee-ear-ear/ee-ear-ejb/TestRemoteBean!" + TestRemote.class.getName());
  Assert.assertEquals("TestRemoteBean says hello to RemoteNaming", testRemote.getGreeting("RemoteNaming"));
}

origin: ch.inftec.ju/ju-ee-testing

/**
 * Note that the remote naming tests were not really using the properties submitted to them
 * by the Properties instance. Instead, the file jboss-ejb-client.properties was read, same as
 * with the EJB Client API...
 * @throws Exception
 */
@Ignore("PR-285 Not working with WildFly 10, didn't investigate further. We probably don't need this...")
@Test
public void canLookup_testFacadeBean_usingRemoteNaming() throws Exception {
  // https://docs.jboss.org/author/display/AS72/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project
  
  Properties jndiProps = new Properties();
  jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
  jndiProps.put(Context.PROVIDER_URL, "remote://localhost:14447");
  // jndiProps.put("remote.connection.default.port", "8080");
  // create a context passing these properties
  Context ctx = new InitialContext(jndiProps);
  // Important: We can either use 'java:' as prefix or none
  TestRemote testRemote = (TestRemote) ctx.lookup("test/TestRemoteInterfaceBean!" + TestRemote.class.getName());
  Assert.assertEquals("TestRemoteBean says hello to RemoteNamingWithoutPrefix", testRemote.getGreeting("RemoteNamingWithoutPrefix"));
  
  testRemote = (TestRemote) ctx.lookup("java:ee-ear-ear/ee-ear-ejb/TestRemoteBean!" + TestRemote.class.getName());
  Assert.assertEquals("TestRemoteBean says hello to RemoteNaming", testRemote.getGreeting("RemoteNaming"));
}

origin: ch.inftec.ju/ju-ee

Assert.assertEquals("TestRemoteBean says hello to EjbClientApi", testRemote.getGreeting("EjbClientApi"));
origin: ch.inftec.ju/ju-ee

  @Test
  public void canLookup_testFacadeBean_usingEjbClientApi_withoutFile() throws Exception {
    // Set EJB Client API properties programmatically instead of using
    // jboss-ejb-client.properties file
    Properties clientProp = new Properties();
    clientProp.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
    clientProp.put("remote.connections", "default");
    clientProp.put("remote.connection.default.port", "18080");
    clientProp.put("remote.connection.default.host", "localhost");
//        clientProp.put("remote.connection.default.username", "ejbUser");
//        clientProp.put("remote.connection.default.password", "ejbPassword");
    clientProp.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

    // Set selector (avoiding usage of jboss-ejb-client.properties file)
    EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(clientProp);
    ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);
    EJBClientContext.setSelector(selector);
         final Hashtable<String, String> jndiProperties = new Hashtable<>();
//        jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:14447");
    jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
    final Context context = new InitialContext(jndiProperties);
    
    // Important: We need to use the 'ejb:' prefix...
    TestRemote testRemote = (TestRemote) context.lookup("ejb:/test//TestRemoteInterfaceBean!" + TestRemote.class.getName());
    Assert.assertEquals("TestRemoteBean says hello to EjbClientApi", testRemote.getGreeting("EjbClientApi"));
  }
  
origin: ch.inftec.ju/ju-ee-testing

Assert.assertEquals("TestRemoteBean says hello to EjbClientApi", testRemote.getGreeting("EjbClientApi"));
origin: ch.inftec.ju/ju-ee-testing

  @Test
  public void canLookup_testFacadeBean_usingEjbClientApi_withoutFile() throws Exception {
    // Set EJB Client API properties programmatically instead of using
    // jboss-ejb-client.properties file
    Properties clientProp = new Properties();
    clientProp.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
    clientProp.put("remote.connections", "default");
    clientProp.put("remote.connection.default.port", "18080");
    clientProp.put("remote.connection.default.host", "localhost");
//        clientProp.put("remote.connection.default.username", "ejbUser");
//        clientProp.put("remote.connection.default.password", "ejbPassword");
    clientProp.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

    // Set selector (avoiding usage of jboss-ejb-client.properties file)
    EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(clientProp);
    ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);
    EJBClientContext.setSelector(selector);
         final Hashtable<String, String> jndiProperties = new Hashtable<>();
//        jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:14447");
    jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
    final Context context = new InitialContext(jndiProperties);
    
    // Important: We need to use the 'ejb:' prefix...
    TestRemote testRemote = (TestRemote) context.lookup("ejb:/test//TestRemoteInterfaceBean!" + TestRemote.class.getName());
    Assert.assertEquals("TestRemoteBean says hello to EjbClientApi", testRemote.getGreeting("EjbClientApi"));
  }
  
origin: ch.inftec.ju/ju-ee

  @Test
  public void canLookup_testFacadeBean_usingServiceLocatorBuilder() throws Exception {
    JndiServiceLocator loc = ServiceLocatorBuilder.buildRemote()
        .remoteServer("localhost", 18080)
        .appName("")
        .moduleName("test")
      .createServiceLocator();
    
    // TestRemote testRemote = loc.lookup(TestRemote.class);
    TestRemote testRemote = loc.lookup("TestRemoteInterfaceBean!" + TestRemote.class.getName());
    Assert.assertEquals("TestRemoteBean says hello to ServiceLocatorBuilder", testRemote.getGreeting("ServiceLocatorBuilder"));
  }
}
origin: ch.inftec.ju/ju-ee-testing

  @Test
  public void canLookup_testFacadeBean_usingServiceLocatorBuilder() throws Exception {
    JndiServiceLocator loc = ServiceLocatorBuilder.buildRemote()
        .remoteServer("localhost", 18080)
        .appName("")
        .moduleName("test")
      .createServiceLocator();
    
    // TestRemote testRemote = loc.lookup(TestRemote.class);
    TestRemote testRemote = loc.lookup("TestRemoteInterfaceBean!" + TestRemote.class.getName());
    Assert.assertEquals("TestRemoteBean says hello to ServiceLocatorBuilder", testRemote.getGreeting("ServiceLocatorBuilder"));
  }
}
ch.inftec.ju.ee.testTestRemote

Javadoc

Interface that can be used as a remote interface for bean testing.

Most used methods

  • getGreeting
    Gets a greeting containing the specified name and the simple name of the class.

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • String (java.lang)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JCheckBox (javax.swing)
  • JComboBox (javax.swing)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now