Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISPN-10080 Test cache managers created in other threads cannot with UDP
- Loading branch information
1 parent
93ae5c2
commit eb71d4b
Showing
2 changed files
with
59 additions
and
19 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
core/src/test/java/org/infinispan/statetransfer/JoinInNewThreadTest.java
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.infinispan.statetransfer; | ||
|
||
import static java.util.concurrent.TimeUnit.SECONDS; | ||
|
||
import java.util.concurrent.Future; | ||
|
||
import org.infinispan.configuration.cache.CacheMode; | ||
import org.infinispan.configuration.cache.ConfigurationBuilder; | ||
import org.infinispan.test.MultipleCacheManagersTest; | ||
import org.infinispan.test.fwk.CleanupAfterMethod; | ||
import org.infinispan.test.fwk.TestResourceTracker; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Test that a node started in a different thread can join the cluster. | ||
* | ||
* @author Dan Berindei | ||
* @since 10.0 | ||
*/ | ||
@Test(testName = "statetransfer.JoinInNewThreadTest", groups = "functional") | ||
@CleanupAfterMethod | ||
public class JoinInNewThreadTest extends MultipleCacheManagersTest { | ||
@Override | ||
protected void createCacheManagers() throws Throwable { | ||
// Do nothing here | ||
} | ||
|
||
public void testJoinInNewThread() throws Exception { | ||
TestResourceTracker.setThreadTestName(JoinInNewThreadTest.class.getName()); | ||
|
||
ConfigurationBuilder replCfg = new ConfigurationBuilder(); | ||
replCfg.clustering().cacheMode(CacheMode.REPL_SYNC).stateTransfer().timeout(30, SECONDS); | ||
|
||
// Connect 2 channels | ||
addClusterEnabledCacheManager(replCfg); | ||
addClusterEnabledCacheManager(replCfg); | ||
waitForClusterToForm(); | ||
|
||
Future<Void> future = fork(() -> { | ||
TestResourceTracker.testThreadStarted(this); | ||
addClusterEnabledCacheManager(replCfg); | ||
waitForClusterToForm(); | ||
}); | ||
future.get(30, SECONDS); | ||
} | ||
} |
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