use of ai.grakn.util.SimpleURI in project grakn by graknlabs.
the class RedisWrapperTest method whenBuildingSentinelWellFormed_JedisCantConnect.
@Test(expected = JedisConnectionException.class)
public void whenBuildingSentinelWellFormed_JedisCantConnect() {
RedisServer server = inMemoryRedisContext.server();
RedisWrapper.builder().setUseSentinel(true).addURI(new SimpleURI(server.getHost(), server.getBindPort()).toString()).setMasterName("masterName").build();
}
use of ai.grakn.util.SimpleURI in project grakn by graknlabs.
the class EmbeddedGraknSession method getTxRemoteConfig.
/**
* Gets the properties needed to create a {@link GraknTx} by pinging engine for the config file
*
* @return the properties needed to build a {@link GraknTx}
*/
private static GraknConfig getTxRemoteConfig(SimpleURI uri, Keyspace keyspace) {
URI keyspaceUri = UriBuilder.fromUri(uri.toURI()).path(REST.resolveTemplate(REST.WebPath.KB_KEYSPACE, keyspace.getValue())).build();
Properties properties = new Properties();
// Get Specific Configs
properties.putAll(read(contactEngine(Optional.of(keyspaceUri), REST.HttpConn.PUT_METHOD)).asMap());
GraknConfig config = GraknConfig.of(properties);
// Overwrite Engine IP with something which is remotely accessible
config.setConfigProperty(GraknConfigKey.SERVER_HOST_NAME, uri.getHost());
config.setConfigProperty(GraknConfigKey.SERVER_PORT, uri.getPort());
return config;
}
Aggregations