-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add explanatory javadoc to all of the testcases for this project.
- Loading branch information
1 parent
5452fb4
commit 10df538
Showing
33 changed files
with
667 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,8 @@ | |
import org.junit.Test; | ||
|
||
/** | ||
* Tests some basic features of ConfigurationBasedEJBClientContextSelector | ||
* Tests some basic features of ConfigurationBasedEJBClientContextSelector, responsible for initialization of | ||
* the contextual for EJBClientContext. | ||
* | ||
* @author <a href="mailto:[email protected]">Joerg Baesner</a> | ||
*/ | ||
|
@@ -36,8 +37,8 @@ public class ConfigurationBasedEJBClientContextSelectorTestCase { | |
private static final String CONFIGURATION_FILE = "wildfly-client.xml"; | ||
|
||
/** | ||
* Do any general setup here | ||
* | ||
* Configure the wildfly-client.xml file to be used in initialize the EJBClientConext. | ||
* | ||
* @throws Exception | ||
*/ | ||
@BeforeClass | ||
|
@@ -50,6 +51,9 @@ public static void beforeClass() throws Exception { | |
ClassCallback.beforeClassCallback(); | ||
} | ||
|
||
/** | ||
* A test which validates that the EJBCLientContext has been initialized with the configured DeploymentNodeSelector. | ||
*/ | ||
@Test | ||
public void testDeploymentNodeSelector() { | ||
EJBClientContext clientContext = EJBClientContext.getCurrent(); | ||
|
@@ -60,6 +64,9 @@ public void testDeploymentNodeSelector() { | |
Assert.assertEquals("Wrong <selectNode> value,", DummyNodeSelector.DEPLOYMENT_NODE_IDENTIFIER, dns.selectNode(null, null, null, null)); | ||
} | ||
|
||
/** | ||
* A test which validates that the EJBCLientContext has been initialized with the configured ClusterNodeSelector. | ||
*/ | ||
@Test | ||
public void testClusterNodeSelector() { | ||
EJBClientContext clientContext = EJBClientContext.getCurrent(); | ||
|
@@ -70,12 +77,15 @@ public void testClusterNodeSelector() { | |
Assert.assertEquals("Wrong <selectNode> value,", DummyNodeSelector.CLUSTER_NODE_IDENTIFIER, cns.selectNode(null, null, null)); | ||
} | ||
|
||
/** | ||
* A test which validates that the EJBCLientContext has been initialized with the configured value for | ||
* the max-allowed-connected-nodes property. | ||
*/ | ||
@Test | ||
public void testMaximumAllowedClusterNodes() { | ||
EJBClientContext clientContext = EJBClientContext.getCurrent(); | ||
int nodes = clientContext.getMaximumConnectedClusterNodes(); | ||
|
||
Assert.assertEquals("Wrong <max-allowed-connected-nodes> value,", 15, nodes); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,12 +24,22 @@ | |
import org.junit.Test; | ||
|
||
/** | ||
* Tests on DiscoveryEJBClientInterceptor | ||
* Tests for the DiscoveryEJBClientInterceptor | ||
* | ||
* @author <a href="mailto:[email protected]">Lin Gao</a> | ||
*/ | ||
public class DiscoveryEJBClientInterceptorTestCase { | ||
|
||
/** | ||
* A test for the "blocklist" feature of the DiscoveryEJBClientInterceptor which allows invocation targets | ||
* to be added to a blocklist. Presence of a URL on the blocklist eans that they should currently be excluded | ||
* from discovery request results. The blocklist has an associated timeout; blocklisted entries are cleared | ||
* once their time in the blocklist has passed the timeout to avoid being blocklisted forever. | ||
* | ||
* THis test validates the addition of a URL to the blicklist, as well as its expiration from the blocklist. | ||
* | ||
* @throws Exception | ||
*/ | ||
@Test | ||
public void testBlocklist() throws Exception { | ||
long timeout = 1000L; | ||
|
@@ -44,9 +54,8 @@ public void requestRetry() { | |
Assert.assertTrue(DiscoveryEJBClientInterceptor.isBlocklisted(context, destination)); | ||
Assert.assertEquals(1, DiscoveryEJBClientInterceptor.getBlocklist().size()); | ||
|
||
// If sleeping for just the timeout duration, the lifespan of | ||
// the blocklist may equal to, but not greater than, the configured | ||
// timeout, and so will not be removed yet. So sleep a bit longer. | ||
// If sleeping for just the timeout duration, the lifespan of the blocklist may equal to, but not greater than, | ||
// the configured timeout, and so will not be removed yet. So sleep a bit longer. | ||
Thread.sleep(timeout * 2); | ||
Assert.assertFalse(DiscoveryEJBClientInterceptor.isBlocklisted(context, destination)); | ||
Assert.assertEquals(0, DiscoveryEJBClientInterceptor.getBlocklist().size()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,27 @@ | |
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Tests to verify that configuration of the EJBClientContext by a legacy jboss-ejb-client.properties file works | ||
* as expected. The jboss-ejb-client.properties file allows configuring invocation-related properties for the | ||
* EJBClientContext at three different levels: | ||
* - invocations targetting singleton nodes | ||
* - invocations targetting clusters | ||
* - invocations targetting specific nodes in clusters | ||
* | ||
* @author <a href="mailto:[email protected]">Thomas Hofman</a> | ||
*/ | ||
public class LegacyPropertiesConfigurationTestCase { | ||
|
||
private static final String PROPERTIES_FILE_MAX_NODES_SET = "maximum-connected-nodes-jboss-ejb-client.properties"; | ||
private static final String PROPERTIES_FILE_MAX_NODES_NOT_SET = "clustered-jboss-ejb-client.properties"; | ||
|
||
/** | ||
* Tests that values configured for the cluster property "max-allowed-connected-nodes" are passed through | ||
* to the resulting EJBClientContext. | ||
* | ||
* @throws IOException | ||
*/ | ||
@Test | ||
public void testMaximumConnectedNodesSet() throws IOException { | ||
JBossEJBProperties ejbProperties = JBossEJBProperties.fromClassPath(JBossEJBProperties.class.getClassLoader(), PROPERTIES_FILE_MAX_NODES_SET); | ||
|
@@ -21,6 +37,12 @@ public void testMaximumConnectedNodesSet() throws IOException { | |
Assert.assertEquals(42, context.getMaximumConnectedClusterNodes()); | ||
} | ||
|
||
/** | ||
* Tests that default values configured for the cluster property "max-allowed-connected-nodes" are passed through | ||
* to the resulting EJBClientContext when the property is not set. | ||
* | ||
* @throws IOException | ||
*/ | ||
@Test | ||
public void testMaximumConnectedNodesNotSet() throws IOException { | ||
JBossEJBProperties ejbProperties = JBossEJBProperties.fromClassPath(JBossEJBProperties.class.getClassLoader(), PROPERTIES_FILE_MAX_NODES_NOT_SET); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* Test framework class representing a method invocation and its associated data. | ||
* | ||
* @author <a href="mailto:[email protected]">Carlo de Wolf</a> | ||
*/ | ||
public class MethodInvocationRequest { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.