Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dnno
dnno / keybase.md
Last active May 5, 2016 21:43
keybase.md

Keybase proof

I hereby claim:

  • I am dnno on github.
  • I am reinhard (https://keybase.io/reinhard) on keybase.
  • I have a public key whose fingerprint is 15A6 CE79 3C62 DAD1 2219 7143 DDEC A160 D8E4 0151

To claim this, I am signing this object:

public InfinispanContainer configurationFile(final String classPathResourceName) {
URL resourceUrl = this.getClass().getClassLoader().getResource(classPathResourceName);
if (resourceUrl == null) {
throw new IllegalArgumentException("Cannot read configuration resource");
}
return withFileSystemBind(new File(resourceUrl.getFile()).getAbsolutePath(),
"/opt/jboss/infinispan-server/standalone/configuration/standalone.xml",
BindMode.READ_ONLY);
}
<hotrod-connector socket-binding="hotrod" cache-container="clustered">
<topology-state-transfer
lazy-retrieval="false"
lock-timeout="1000"
replication-timeout="5000" />
</hotrod-connector>
public class DisabledTopologyStateTransferTransportFactory extends TcpTransportFactory {
private static final Logger LOG = LoggerFactory.getLogger(DisabledTopologyStateTransferTransportFactory.class);
@Override
public void updateServers(final Collection<SocketAddress> newServers, final byte[] cacheName, final boolean quiet) {
LOG.info("Receiving new Servers: {}. Ignoring...", newServers);
}
}
private Configuration getCacheManagerConfiguration() {
ConfigurationBuilder configBuilder = new ConfigurationBuilder()
.addServers(getHotrodEndpointConnectionString())
.version(getProtocolVersion());
getTransportFactory().ifPresent(transportFactory -> {
configBuilder.transportFactory(transportFactory);
});
return configBuilder.build();
@ClassRule
public static GenericContainer infinispan =
new GenericContainer("jboss/infinispan-server:9.1.3.Final");
@Before
public void setup(){
cacheManager = new RemoteCacheManager(new ConfigurationBuilder()
.addServers(getServerAddress())
.version(ProtocolVersion.PROTOCOL_VERSION_26)
.build());
@ClassRule
public static GenericContainer container =
new GenericContainer("jboss/infinispan-server:9.1.3.Final")
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*Infinispan Server.*started in.*\\s"));
private ExecutorService executorService = Executors.newCachedThreadPool();
@Test
public void should_be_able_to_retrieve_a_cache() throws Exception {
Future<RemoteCache<Object, Object>> result =
executorService.submit(() -> cacheManager.getCache());
assertNotNull(result.get(1500, TimeUnit.MILLISECONDS));
}
public static GenericContainer container =
new GenericContainer("jboss/infinispan-server:9.1.3.Final")
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*Infinispan Server.*started in.*\\s"))
.withCommand("standalone");
public static GenericContainer container =
new GenericContainer("jboss/infinispan-server:9.1.3.Final")
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*Infinispan Server.*started in.*\\s"))
.withCommand("standalone")
.withClasspathResourceMapping(
"infinispan-standalone.xml",
"/opt/jboss/infinispan-server/standalone/configuration/standalone.xml",
BindMode.READ_ONLY);