@Override public ContextSelector<EJBClientContext> run() { return EJBClientContext.setSelector(selector); } }
@Override public ContextSelector<EJBClientContext> run() { return EJBClientContext.setSelector(selector); } }
public synchronized static ContextSelector<EJBClientContext> setupSelector() { final RemoteNamingEjbClientContextSelector selector = new RemoteNamingEjbClientContextSelector(); ContextSelector<EJBClientContext> delegate = EJBClientContext.setSelector(selector); selector.delegate = delegate; return selector; }
private void initializeEJBClientContext() { Properties properties = new Properties(); properties.put("endpoint.name", "client-endpoint"); properties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false"); properties.put("remote.connections", "default"); properties.put("remote.connection.default.host", "localhost"); properties.put("remote.connection.default.port", "4447"); properties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); PropertiesBasedEJBClientConfiguration configuration = new PropertiesBasedEJBClientConfiguration(properties); final ContextSelector<EJBClientContext> ejbClientContextSelector = new ConfigBasedEJBClientContextSelector(configuration); final ContextSelector<EJBClientContext> previousSelector = EJBClientContext.setSelector(ejbClientContextSelector); }
public JBossLookupConfiguration(Properties jbossEjbClientProperties) { EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(jbossEjbClientProperties); ContextSelector<EJBClientContext> ejbClientContextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration); EJBClientContext.setSelector(ejbClientContextSelector); }
public JBossLookupConfiguration(Properties jbossEjbClientProperties) { EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(jbossEjbClientProperties); ContextSelector<EJBClientContext> ejbClientContextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration); EJBClientContext.setSelector(ejbClientContextSelector); }
EJBClientContext.setSelector(selector);
EJBClientContext.setSelector(selector);
@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")); }
@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")); }