-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add server integration test for IRAC
- Loading branch information
Showing
10 changed files
with
241 additions
and
10 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
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
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
54 changes: 54 additions & 0 deletions
54
server/tests/src/test/java/org/infinispan/server/functional/XSiteHotRodCacheOperations.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,54 @@ | ||
package org.infinispan.server.functional; | ||
|
||
import org.infinispan.client.hotrod.RemoteCache; | ||
import org.infinispan.commons.configuration.XMLStringConfiguration; | ||
import org.infinispan.commons.test.Eventually; | ||
import org.infinispan.server.test.junit4.InfinispanServerRule; | ||
import org.infinispan.server.test.junit4.InfinispanServerTestMethodRule; | ||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @author Pedro Ruivo | ||
* @since 11.0 | ||
**/ | ||
public class XSiteHotRodCacheOperations { | ||
|
||
@ClassRule | ||
public static final InfinispanServerRule LON_SERVERS = XSiteIT.LON_SERVERS; | ||
@ClassRule | ||
public static final InfinispanServerRule NYC_SERVERS = XSiteIT.NYC_SERVERS; | ||
|
||
private static final String LON_CACHE_XML_CONFIG = | ||
"<infinispan><cache-container>" + | ||
" <distributed-cache-configuration name=\"%s\">" + | ||
" <backups>" + | ||
" <backup site=\"NYC\" strategy=\"ASYNC\"/>" + | ||
" </backups>" + | ||
" </distributed-cache-configuration>" + | ||
"</cache-container></infinispan>"; | ||
@Rule | ||
public InfinispanServerTestMethodRule LON_SERVER_TEST = new InfinispanServerTestMethodRule(XSiteIT.LON_SERVERS); | ||
|
||
@Rule | ||
public InfinispanServerTestMethodRule NYC_SERVER_TEST = new InfinispanServerTestMethodRule(XSiteIT.NYC_SERVERS); | ||
|
||
@Test | ||
public void testHotRodOperations() { | ||
String lonXML = String.format(LON_CACHE_XML_CONFIG, LON_SERVER_TEST.getMethodName()); | ||
|
||
RemoteCache<String, String> lonCache = LON_SERVER_TEST.hotrod() | ||
.withServerConfiguration(new XMLStringConfiguration(lonXML)).create(); | ||
RemoteCache<String, String> nycCache = NYC_SERVER_TEST.hotrod().create(); //must have the same name as LON cache | ||
|
||
lonCache.put("k1", "v1"); | ||
nycCache.put("k2", "v2"); //nyc cache don't backup to lon | ||
|
||
Eventually.eventuallyEquals("v1", () -> lonCache.get("k1")); | ||
Eventually.eventuallyEquals("v1", () -> nycCache.get("k1")); | ||
|
||
Eventually.eventuallyEquals(null, () -> lonCache.get("k2")); | ||
Eventually.eventuallyEquals("v2", () -> nycCache.get("k2")); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
server/tests/src/test/java/org/infinispan/server/functional/XSiteIT.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,33 @@ | ||
package org.infinispan.server.functional; | ||
|
||
import org.infinispan.server.test.core.InfinispanServerTestConfiguration; | ||
import org.infinispan.server.test.junit4.InfinispanServerRule; | ||
import org.infinispan.server.test.junit4.InfinispanServerRuleBuilder; | ||
import org.junit.ClassRule; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Suite; | ||
|
||
/** | ||
* Cross-Site suite | ||
* | ||
* @author Pedro Ruivo | ||
* @since 11.0 | ||
*/ | ||
@RunWith(Suite.class) | ||
@Suite.SuiteClasses({ | ||
XSiteHotRodCacheOperations.class | ||
}) | ||
public class XSiteIT { | ||
@ClassRule | ||
public static final InfinispanServerRule LON_SERVERS = | ||
InfinispanServerRuleBuilder.config("configuration/XSiteServerTest.xml") | ||
.numServers(3) | ||
.site(InfinispanServerTestConfiguration.LON) | ||
.build(); | ||
@ClassRule | ||
public static final InfinispanServerRule NYC_SERVERS = | ||
InfinispanServerRuleBuilder.config("configuration/XSiteServerTest.xml") | ||
.numServers(3) | ||
.site(InfinispanServerTestConfiguration.NYC) | ||
.build(); | ||
} |
23 changes: 23 additions & 0 deletions
23
server/tests/src/test/resources/configuration/XSiteServerTest.xml
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,23 @@ | ||
<infinispan | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:xi="http://www.w3.org/2001/XInclude" | ||
xsi:schemaLocation="urn:infinispan:config:11.0 https://infinispan.org/schemas/infinispan-config-11.0.xsd | ||
urn:infinispan:server:11.0 https://infinispan.org/schemas/infinispan-server-11.0.xsd" | ||
xmlns="urn:infinispan:config:11.0" | ||
xmlns:server="urn:infinispan:server:11.0"> | ||
|
||
<xi:include href="jgroups/xsite-stacks.xml"/> | ||
|
||
<xi:include href="cache-container/clustered.xml"/> | ||
|
||
<server xmlns="urn:infinispan:server:11.0"> | ||
|
||
<xi:include href="interfaces/default.xml"/> | ||
|
||
<xi:include href="socket-bindings/default.xml"/> | ||
|
||
<xi:include href="security/none.xml"/> | ||
|
||
<xi:include href="endpoints/default.xml"/> | ||
</server> | ||
</infinispan> |
57 changes: 57 additions & 0 deletions
57
server/tests/src/test/resources/configuration/jgroups/xsite-stacks.xml
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,57 @@ | ||
<jgroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="urn:infinispan:config:11.0 https://infinispan.org/schemas/infinispan-config-fragment-11.0.xsd | ||
urn:org:jgroups http://www.jgroups.org/schema/jgroups-4.0.xsd" | ||
xmlns="urn:infinispan:config:11.0" | ||
xmlns:ispn="urn:infinispan:config:11.0"> | ||
<stack name="test-tcp" extends="tcp"> | ||
<MPING bind_addr="${jgroups.bind.address,jgroups.tcp.address:127.0.0.1}" | ||
mcast_addr="${jgroups.mcast_addr:228.6.7.8}" | ||
mcast_port="${jgroups.cluster.mcast_port}" | ||
num_discovery_runs="3" | ||
ip_ttl="${jgroups.udp.ip_ttl:2}" | ||
ispn:stack.combine="REPLACE" | ||
/> | ||
<MERGE3 min_interval="1000" max_interval="5000" ispn:stack.combine="REPLACE"/> | ||
<FD_SOCK sock_conn_timeout="3000"/> | ||
<FD_ALL3 timeout="3000" | ||
interval="1000" | ||
ispn:stack.combine="REPLACE" ispn:stack.position="FD_ALL"/> | ||
<relay.RELAY2 site="${relay.site_name}" max_site_masters="3" xmlns="urn:org:jgroups"/> | ||
<remote-sites default-stack="tcp"> | ||
<remote-site name="LON"/> | ||
<remote-site name="NYC"/> | ||
</remote-sites> | ||
</stack> | ||
<stack name="test-udp" extends="udp"> | ||
<UDP bind_addr="${jgroups.bind.address,jgroups.udp.address:SITE_LOCAL}" | ||
bind_port="${jgroups.bind.port,jgroups.udp.port:0}" | ||
mcast_addr="${jgroups.mcast_addr:228.6.7.8}" | ||
mcast_port="${jgroups.cluster.mcast_port}" | ||
tos="0" | ||
ucast_send_buf_size="1m" | ||
mcast_send_buf_size="1m" | ||
ucast_recv_buf_size="20m" | ||
mcast_recv_buf_size="25m" | ||
ip_ttl="${jgroups.ip_ttl:2}" | ||
thread_naming_pattern="pl" | ||
enable_diagnostics="false" | ||
bundler_type="no-bundler" | ||
max_bundle_size="8500" | ||
|
||
thread_pool.min_threads="${jgroups.thread_pool.min_threads:0}" | ||
thread_pool.max_threads="${jgroups.thread_pool.max_threads:200}" | ||
thread_pool.keep_alive_time="60000" | ||
ispn:stack.combine="REPLACE" | ||
/> | ||
<MERGE3 min_interval="1000" max_interval="5000" ispn:stack.combine="REPLACE"/> | ||
<FD_SOCK sock_conn_timeout="3000"/> | ||
<FD_ALL3 timeout="3000" | ||
interval="1000" | ||
ispn:stack.combine="REPLACE" ispn:stack.position="FD_ALL"/> | ||
<relay.RELAY2 site="${relay.site_name}" max_site_masters="3" xmlns="urn:org:jgroups"/> | ||
<remote-sites default-stack="tcp"> | ||
<remote-site name="LON"/> | ||
<remote-site name="NYC"/> | ||
</remote-sites> | ||
</stack> | ||
</jgroups> |