public ApplicationClientStartService(final Method mainMethod, final String[] parameters, final InjectedEENamespaceContextSelector namespaceContextSelectorInjectedValue, final ClassLoader classLoader, final List<SetupAction> setupActions, final EJBClientConfiguration configuration) { this.mainMethod = mainMethod; this.parameters = parameters; this.namespaceContextSelectorInjectedValue = namespaceContextSelectorInjectedValue; this.classLoader = classLoader; this.hostUrl = null; this.setupActions = setupActions; this.contextSelector = new ConfigBasedEJBClientContextSelector(configuration); } @Override
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); }
ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc); EJBClientContext.setSelector(selector);
ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc); 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")); }