modules);
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/jboss/ejb/server/SessionOpenRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package org.jboss.ejb.server;
20 |
21 | import jakarta.transaction.SystemException;
22 | import jakarta.transaction.Transaction;
23 |
24 | /**
25 | * An Enterprise Bean session-open request.
26 | *
27 | * @author David M. Lloyd
28 | */
29 | public interface SessionOpenRequest extends Request {
30 | /**
31 | * Determine if the request has a transaction.
32 | *
33 | * @return {@code true} if there is a transaction context with this request
34 | */
35 | boolean hasTransaction();
36 |
37 | /**
38 | * Get the inflowed transaction of the request. This should not be called unless it is desired to actually inflow
39 | * the transaction; doing so without using the transaction will cause needless work for the transaction coordinator.
40 | * To perform transaction checks, use {@link #hasTransaction()} first. This method should only be called one time
41 | * as it will inflow the transaction when called.
42 | *
43 | * If a transaction is present but transaction inflow has failed, a {@link SystemException} is thrown. In this case,
44 | * the invocation should fail.
45 | *
46 | * It is the caller's responsibility to check the status of the returned transaction to ensure that it is in an
47 | * active state; failure to do so can result in undesirable behavior.
48 | *
49 | * @return the transaction, or {@code null} if there is none for the request
50 | * @throws SystemException if inflowing the transaction failed
51 | * @throws IllegalStateException if this method is called more than one time
52 | */
53 | Transaction getTransaction() throws SystemException, IllegalStateException;
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/resources/org/jboss/ejb/client/Version.properties:
--------------------------------------------------------------------------------
1 | version=${project.version}
2 | jarName=${project.artifactId}
3 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/DiscoveryEJBClientInterceptorTestCase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2020 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package org.jboss.ejb.client;
20 |
21 | import java.net.URI;
22 |
23 | import org.junit.Assert;
24 | import org.junit.Test;
25 |
26 | /**
27 | * Tests for the DiscoveryEJBClientInterceptor
28 | *
29 | * @author Lin Gao
30 | */
31 | public class DiscoveryEJBClientInterceptorTestCase {
32 |
33 | /**
34 | * A test for the "blocklist" feature of the DiscoveryEJBClientInterceptor which allows invocation targets
35 | * to be added to a blocklist. Presence of a URL on the blocklist eans that they should currently be excluded
36 | * from discovery request results. The blocklist has an associated timeout; blocklisted entries are cleared
37 | * once their time in the blocklist has passed the timeout to avoid being blocklisted forever.
38 | *
39 | * THis test validates the addition of a URL to the blicklist, as well as its expiration from the blocklist.
40 | *
41 | * @throws Exception
42 | */
43 | @Test
44 | public void testBlocklist() throws Exception {
45 | long timeout = 1000L;
46 | System.setProperty(SystemProperties.DISCOVERY_BLOCKLIST_TIMEOUT, timeout + "");
47 | AbstractInvocationContext context = new AbstractInvocationContext(null, null, null) {
48 | @Override
49 | public void requestRetry() {
50 | }
51 | };
52 | URI destination = new URI("http-remoting://localhost:9443");
53 | DiscoveryEJBClientInterceptor.addBlocklistedDestination(destination);
54 | Assert.assertTrue(DiscoveryEJBClientInterceptor.isBlocklisted(context, destination));
55 | Assert.assertEquals(1, DiscoveryEJBClientInterceptor.getBlocklist().size());
56 |
57 | // If sleeping for just the timeout duration, the lifespan of the blocklist may equal to, but not greater than,
58 | // the configured timeout, and so will not be removed yet. So sleep a bit longer.
59 | Thread.sleep(timeout * 2);
60 | Assert.assertFalse(DiscoveryEJBClientInterceptor.isBlocklisted(context, destination));
61 | Assert.assertEquals(0, DiscoveryEJBClientInterceptor.getBlocklist().size());
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/DummyClientInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Red Hat, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.jboss.ejb.client;
17 |
18 | import org.jboss.ejb.client.EJBClientInterceptor;
19 | import org.jboss.ejb.client.EJBClientInvocationContext;
20 |
21 | /**
22 | * A dummy ClientInterceptor that does nothing.
23 | * It's purely for testing.
24 | *
25 | * @author Brad Maxwell
26 | */
27 | public class DummyClientInterceptor implements EJBClientInterceptor {
28 |
29 | public void handleInvocation(EJBClientInvocationContext context) throws Exception {
30 | context.sendRequest();
31 | }
32 |
33 | public Object handleInvocationResult(EJBClientInvocationContext context) throws Exception {
34 | return context.getResult();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/DummyClientInterceptor2.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Red Hat, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.jboss.ejb.client;
17 |
18 | import org.jboss.ejb.client.EJBClientInterceptor;
19 | import org.jboss.ejb.client.EJBClientInvocationContext;
20 |
21 | /**
22 | * A dummy ClientInterceptor that does nothing.
23 | * It's purely for testing.
24 | *
25 | * @author Brad Maxwell
26 | */
27 | public class DummyClientInterceptor2 implements EJBClientInterceptor {
28 |
29 | public void handleInvocation(EJBClientInvocationContext context) throws Exception {
30 | context.sendRequest();
31 | }
32 |
33 | public Object handleInvocationResult(EJBClientInvocationContext context) throws Exception {
34 | return context.getResult();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/DummyNodeSelector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Red Hat, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.jboss.ejb.client;
17 |
18 | /**
19 | * A dummy SelectorNode implementation for a DeploymentNodeSelector and a ClusterNodeSelector that does nothing.
20 | * It's purely for testing.
21 | *
22 | * @author Joerg Baesner
23 | */
24 | public class DummyNodeSelector implements DeploymentNodeSelector, ClusterNodeSelector{
25 |
26 | public static final String DEPLOYMENT_NODE_IDENTIFIER = "deploymentNodeSelector";
27 | public static final String CLUSTER_NODE_IDENTIFIER = "clusterNodeSelector";
28 |
29 | @Override
30 | public String selectNode(String[] eligibleNodes, String appName, String moduleName, String distinctName) {
31 | return DEPLOYMENT_NODE_IDENTIFIER;
32 | }
33 |
34 | @Override
35 | public String selectNode(String clusterName, String[] connectedNodes, String[] totalAvailableNodes) {
36 | return CLUSTER_NODE_IDENTIFIER;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/EJBRootContextTestCase.java:
--------------------------------------------------------------------------------
1 | package org.jboss.ejb.client;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 | import org.wildfly.naming.client.ProviderEnvironment;
6 | import org.wildfly.naming.client.SimpleName;
7 | import org.wildfly.naming.client.util.FastHashtable;
8 |
9 | import javax.naming.InvalidNameException;
10 | import javax.naming.NamingException;
11 |
12 | /**
13 | * A set of tests which validate that invocation.timeout values set in the properties map of a JNDI context
14 | * get propagated to the proxies created from that JNDI context.
15 | *
16 | * @author unknown
17 | */
18 | public class EJBRootContextTestCase {
19 |
20 | private static final String LOOKUP_NAME = "appName/moduleName/distinctName!org.jboss.ejb.client.test.common.Echo";
21 |
22 | /**
23 | * Test which validates that an integer-valued invocation.timeout property set in the properties map for
24 | * a JNDI context gets passed through to a proxy created from that JNDI context.
25 | *
26 | * @throws NamingException
27 | */
28 | @Test
29 | public void testInvocationTimeoutEnvPropertyInteger() throws NamingException {
30 | FastHashtable env = new FastHashtable<>();
31 | env.put("invocation.timeout", 100);
32 |
33 | Object proxy = invokeContextLookup(env);
34 |
35 | Assert.assertEquals(100, EJBInvocationHandler.forProxy(proxy).getInvocationTimeout());
36 | }
37 |
38 | /**
39 | * Test which validates that a string-valued invocation.timeout property set in the properties map for
40 | * a JNDI context gets passed through to a proxy created from that JNDI context.
41 | *
42 | * @throws NamingException
43 | */
44 | @Test
45 | public void testInvocationTimeoutEnvPropertyString() throws NamingException {
46 | FastHashtable env = new FastHashtable<>();
47 | env.put("invocation.timeout", "100");
48 |
49 | Object proxy = invokeContextLookup(env);
50 |
51 | Assert.assertEquals(100, EJBInvocationHandler.forProxy(proxy).getInvocationTimeout());
52 | }
53 |
54 | /**
55 | * Test which validates that a long-valued invocation.timeout property set in the properties map for
56 | * a JNDI context gets passed through to a proxy created from that JNDI context.
57 | *
58 | * @throws NamingException
59 | */
60 | @Test
61 | public void testInvocationTimeoutEnvPropertyLong() throws NamingException {
62 | FastHashtable env = new FastHashtable<>();
63 | env.put("invocation.timeout", 100L);
64 |
65 | Object proxy = invokeContextLookup(env);
66 |
67 | Assert.assertEquals(100, EJBInvocationHandler.forProxy(proxy).getInvocationTimeout());
68 | }
69 |
70 | /**
71 | * Test which validates that the default invocation.timeout property for a JNDI context is -1.
72 | *
73 | * @throws NamingException
74 | */
75 | @Test
76 | public void testInvocationTimeoutEnvPropertyEmpty() throws NamingException {
77 | FastHashtable env = new FastHashtable<>();
78 |
79 | Object proxy = invokeContextLookup(env);
80 |
81 | Assert.assertEquals(-1, EJBInvocationHandler.forProxy(proxy).getInvocationTimeout());
82 | }
83 |
84 | private Object invokeContextLookup(FastHashtable env) throws NamingException {
85 | EJBRootContext context = new EJBRootContext(null, env, new ProviderEnvironment.Builder().build());
86 | return context.lookupNative(new SimpleName(LOOKUP_NAME));
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/ProxyEqualityTestCase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client;
19 |
20 | import java.lang.reflect.InvocationHandler;
21 | import java.lang.reflect.Proxy;
22 |
23 | import org.junit.Assert;
24 | import org.junit.Test;
25 |
26 | /**
27 | * Tests which validate the test for proxy equality works for proxies created by the EJB Client API.
28 | *
29 | * Proxy equality is based on module name, use of an EJBINvocationHandler and viewType.
30 | *
31 | * @author Stuart Douglas
32 | */
33 | public class ProxyEqualityTestCase {
34 |
35 | /**
36 | * A test for proxy equality, inequality and use of the correct invocation handler.
37 | */
38 | @Test
39 | public void testClientProxyEquality() {
40 | // create a proxy with appName = a, moduleName = m, beanName = b and distinctName = d
41 | final StatelessEJBLocator locatorA = new StatelessEJBLocator(SimpleInterface.class, "a", "m", "b", "d");
42 | SimpleInterface proxyA = EJBClient.createProxy(locatorA);
43 |
44 | final StatelessEJBLocator locatorB = new StatelessEJBLocator(SimpleInterface.class, "a", "m", "b", "d");
45 | SimpleInterface proxyB = EJBClient.createProxy(locatorB);
46 |
47 | final StatelessEJBLocator locatorC = new StatelessEJBLocator(SimpleInterface.class, "a", "m", "b", "other");
48 | SimpleInterface proxyC = EJBClient.createProxy(locatorC);
49 |
50 | // validate proxy equality
51 | Assert.assertTrue(proxyA.equals(proxyB));
52 | Assert.assertEquals(proxyA.hashCode(), proxyB.hashCode());
53 |
54 | // valite proxy inequality
55 | Assert.assertFalse(proxyA.equals(proxyC));
56 | Assert.assertTrue(proxyA.hashCode() != proxyC.hashCode());
57 |
58 | // validate the proxy was created from EJB Client API
59 | Assert.assertTrue(EJBClient.isEJBProxy(proxyA));
60 | Assert.assertTrue(EJBClient.isEJBProxy(proxyB));
61 | Assert.assertTrue(EJBClient.isEJBProxy(proxyC));
62 |
63 | InvocationHandler invocationHandler1 = (proxy, method, args) -> method.invoke(proxy, args);
64 | final Object proxy1 = Proxy.newProxyInstance(getClass().getClassLoader(), new Class>[]{Runnable.class}, invocationHandler1);
65 | Assert.assertFalse(EJBClient.isEJBProxy(proxy1));
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/SimpleInterface.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2011 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client;
19 |
20 | /**
21 | * Interface used in the tests
22 | *
23 | * @author Stuart Douglas
24 | */
25 | public interface SimpleInterface {
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/legacy/LegacyPropertiesConfigurationTestCase.java:
--------------------------------------------------------------------------------
1 | package org.jboss.ejb.client.legacy;
2 |
3 | import org.jboss.ejb.client.EJBClientContext;
4 | import org.junit.Assert;
5 | import org.junit.Test;
6 |
7 | import java.io.IOException;
8 |
9 | /**
10 | * Tests to verify that configuration of the EJBClientContext by a legacy jboss-ejb-client.properties file works
11 | * as expected. The jboss-ejb-client.properties file allows configuring invocation-related properties for the
12 | * EJBClientContext at three different levels:
13 | * - invocations targetting singleton nodes
14 | * - invocations targetting clusters
15 | * - invocations targetting specific nodes in clusters
16 | *
17 | * @author Thomas Hofman
18 | */
19 | public class LegacyPropertiesConfigurationTestCase {
20 |
21 | private static final String PROPERTIES_FILE_MAX_NODES_SET = "maximum-connected-nodes-jboss-ejb-client.properties";
22 | private static final String PROPERTIES_FILE_MAX_NODES_NOT_SET = "clustered-jboss-ejb-client.properties";
23 |
24 | /**
25 | * Tests that values configured for the cluster property "max-allowed-connected-nodes" are passed through
26 | * to the resulting EJBClientContext.
27 | *
28 | * @throws IOException
29 | */
30 | @Test
31 | public void testMaximumConnectedNodesSet() throws IOException {
32 | JBossEJBProperties ejbProperties = JBossEJBProperties.fromClassPath(JBossEJBProperties.class.getClassLoader(), PROPERTIES_FILE_MAX_NODES_SET);
33 | Assert.assertEquals(-1, ejbProperties.getClusterConfigurations().get("ejb1").getMaximumAllowedConnectedNodes()); // default value returned by JBossEJBProperties
34 | Assert.assertEquals(42, ejbProperties.getClusterConfigurations().get("ejb2").getMaximumAllowedConnectedNodes()); // configured
35 | EJBClientContext context = buildContextFromLegacyProperties(ejbProperties);
36 |
37 | Assert.assertEquals(42, context.getMaximumConnectedClusterNodes());
38 | }
39 |
40 | /**
41 | * Tests that default values configured for the cluster property "max-allowed-connected-nodes" are passed through
42 | * to the resulting EJBClientContext when the property is not set.
43 | *
44 | * @throws IOException
45 | */
46 | @Test
47 | public void testMaximumConnectedNodesNotSet() throws IOException {
48 | JBossEJBProperties ejbProperties = JBossEJBProperties.fromClassPath(JBossEJBProperties.class.getClassLoader(), PROPERTIES_FILE_MAX_NODES_NOT_SET);
49 | Assert.assertEquals(-1, ejbProperties.getClusterConfigurations().get("ejb").getMaximumAllowedConnectedNodes()); // default value returned by JBossEJBProperties
50 | EJBClientContext context = buildContextFromLegacyProperties(ejbProperties);
51 |
52 | Assert.assertEquals(10, context.getMaximumConnectedClusterNodes()); // default value
53 | }
54 |
55 | private EJBClientContext buildContextFromLegacyProperties(JBossEJBProperties ejbProperties) {
56 | JBossEJBProperties.getContextManager().setThreadDefault(ejbProperties);
57 | EJBClientContext.Builder builder = new EJBClientContext.Builder();
58 | LegacyPropertiesConfiguration.configure(builder);
59 | return builder.build();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/remoting/MethodInvocationRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2011 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.remoting;
19 |
20 | import java.util.Map;
21 |
22 | /**
23 | * Test framework class representing a method invocation and its associated data.
24 | *
25 | * @author Carlo de Wolf
26 | */
27 | public class MethodInvocationRequest {
28 |
29 | private final short invocationId;
30 | private final String appName;
31 | private final String moduleName;
32 | private final String beanName;
33 | private final String viewClassName;
34 | private final String methodName;
35 | private final String[] paramTypes;
36 | private final Object[] params;
37 | private final String distinctName;
38 | private final Map attachments;
39 |
40 | public MethodInvocationRequest(final short invocationId, final String appName, final String moduleName,
41 | final String distinctName, final String beanName, final String viewClassName,
42 | final String methodName, final String[] methodParamTypes,
43 | final Object[] methodParams, final Map attachments) {
44 |
45 | this.invocationId = invocationId;
46 | this.appName = appName;
47 | this.moduleName = moduleName;
48 | this.beanName = beanName;
49 | this.viewClassName = viewClassName;
50 | this.methodName = methodName;
51 | this.params = methodParams;
52 | this.attachments = attachments;
53 | this.paramTypes = methodParamTypes;
54 | this.distinctName = distinctName;
55 |
56 | }
57 |
58 | public short getInvocationId() {
59 | return invocationId;
60 | }
61 |
62 | public String getMethodName() {
63 | return methodName;
64 | }
65 |
66 | public String getViewClassName() {
67 | return this.viewClassName;
68 | }
69 |
70 | public Object[] getParams() {
71 | return params;
72 | }
73 |
74 | public String[] getParamTypes() {
75 | return this.paramTypes;
76 | }
77 |
78 | public Map getAttachments() {
79 | return attachments;
80 | }
81 |
82 | public String getAppName() {
83 | return this.appName;
84 | }
85 |
86 | public String getModuleName() {
87 | return this.moduleName;
88 | }
89 |
90 | public String getBeanName() {
91 | return this.beanName;
92 | }
93 |
94 | public String getDistinctName() {
95 | return this.distinctName;
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/serialization/ProxySerializationTestCase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2010 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.serialization;
19 |
20 | import java.io.ByteArrayInputStream;
21 | import java.io.ByteArrayOutputStream;
22 | import java.io.IOException;
23 |
24 | import org.jboss.ejb.client.EJBClient;
25 | import org.jboss.ejb.client.SimpleInterface;
26 | import org.jboss.ejb.client.StatelessEJBLocator;
27 | import org.jboss.marshalling.InputStreamByteInput;
28 | import org.jboss.marshalling.Marshaller;
29 | import org.jboss.marshalling.MarshallingConfiguration;
30 | import org.jboss.marshalling.OutputStreamByteOutput;
31 | import org.jboss.marshalling.Unmarshaller;
32 | import org.jboss.marshalling.river.RiverMarshallerFactory;
33 | import org.junit.Assert;
34 | import org.junit.Test;
35 |
36 | /**
37 | * Tests that validate that an Enterprise Bean proxy can be serialized using JBoss Marshalling.
38 | *
39 | * @author Stuart Douglas
40 | */
41 | public class ProxySerializationTestCase {
42 |
43 | /**
44 | * Tests that marshalling/unmarshalling an EJB proxy to and from a byte stream does not affect
45 | * the validity of the proxy.
46 | *
47 | * @throws IOException
48 | * @throws ClassNotFoundException
49 | */
50 | @Test
51 | public void testProxySerialization() throws IOException, ClassNotFoundException {
52 |
53 | // create a sample EJB client proxy
54 | final StatelessEJBLocator locator = new StatelessEJBLocator(SimpleInterface.class, "a", "m", "b", "d");
55 | final Object proxy = EJBClient.createProxy(locator);
56 |
57 | // configure a JBoss Marshalling marshaller and marshall the proxy into a byte array, "bytes"
58 | final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration();
59 | marshallingConfiguration.setVersion(2);
60 | org.jboss.marshalling.MarshallerFactory factory = new RiverMarshallerFactory();
61 | final Marshaller marshaller = factory.createMarshaller(marshallingConfiguration);
62 | final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
63 | marshaller.start(new OutputStreamByteOutput(bytes));
64 | marshaller.writeObject(proxy);
65 | marshaller.finish();
66 |
67 | // configure a JBoss Marshalling unmarshaller and unmarshal the byte array, "bytes", into an Object
68 | Unmarshaller unmarshaller = factory.createUnmarshaller(marshallingConfiguration);
69 | ByteArrayInputStream in = new ByteArrayInputStream(bytes.toByteArray());
70 | unmarshaller.start(new InputStreamByteInput(in));
71 | Object deserialized = unmarshaller.readObject();
72 |
73 | // check for equality of the original proxy and the marshalled/unmarshalled proxy
74 | Assert.assertEquals(proxy, deserialized);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/ClassCallback.java:
--------------------------------------------------------------------------------
1 | package org.jboss.ejb.client.test;
2 |
3 | /**
4 | * A helper class to allow calling an arbitrary Runnable
5 | */
6 | public class ClassCallback {
7 | private static volatile Runnable beforeClassCallback;
8 |
9 | public static void beforeClassCallback() {
10 | if (beforeClassCallback != null) {
11 | beforeClassCallback.run();
12 | }
13 | }
14 |
15 | public static void setBeforeClassCallback(Runnable beforeClassCallback) {
16 | ClassCallback.beforeClassCallback = beforeClassCallback;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/WildflyClientXMLTestCase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test;
19 |
20 | import org.jboss.ejb.client.EJBClientContext;
21 | import org.jboss.logging.Logger;
22 | import org.junit.Assert;
23 | import org.junit.BeforeClass;
24 | import org.junit.Test;
25 |
26 | import java.io.File;
27 | import java.net.URL;
28 |
29 | /**
30 | * Tests some basic features of using a wildfly-config.xml file to configure the various contextuals which
31 | * the EJB client library depends on for configuration of key cross cutting concerns.
32 | *
33 | * This processing reads a wildfly-config.xml file from the classpath (or one referenced by the system property
34 | * wildfly.config.url) and uses the configuration in that file to configure the following contextuals:
35 | * - Endpoint
36 | * - XNIOWorker
37 | * - EJBClientContext
38 | * - AuthenticationConfiguration
39 | * - Discovery
40 | * - WildflyHttpContext
41 | *
42 | *
43 | * @author Richard Achmatowicz
44 | *
45 | * @todo this test should include complete coverage of all available settings realting to the EJBClientContext
46 | * at a minimum.
47 | */
48 | public class WildflyClientXMLTestCase {
49 |
50 | private static final Logger logger = Logger.getLogger(WildflyClientXMLTestCase.class);
51 | private static final String CONFIGURATION_FILE_SYSTEM_PROPERTY_NAME = "wildfly.config.url";
52 | private static final String CONFIGURATION_FILE = "wildfly-client.xml";
53 | private static final long INVOCATION_TIMEOUT = 10*1000;
54 |
55 | /**
56 | * Initialize the contextuals by setting the wildfly.config.url system property
57 | * @throws Exception
58 | */
59 | @BeforeClass
60 | public static void beforeClass() throws Exception {
61 | // make sure the desired configuration file is picked up for processing
62 | ClassLoader cl = WildflyClientXMLTestCase.class.getClassLoader();
63 | URL resource = cl != null ? cl.getResource(CONFIGURATION_FILE) : ClassLoader.getSystemResource(CONFIGURATION_FILE);
64 | File file = new File(resource.getFile());
65 | System.setProperty(CONFIGURATION_FILE_SYSTEM_PROPERTY_NAME,file.getAbsolutePath());
66 | ClassCallback.beforeClassCallback();
67 | }
68 |
69 | /*
70 | * Tests that the invocation timeout value set in wildfly-config.xml is used to populate the invocation timeout
71 | * value in the EJBClientContext.
72 | */
73 | @Test
74 | public void testInvocationTimeout() {
75 | EJBClientContext clientContext = EJBClientContext.getCurrent();
76 | Assert.assertEquals("Got an unexpected timeout value", INVOCATION_TIMEOUT, clientContext.getInvocationTimeout());
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/byteman/MixedModeTestHelper.java:
--------------------------------------------------------------------------------
1 | package org.jboss.ejb.client.test.byteman;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 | import java.util.concurrent.ConcurrentHashMap;
6 |
7 | import org.jboss.byteman.rule.Rule;
8 | import org.jboss.byteman.rule.helper.Helper;
9 | import org.jboss.ejb.client.EJBClientContext;
10 | import org.wildfly.discovery.FilterSpec;
11 | import org.wildfly.discovery.ServiceURL;
12 |
13 | /**
14 | * Helper class for the MixedModeServiceURLTestCase.
15 | *
16 | * Maintains a map of nodes to ServiceURLs used for test validation.
17 | *
18 | * @author rachmato@redhat.com
19 | */
20 | public class MixedModeTestHelper extends Helper {
21 |
22 | private static final String NODE_LIST_MAP_NAME = "nodeListMap";
23 | private static final FilterSpec EJB_MODULE_FILTER_SPEC = FilterSpec.hasAttribute(EJBClientContext.FILTER_ATTR_EJB_MODULE);
24 |
25 | public MixedModeTestHelper(Rule rule) {
26 | super(rule);
27 | }
28 |
29 | public void createNodeListMap() {
30 | createLinkMap(NODE_LIST_MAP_NAME);
31 | }
32 |
33 | public void addServiceURLCacheToMap(String node, List list) {
34 | if (list.size() < 4) {
35 | System.out.printf("Ignoring partial ServiceURLs: %s%n", list);
36 | return;
37 | }
38 | boolean hasEjbModule = true;
39 | for (ServiceURL u : list) {
40 | if (!u.satisfies(EJB_MODULE_FILTER_SPEC)) {
41 | hasEjbModule = false;
42 | break;
43 | }
44 | }
45 | if (!hasEjbModule) {
46 | System.out.printf("Ignoring invalid temp ServiceURLs: %s%n", list);
47 | return;
48 | }
49 |
50 | System.out.println("** Adding serviceURL to map: node = " + node + ", list = " + list);
51 | List oldList = (List) link(NODE_LIST_MAP_NAME, node, list);
52 | if (oldList != null) {
53 | System.out.println("** Overwrite occurred when writing to list map!");
54 | }
55 | }
56 |
57 | @SuppressWarnings("unchecked")
58 | public Map> getNodeListMap() {
59 | System.out.println("** Getting results from Byteman");
60 | ConcurrentHashMap> results = new ConcurrentHashMap<>();
61 | // write the entries from the linkMap into a map
62 | for (Object nameObject: linkNames(NODE_LIST_MAP_NAME)) {
63 | String node = (String) nameObject;
64 | List list = (List) linked(NODE_LIST_MAP_NAME, nameObject);
65 | results.put(node, list);
66 | }
67 | return results;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/Echo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | import org.jboss.ejb.client.annotation.ClientTransaction;
21 | import org.jboss.ejb.client.annotation.ClientTransactionPolicy;
22 |
23 | /**
24 | * User: jpai
25 | */
26 | public interface Echo {
27 | Result echo(String msg);
28 |
29 | @ClientTransaction(ClientTransactionPolicy.NOT_SUPPORTED)
30 | Result echoNonTx(String msg);
31 | }
32 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/EchoBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | import org.jboss.logging.Logger;
21 |
22 | /**
23 | * User: jpai
24 | */
25 | public class EchoBean implements Echo {
26 |
27 | private static final Logger logger = Logger.getLogger(EchoBean.class);
28 | private final String node;
29 |
30 | public EchoBean() {
31 | this("unknown");
32 | }
33 |
34 | public EchoBean(String node) {
35 | this.node = node;
36 | }
37 |
38 | @Override
39 | public Result echo(String msg) {
40 | logger.info(this.getClass().getSimpleName() + " echoing message " + msg);
41 | if ("request to throw IllegalArgumentException".equals(msg)) {
42 | throw new IllegalArgumentException("Intentionally thrown upon request from caller");
43 | }
44 | return new Result(msg, node);
45 | }
46 |
47 | @Override
48 | public Result echoNonTx(String msg) {
49 | logger.info(this.getClass().getSimpleName() + " echoing message (NonTx) " + msg);
50 | return new Result(msg, node);
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/Foo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | import jakarta.ejb.Stateful;
21 |
22 | /**
23 | * User: jpai
24 | */
25 | public interface Foo {
26 |
27 | Result echo(String msg);
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/FooBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | import org.jboss.logging.Logger;
21 |
22 | import jakarta.ejb.Stateful;
23 |
24 | /**
25 | * User: jpai
26 | */
27 | @Stateful
28 | public class FooBean implements Echo {
29 |
30 | private static final Logger logger = Logger.getLogger(FooBean.class);
31 |
32 | @Override
33 | public Result echo(String msg) {
34 | logger.info(this.getClass().getSimpleName() + " echoing message " + msg);
35 | return new Result(msg, "no idea!");
36 | }
37 |
38 | @Override
39 | public Result echoNonTx(String msg) {
40 | logger.info(this.getClass().getSimpleName() + " echoing message " + msg);
41 | return new Result(msg, "no idea!");
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/Result.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2019 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | import java.io.Serializable;
21 |
22 | /**
23 | * /**
24 | * A wrapper for a return value that includes the node on which the result was generated.
25 | * @author Paul Ferraro
26 | */
27 |
28 | public class Result implements Serializable {
29 | private static final long servialVersionUID = 12345L ;
30 | private final T value;
31 | private final String node;
32 |
33 | public Result(T value, String node) {
34 | this.value = value;
35 | this.node = node;
36 | }
37 |
38 | public T getValue() {
39 | return value;
40 | }
41 |
42 | public String getNode() {
43 | return node;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/StatefulEchoBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | import jakarta.ejb.Stateful;
21 |
22 | /**
23 | * An instance of Echo marked explicitly as stateful.
24 | *
25 | * User: jpai
26 | */
27 | @Stateful
28 | public class StatefulEchoBean extends EchoBean {
29 | public StatefulEchoBean(String node) {
30 | super(node);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/StatelessEchoBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2017 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | import jakarta.ejb.Stateless;
21 |
22 | /**
23 | * An instance of Echo marked explicitly as stateless.
24 | *
25 | * User: jpai
26 | */
27 | @Stateless
28 | public class StatelessEchoBean extends EchoBean {
29 | public StatelessEchoBean(String node) {
30 | super(node);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/TypeReporter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2020 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | public interface TypeReporter {
21 |
22 | String getObjectType(Object object);
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/client/test/common/TypeReporterBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2020 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.client.test.common;
19 |
20 | /**
21 | * A bean which can be used to report the type of the Object parameter passed to its only method.
22 | */
23 | public class TypeReporterBean implements TypeReporter {
24 |
25 | @Override
26 | public String getObjectType(Object object) {
27 | return object.getClass().getName();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/org/jboss/ejb/protocol/remote/NetworkUtilTestCase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source.
3 | * Copyright 2013 Red Hat, Inc., and individual contributors
4 | * as indicated by the @author tags.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 | package org.jboss.ejb.protocol.remote;
19 |
20 | import static org.junit.Assert.*;
21 |
22 | import java.net.InetAddress;
23 | import java.net.UnknownHostException;
24 |
25 | import org.jboss.ejb._private.NetworkUtil;
26 | import org.junit.Test;
27 |
28 | /**
29 | * Tests for the NetworkUtil network utility class.
30 | *
31 | * @author David M. Lloyd
32 | */
33 | public final class NetworkUtilTestCase {
34 |
35 | /**
36 | * Validation of the method NetworkUtil.belongsToNetwork(...) used to determine if a given host InetAddress belongs
37 | * to a network specified by a network InetAddress value and a network mask.
38 | *
39 | * @throws UnknownHostException
40 | */
41 | @Test
42 | public void testNetmask1() throws UnknownHostException {
43 | assertTrue(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), InetAddress.getByAddress("", new byte[] { 10, 64, 33, 17 }), 8));
44 | assertTrue(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 7, 0, (byte) 131 }), InetAddress.getByAddress("", new byte[] { 10, 64, 33, 17 }), 8));
45 | assertFalse(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 7, 0, (byte) 131 }), InetAddress.getByAddress("", new byte[] { 10, 64, 33, 17 }), 16));
46 | assertFalse(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 7, 0, (byte) 131 }), InetAddress.getByAddress("", new byte[] { 10, 64, 33, 17 }), 24));
47 |
48 | assertTrue(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), InetAddress.getByAddress("", new byte[] { 127, (byte) 192, 33, 17 }), 0));
49 | assertTrue(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), 32));
50 | assertFalse(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), InetAddress.getByAddress("", new byte[] { 10, 0, 0, 2 }), 32));
51 | assertFalse(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), InetAddress.getByAddress("", new byte[] { (byte) 138, 0, 0, 1 }), 32));
52 | assertFalse(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { 10, 0, 0, 2 }), InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), 32));
53 | assertFalse(NetworkUtil.belongsToNetwork(InetAddress.getByAddress("", new byte[] { (byte) 138, 0, 0, 1 }), InetAddress.getByAddress("", new byte[] { 10, 0, 0, 1 }), 32));
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/test/resources/broken-server-jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2019 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
20 |
21 | remote.connections=one,two
22 |
23 | # connection to a node at protocol://host:port
24 | remote.connection.one.host=localhost
25 | remote.connection.one.port=6999
26 | remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
27 | remote.connection.one.username=test
28 | remote.connection.one.password=test
29 | remote.connection.one.protocol=remote
30 | remote.connection.two.host=localhost
31 | remote.connection.two.port=7099
32 | remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
33 | remote.connection.two.username=test
34 | remote.connection.two.password=test
35 | remote.connection.two.protocol=remote
36 |
--------------------------------------------------------------------------------
/src/test/resources/cluster-node-selector-jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2010 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
20 |
21 | remote.connections=one,two
22 |
23 | # connection to a node at protocol://host:port
24 | remote.connection.one.host=localhost
25 | remote.connection.one.port=6999
26 | remote.connection.one.protocol=remote
27 | remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
28 | remote.connection.one.username=test
29 | remote.connection.one.password=test
30 | remote.connection.one.realm=default
31 |
32 | # connection to a node at protocol://host:port
33 | remote.connection.two.host=localhost
34 | remote.connection.two.port=7099
35 | remote.connection.two.protocol=remote
36 | remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
37 | remote.connection.two.username=test
38 | remote.connection.two.password=test
39 | remote.connection.two.realm=default
40 |
41 | # the nodes are clustered in a cluster called ejb and have names node1, node2
42 | remote.clusters=ejb
43 | remote.cluster.ejb.node.node1.username=test
44 | remote.cluster.ejb.node.node1.password=test
45 | remote.cluster.ejb.clusternode.selector=org.jboss.ejb.client.test.ClusterNodeSelectorTestCase$TestSelector
46 | #remote.cluster.ejb.node.node2.username=test
47 | #remote.cluster.ejb.node.node2.password=test
--------------------------------------------------------------------------------
/src/test/resources/clustered-jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2010 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
20 |
21 | remote.connections=one,two,three
22 |
23 | # connection to a node at protocol://host:port
24 | remote.connection.one.host=localhost
25 | remote.connection.one.port=6999
26 | remote.connection.one.protocol=remote
27 | remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
28 | remote.connection.one.username=test
29 | remote.connection.one.password=test
30 | remote.connection.one.realm=default
31 |
32 | # connection to a node at protocol://host:port
33 | remote.connection.two.host=localhost
34 | remote.connection.two.port=7099
35 | remote.connection.two.protocol=remote
36 | remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
37 | remote.connection.two.username=test
38 | remote.connection.two.password=test
39 | remote.connection.two.realm=default
40 |
41 | # connection to a node at protocol://host:port
42 | remote.connection.three.host=localhost
43 | remote.connection.three.port=7199
44 | remote.connection.three.protocol=remote
45 | remote.connection.three.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
46 | remote.connection.three.username=test
47 | remote.connection.three.password=test
48 | remote.connection.three.realm=default
49 |
50 | # the nodes are clustered in a cluster called ejb and have names node1, node2
51 | remote.clusters=ejb
52 | remote.cluster.ejb.node.node1.username=test
53 | remote.cluster.ejb.node.node1.password=test
54 | remote.cluster.ejb.node.node2.username=test
55 | remote.cluster.ejb.node.node2.password=test
--------------------------------------------------------------------------------
/src/test/resources/deployment-node-selector-jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2010 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
20 |
21 | remote.connections=one,two
22 |
23 | deployment.node.selector=org.jboss.ejb.client.test.DeploymentNodeSelectorTestCase$TestSelector
24 |
25 | # connection to a node at protocol://host:port
26 | remote.connection.one.host=localhost
27 | remote.connection.one.port=6999
28 | remote.connection.one.protocol=remote
29 | remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
30 | remote.connection.one.username=test
31 | remote.connection.one.password=test
32 | remote.connection.one.realm=default
33 |
34 | # connection to a node at protocol://host:port
35 | remote.connection.two.host=localhost
36 | remote.connection.two.port=7099
37 | remote.connection.two.protocol=remote
38 | remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
39 | remote.connection.two.username=test
40 | remote.connection.two.password=test
41 | remote.connection.two.realm=default
42 |
43 |
--------------------------------------------------------------------------------
/src/test/resources/jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2010 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
20 |
21 | remote.connections=one,two
22 |
23 | # connection to a node at protocol://host:port
24 | remote.connection.one.host=localhost
25 | remote.connection.one.port=6999
26 | remote.connection.one.protocol=remote
27 | remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
28 | remote.connection.one.username=test
29 | remote.connection.one.password=test
30 |
31 | # connection to a node at protocol://host:port
32 | remote.connection.two.host=localhost
33 | remote.connection.two.port=7099
34 | remote.connection.two.protocol=remote
35 | remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
36 | remote.connection.two.username=test
37 | remote.connection.two.password=test
38 |
--------------------------------------------------------------------------------
/src/test/resources/jndi.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2011 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
20 |
--------------------------------------------------------------------------------
/src/test/resources/last-node-to-leave-jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2019 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
20 |
21 | remote.connections=one,two
22 |
23 | # connection to a node at protocol://host:port
24 | remote.connection.one.host=localhost
25 | remote.connection.one.port=6999
26 | remote.connection.one.protocol=remote
27 | remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
28 | remote.connection.one.username=test
29 | remote.connection.one.password=test
30 | remote.connection.one.realm=default
31 |
32 | # connection to a node at protocol://host:port
33 | remote.connection.two.host=localhost
34 | remote.connection.two.port=7099
35 | remote.connection.two.protocol=remote
36 | remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
37 | remote.connection.two.username=test
38 | remote.connection.two.password=test
39 | remote.connection.two.realm=default
40 |
41 | # the nodes are clustered in a cluster called ejb and have names node1, node2
42 | remote.clusters=ejb
43 | remote.cluster.ejb.node.node1.username=test
44 | remote.cluster.ejb.node.node1.password=test
45 | remote.cluster.ejb.clusternode.selector=org.jboss.ejb.client.test.LastNodeToLeaveTestCase$TestSelector
46 |
--------------------------------------------------------------------------------
/src/test/resources/logging.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2010 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | # Additional logger names to configure (root logger is always configured)
20 | loggers=javax.security.sasl,org.xnio.ssl,org.xnio,org.jboss.ejb.client,javax.management
21 |
22 | # Root logger configuration
23 | logger.level=${test.level:INFO}
24 | logger.handlers=CONSOLE, FILE
25 |
26 | logger.javax.security.sasl.level=INFO
27 | logger.org.xnio.ssl.level=INFO
28 | logger.org.xnio.level=INFO
29 | logger.org.jboss.ejb.client.level=DEBUG
30 | logger.javax.management.level=INFO
31 |
32 | # Console handler configuration
33 | handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
34 | handler.CONSOLE.properties=autoFlush
35 | handler.CONSOLE.level=${test.level:DEBUG}
36 | handler.CONSOLE.autoFlush=true
37 | handler.CONSOLE.formatter=PATTERN
38 |
39 | # File handler configuration
40 | handler.FILE=org.jboss.logmanager.handlers.FileHandler
41 | handler.FILE.level=${test.level:DEBUG}
42 | handler.FILE.properties=autoFlush,fileName
43 | handler.FILE.autoFlush=true
44 | handler.FILE.fileName=./target/test.log
45 | handler.FILE.formatter=PATTERN
46 |
47 | # Formatter pattern configuration
48 | formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
49 | formatter.PATTERN.properties=pattern
50 | formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n
51 |
52 |
--------------------------------------------------------------------------------
/src/test/resources/maximum-connected-nodes-jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | remote.clusters=ejb1,ejb2
2 | remote.cluster.ejb2.max-allowed-connected-nodes=42
3 |
--------------------------------------------------------------------------------
/src/test/resources/mixed-mode-wildfly-client.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/test/resources/no-protocol-jboss-ejb-client.properties:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2019 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
20 |
21 | remote.connections=one
22 |
23 | # connection to a node at protocol://host:port
24 | remote.connection.one.host=localhost
25 | remote.connection.one.port=6999
26 | remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
27 | remote.connection.one.username=test
28 | remote.connection.one.password=test
29 |
--------------------------------------------------------------------------------
/src/test/resources/org/jboss/ejb/client/test/byteman/BytemanTransactionTestCase.btm:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2022 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | RULE @1 get TransactionClientChannel.peerConnectionMap size
18 | CLASS org.wildfly.transaction.client.provider.remoting.RemotingRemoteTransactionHandle
19 | AT EXIT
20 | METHOD commit
21 | BIND handle:RemotingRemoteTransactionHandle = $0;
22 | IF TRUE
23 | DO System.setProperty("peerMapSize", Integer.toString(handle.channel.peerTransactionMap.size()));
24 | ENDRULE
--------------------------------------------------------------------------------
/src/test/resources/org/jboss/ejb/client/test/byteman/OOMEInInvocationTestCase.btm:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2019 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | RULE @1 cause OOM
19 | CLASS org.jboss.marshalling.river.RiverMarshaller
20 | AT ENTRY
21 | METHOD doWriteObject
22 | IF TRUE
23 | DO
24 | throw new OutOfMemoryError("Byteman throwing OOM");
25 | ENDRULE
26 |
27 | RULE @2 cause Exception
28 | CLASS org.jboss.ejb.client.EJBReceiverInvocationContext
29 | AT EXIT
30 | METHOD toString
31 | BIND result = $toString.toString()
32 | IF (result.contains("echo"))
33 | DO System.setProperty("echo", "true");
34 | ENDRULE
--------------------------------------------------------------------------------
/src/test/resources/org/jboss/ejb/client/test/byteman/TimeoutRetryTestCase.btm:
--------------------------------------------------------------------------------
1 | #
2 | # JBoss, Home of Professional Open Source.
3 | # Copyright 2019 Red Hat, Inc., and individual contributors
4 | # as indicated by the @author tags.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | RULE @1 delay invocation
19 | CLASS org.jboss.ejb.client.EJBClientInvocationContext
20 | AT ENTRY
21 | METHOD retryOperation
22 | IF TRUE
23 | DO
24 | Thread.sleep(3000)
25 | ENDRULE
26 |
--------------------------------------------------------------------------------
/src/test/resources/wildfly-client.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------