Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISPN-171] (Build a server module based on the HotRod protocol) Forgo…
…t to add ClusterTest.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
server/hotrod/src/test/scala/org/infinispan/server/hotrod/ClusterTest.scala
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,51 @@ | ||
package org.infinispan.server.hotrod | ||
|
||
import org.infinispan.test.MultipleCacheManagersTest | ||
import org.infinispan.config.Configuration | ||
import org.jboss.netty.channel.Channel | ||
import test.{Utils, Client} | ||
import java.lang.reflect.Method | ||
import org.infinispan.manager.CacheManager | ||
import org.testng.annotations.{BeforeClass, AfterClass, Test} | ||
import org.infinispan.config.Configuration.CacheMode | ||
|
||
/** | ||
* // TODO: Document this | ||
* @author Galder Zamarreño | ||
* @since | ||
*/ | ||
|
||
@Test(groups = Array("functional"), testName = "server.hotrod.ClusterTest") | ||
class ClusterTest extends MultipleCacheManagersTest with Utils with Client { | ||
private val cacheName = "hotRodReplSync" | ||
private var servers: List[HotRodServer] = List() | ||
private var channels: List[Channel] = List() | ||
|
||
@Test(enabled=false) // Disable explicitly to avoid TestNG thinking this is a test!! | ||
override def createCacheManagers { | ||
var replSync = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC) | ||
createClusteredCaches(2, cacheName, replSync) | ||
servers = createHotRodServer(cacheManagers.get(0)) :: servers | ||
servers = createHotRodServer(cacheManagers.get(1), servers.head.port + 50) :: servers | ||
servers.foreach { | ||
s => s.start | ||
channels = connect("127.0.0.1", s.port) :: channels | ||
} | ||
} | ||
|
||
@AfterClass(alwaysRun = true) | ||
override def destroy { | ||
super.destroy | ||
log.debug("Test finished, close Hot Rod server", null) | ||
servers.foreach(_.stop) | ||
} | ||
|
||
@Test | ||
def tesReplicatedPut(m: Method) { | ||
val putSt = put(channels.head, cacheName, k(m) , 0, 0, v(m)) | ||
assertSuccess(putSt) | ||
val (getSt, actual) = get(channels.tail.head, cacheName, k(m), null) | ||
assertSuccess(getSt, v(m), actual) | ||
} | ||
|
||
} |