diff --git a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/Util.java b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/Util.java index b6798b84d5a4..2b336507c5af 100644 --- a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/Util.java +++ b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/Util.java @@ -73,6 +73,21 @@ public static Context createNamingContext() throws NamingException { } + /** + * Helper to create the InitialContext with the given properties. + * + * @param properties the environment properties + * @return the constructed InitialContext + * @throws NamingException if an error occurs while creating the InitialContext + */ + public static Context createNamingContext(final Properties properties) throws NamingException { + final Properties jndiProps = new Properties(); + jndiProps.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); + jndiProps.putAll(properties); + return new InitialContext(jndiProps); + + } + public static T lookup(final String name, final Class cls) throws NamingException { InitialContext ctx = new InitialContext(); try { diff --git a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/cluster/EJBClientClusterConfigurationTestCase.java b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/cluster/EJBClientClusterConfigurationTestCase.java index 9c0b5751530a..a5ddd1c77d27 100644 --- a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/cluster/EJBClientClusterConfigurationTestCase.java +++ b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/cluster/EJBClientClusterConfigurationTestCase.java @@ -37,7 +37,6 @@ import org.jboss.as.test.manualmode.ejb.Util; import org.jboss.as.test.shared.TestSuiteEnvironment; import org.jboss.dmr.ModelNode; -import org.jboss.ejb.client.EJBClientContext; import org.jboss.logging.Logger; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -98,9 +97,8 @@ public class EJBClientClusterConfigurationTestCase { @Before public void before() throws Exception { - this.context = Util.createNamingContext(); - // setup the client context selector - setupEJBClientContextSelector(); + final Properties ejbClientProperties = setupEJBClientProperties(); + this.context = Util.createNamingContext(ejbClientProperties); } @@ -206,14 +204,13 @@ public void testServerToServerClusterFormation() throws Exception { } /** - * Sets up the EJB client context to use a selector which processes and sets up EJB receivers - * based on this testcase specific jboss-ejb-client.properties file + * Sets up the EJB client properties based on this testcase specific jboss-ejb-client.properties file * * @return * @throws java.io.IOException */ - private static EJBClientContext setupEJBClientContextSelector() throws IOException { - // setup the selector + private static Properties setupEJBClientProperties() throws IOException { + // setup the properties final String clientPropertiesFile = "jboss-ejb-client.properties"; final InputStream inputStream = EJBClientClusterConfigurationTestCase.class.getResourceAsStream(clientPropertiesFile); if (inputStream == null) { @@ -221,9 +218,7 @@ private static EJBClientContext setupEJBClientContextSelector() throws IOExcepti } final Properties properties = new Properties(); properties.load(inputStream); - // TODO Elytron: Once support for legacy EJB properties has been added back, actually set the EJB properties - // that should be used for this test using properties - return null; + return properties; } private static ModelControllerClient createModelControllerClient(final String container) throws UnknownHostException { diff --git a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/outbound/connection/RemoteOutboundConnectionReconnectTestCase.java b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/outbound/connection/RemoteOutboundConnectionReconnectTestCase.java index 5419f36cc7d3..29de937edb8d 100644 --- a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/outbound/connection/RemoteOutboundConnectionReconnectTestCase.java +++ b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/outbound/connection/RemoteOutboundConnectionReconnectTestCase.java @@ -31,7 +31,6 @@ import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.test.manualmode.ejb.Util; import org.jboss.as.test.shared.util.DisableInvocationTestUtil; -import org.jboss.ejb.client.EJBClientContext; import org.jboss.logging.Logger; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -87,9 +86,8 @@ public static void beforeClass() { @Before public void before() throws Exception { - this.context = Util.createNamingContext(); - // setup the client context selector - setupEJBClientContextSelector(); + final Properties ejbClientProperties = setupEJBClientProperties(); + this.context = Util.createNamingContext(ejbClientProperties); } @After @@ -254,14 +252,13 @@ public void testRemoteServerRestarts() throws Exception { } /** - * Sets up the EJB client context to use a selector which processes and sets up EJB receivers - * based on this testcase specific jboss-ejb-client.properties file + * Sets up the EJB client properties based on this testcase specific jboss-ejb-client.properties file * * @return * @throws java.io.IOException */ - private static EJBClientContext setupEJBClientContextSelector() throws IOException { - // setup the selector + private static Properties setupEJBClientProperties() throws IOException { + // setup the properties final String clientPropertiesFile = "org/jboss/as/test/manualmode/ejb/client/outbound/connection/jboss-ejb-client.properties"; final InputStream inputStream = RemoteOutboundConnectionReconnectTestCase.class.getClassLoader().getResourceAsStream(clientPropertiesFile); if (inputStream == null) { @@ -269,8 +266,6 @@ private static EJBClientContext setupEJBClientContextSelector() throws IOExcepti } final Properties properties = new Properties(); properties.load(inputStream); - // TODO Elytron: Once support for legacy EJB properties has been added back, actually set the EJB properties - // that should be used for this test using properties - return null; + return properties; } } diff --git a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/reconnect/EJBClientReconnectionTestCase.java b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/reconnect/EJBClientReconnectionTestCase.java index 585e9c2df706..09da63e85bf0 100644 --- a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/reconnect/EJBClientReconnectionTestCase.java +++ b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/reconnect/EJBClientReconnectionTestCase.java @@ -30,7 +30,6 @@ import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.test.manualmode.ejb.Util; import org.jboss.ejb.client.EJBClient; -import org.jboss.ejb.client.EJBClientContext; import org.jboss.ejb.client.StatelessEJBLocator; import org.jboss.logging.Logger; @@ -85,9 +84,8 @@ public static Archive deploy() { @Before public void before() throws Exception { - this.context = Util.createNamingContext(); - // setup the client context selector - setupEJBClientContextSelector(); + final Properties ejbClientProperties = setupEJBClientProperties(); + this.context = Util.createNamingContext(ejbClientProperties); controller.start(CONTAINER); log.trace("===appserver started==="); @@ -169,14 +167,13 @@ private T lookup(final Class remoteClass, final Class beanClass, final } /** - * Sets up the EJB client context to use a selector which processes and sets up EJB receivers - * based on this testcase specific jboss-ejb-client.properties file + * Sets up the EJB client properties based on this testcase specific jboss-ejb-client.properties file * * @return * @throws java.io.IOException */ - private static EJBClientContext setupEJBClientContextSelector() throws IOException { - // setup the selector + private static Properties setupEJBClientProperties() throws IOException { + // setup the properties final String clientPropertiesFile = "jboss-ejb-client.properties"; final InputStream inputStream = EJBClientReconnectionTestCase.class.getResourceAsStream(clientPropertiesFile); if (inputStream == null) { @@ -184,9 +181,7 @@ private static EJBClientContext setupEJBClientContextSelector() throws IOExcepti } final Properties properties = new Properties(); properties.load(inputStream); - // TODO Elytron: Once support for legacy EJB properties has been added back, actually set the EJB properties - // that should be used for this test using properties - return null; + return properties; } diff --git a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/ssl/SSLEJBRemoteClientTestCase.java b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/ssl/SSLEJBRemoteClientTestCase.java index f36d896196da..cc91a2e9fa9e 100644 --- a/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/ssl/SSLEJBRemoteClientTestCase.java +++ b/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/ssl/SSLEJBRemoteClientTestCase.java @@ -36,7 +36,6 @@ import org.jboss.as.test.manualmode.ejb.ssl.beans.StatelessBean; import org.jboss.as.test.manualmode.ejb.ssl.beans.StatelessBeanRemote; import org.jboss.as.test.shared.TestSuiteEnvironment; -import org.jboss.ejb.client.EJBClientContext; import org.jboss.logging.Logger; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -112,9 +111,9 @@ public static void prepare() throws Exception { System.setProperty("jboss.ejb.client.properties.skip.classloader.scan", "true"); } - private static EJBClientContext setupEJBClientContextSelector() throws IOException { + private static Properties setupEJBClientProperties() throws IOException { log.trace("*** reading EJBClientContextSelector properties"); - // setup the selector + // setup the properties final String clientPropertiesFile = "org/jboss/as/test/manualmode/ejb/ssl/jboss-ejb-client.properties"; final InputStream inputStream = SSLEJBRemoteClientTestCase.class.getClassLoader().getResourceAsStream(clientPropertiesFile); if (inputStream == null) { @@ -122,9 +121,7 @@ private static EJBClientContext setupEJBClientContextSelector() throws IOExcepti } final Properties properties = new Properties(); properties.load(inputStream); - // TODO Elytron: Once support for legacy EJB properties has been added back, actually set the EJB properties - // that should be used for this test using properties - return null; + return properties; } @@ -146,7 +143,6 @@ public void prepareServerOnce() throws Exception { managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting"); // write SSL realm config to output - debugging purposes SSLRealmSetupTool.readSSLRealmConfig(managementClient); - setupEJBClientContextSelector(); serverConfigDone = true; } else { log.trace("*** Server already prepared, skipping config procedure"); @@ -160,10 +156,11 @@ public static void tearDown() throws Exception { SSLRealmSetupTool.tearDown(mClient, container); } - private Properties getEjbClientContextProperties() { + private Properties getEjbClientContextProperties() throws IOException { Properties env = new Properties(); env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); env.put("jboss.naming.client.ejb.context", true); + env.putAll(setupEJBClientProperties()); return env; } diff --git a/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeExecutionDisabledTestCase.java b/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeExecutionDisabledTestCase.java index d29fac4bb71d..f36d9dc63109 100644 --- a/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeExecutionDisabledTestCase.java +++ b/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeExecutionDisabledTestCase.java @@ -209,7 +209,7 @@ public Context getRemoteContext(ManagementClient managementClient) throws Except // WildFly naming client doesn't currently handle this property, we need to manually set the EJBClientConfiguration // in this test for now. We need to revisit this modification when the new WildFly naming client and EJB client are // being integrated. - createEJBClientConfiguration(managementClient); + final Properties ejbClientProperties = createEJBClientConfiguration(managementClient); final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName()); @@ -219,18 +219,17 @@ public Context getRemoteContext(ManagementClient managementClient) throws Except env.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false"); env.put("jboss.naming.client.security.callback.handler.class", CallbackHandler.class.getName()); env.put("jboss.naming.client.ejb.context", true); + env.putAll(ejbClientProperties); return new InitialContext(env); } - private void createEJBClientConfiguration(ManagementClient managementClient) { + private Properties createEJBClientConfiguration(ManagementClient managementClient) { final Properties config = new Properties(); config.put("remote.connections", "default"); config.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); config.put("remote.connection.default.host", managementClient.getWebUri().getHost()); config.put("remote.connection.default.port", String.valueOf(managementClient.getWebUri().getPort())); - - // TODO Elytron: Once support for legacy EJB properties has been added back, actually set the EJB properties - // that should be used for this test using config + return config; } } diff --git a/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeTestCase.java b/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeTestCase.java index 49f1d0669cf1..70366cc70adb 100644 --- a/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeTestCase.java +++ b/testsuite/integration/multinode/src/test/java/org/jboss/as/test/multinode/ejb/timer/database/DatabaseTimerServiceMultiNodeTestCase.java @@ -245,7 +245,7 @@ public Context getRemoteContext(ManagementClient managementClient) throws Except // WildFly naming client doesn't currently handle this property, we need to manually set the EJBClientConfiguration // in this test for now. We need to revisit this modification when the new WildFly naming client and EJB client are // being integrated. - createEJBClientConfiguration(managementClient); + final Properties ejbClientProperties = createEJBClientConfiguration(managementClient); final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName()); @@ -255,17 +255,16 @@ public Context getRemoteContext(ManagementClient managementClient) throws Except env.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false"); env.put("jboss.naming.client.security.callback.handler.class", CallbackHandler.class.getName()); env.put("jboss.naming.client.ejb.context", true); + env.putAll(ejbClientProperties); return new InitialContext(env); } - private void createEJBClientConfiguration(ManagementClient managementClient) { + private Properties createEJBClientConfiguration(ManagementClient managementClient) { final Properties config = new Properties(); config.put("remote.connections", "default"); config.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); config.put("remote.connection.default.host", managementClient.getWebUri().getHost()); config.put("remote.connection.default.port", String.valueOf(managementClient.getWebUri().getPort())); - - // TODO Elytron: Once support for legacy EJB properties has been added back, actually set the EJB properties - // that should be used for this test using config + return config; } }