Search in sources :

Example 11 with SimpleURI

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();
}
Also used : SimpleURI(ai.grakn.util.SimpleURI) RedisServer(ai.grakn.redismock.RedisServer) Test(org.junit.Test)

Example 12 with SimpleURI

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;
}
Also used : GraknConfig(ai.grakn.engine.GraknConfig) Properties(java.util.Properties) URI(java.net.URI) SimpleURI(ai.grakn.util.SimpleURI)

Aggregations

SimpleURI (ai.grakn.util.SimpleURI)12 RedisServer (ai.grakn.redismock.RedisServer)4 Test (org.junit.Test)4 Keyspace (ai.grakn.Keyspace)2 GraknConfig (ai.grakn.engine.GraknConfig)2 IOException (java.io.IOException)2 GraknSession (ai.grakn.GraknSession)1 Grakn (ai.grakn.bootup.graknengine.Grakn)1 RedisWrapper (ai.grakn.engine.data.RedisWrapper)1 StatusRuntimeException (io.grpc.StatusRuntimeException)1 File (java.io.File)1 HttpURLConnection (java.net.HttpURLConnection)1 URI (java.net.URI)1 URL (java.net.URL)1 Path (java.nio.file.Path)1 Properties (java.util.Properties)1 ConsoleReader (jline.console.ConsoleReader)1 ZipFile (net.lingala.zip4j.core.ZipFile)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1