Search in sources :

Example 1 with Settings

use of org.apache.tinkerpop.gremlin.server.Settings in project janusgraph by JanusGraph.

the class JanusGraphSettingsUtilsTest method testSetDefaultSerializersWithGryoWithResultToString.

@Test
public void testSetDefaultSerializersWithGryoWithResultToString() throws Exception {
    Settings settings = JanusGraphSettings.read("src/test/resources/janusgraph-server-without-serializers.yaml");
    Optional<Settings.SerializerSettings> graphBinary = settings.serializers.stream().filter(it -> it.className.equals("org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0")).skip(1).findFirst();
    assertTrue(graphBinary.isPresent());
    assertTrue((boolean) graphBinary.get().config.get("serializeResultToString"));
}
Also used : Settings(org.apache.tinkerpop.gremlin.server.Settings) JanusGraphSettings(org.janusgraph.graphdb.server.JanusGraphSettings) Test(org.junit.jupiter.api.Test)

Example 2 with Settings

use of org.apache.tinkerpop.gremlin.server.Settings in project janusgraph by JanusGraph.

the class JanusGraphSettingsUtilsTest method testSetDefaultSerializersWithGryoWithRegistry.

@Test
public void testSetDefaultSerializersWithGryoWithRegistry() throws Exception {
    Settings settings = JanusGraphSettings.read("src/test/resources/janusgraph-server-without-serializers.yaml");
    Optional<Settings.SerializerSettings> gryo = settings.serializers.stream().filter(it -> it.className.equals("org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0") && it.config.get("ioRegistries") != null).findFirst();
    assertTrue(gryo.isPresent());
    assertTrue(((List) gryo.get().config.get("ioRegistries")).contains("org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry"));
}
Also used : Test(org.junit.jupiter.api.Test) List(java.util.List) Settings(org.apache.tinkerpop.gremlin.server.Settings) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Optional(java.util.Optional) JanusGraphSettings(org.janusgraph.graphdb.server.JanusGraphSettings) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Settings(org.apache.tinkerpop.gremlin.server.Settings) JanusGraphSettings(org.janusgraph.graphdb.server.JanusGraphSettings) Test(org.junit.jupiter.api.Test)

Example 3 with Settings

use of org.apache.tinkerpop.gremlin.server.Settings in project janusgraph by JanusGraph.

the class JanusGraphServerTest method testSerializersAreConfigured.

@Test
public void testSerializersAreConfigured() {
    final JanusGraphServer server = new JanusGraphServer("src/test/resources/janusgraph-server-without-serializers.yaml");
    CompletableFuture<Void> start = server.start();
    assertFalse(start.isCompletedExceptionally());
    Settings settings = server.getJanusGraphSettings();
    assertEquals(5, settings.serializers.size());
    CompletableFuture<Void> stop = server.stop();
    CompletableFuture.allOf(start, stop).join();
}
Also used : Settings(org.apache.tinkerpop.gremlin.server.Settings) Test(org.junit.jupiter.api.Test)

Example 4 with Settings

use of org.apache.tinkerpop.gremlin.server.Settings in project janusgraph by JanusGraph.

the class AbstractGremlinServerIntegrationTest method startServer.

public void startServer(final Settings settings) throws Exception {
    if (null == settings) {
        startServer();
    } else {
        final Settings overridenSettings = overrideSettings(settings);
        if (GREMLIN_SERVER_EPOLL) {
            overridenSettings.useEpollEventLoop = true;
        }
        this.server = new GremlinServer(overridenSettings);
        server.start().join();
    }
}
Also used : GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) Settings(org.apache.tinkerpop.gremlin.server.Settings)

Example 5 with Settings

use of org.apache.tinkerpop.gremlin.server.Settings in project janusgraph by JanusGraph.

the class ManagementLoggerGraphCacheEvictionTest method graphShouldBeRemovedFromCache.

@Test
public void graphShouldBeRemovedFromCache() throws InterruptedException {
    final JanusGraphManager jgm = new JanusGraphManager(new Settings());
    assertNotNull(jgm);
    assertNotNull(JanusGraphManager.getInstance());
    assertNull(jgm.getGraph("graph1"));
    final Map<String, Object> map = new HashMap<>();
    map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
    map.put(GRAPH_NAME.toStringWithoutRoot(), "graph1");
    final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
    final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
    jgm.putGraph("graph1", graph);
    assertEquals("graph1", ((StandardJanusGraph) JanusGraphManager.getInstance().getGraph("graph1")).getGraphName());
    final ManagementSystem mgmt = (ManagementSystem) graph.openManagement();
    mgmt.evictGraphFromCache();
    mgmt.commit();
    // wait for log to be asynchronously pulled
    Thread.sleep(10000);
    assertNull(jgm.getGraph("graph1"));
}
Also used : ManagementSystem(org.janusgraph.graphdb.database.management.ManagementSystem) GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) HashMap(java.util.HashMap) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) Settings(org.apache.tinkerpop.gremlin.server.Settings) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Test(org.junit.jupiter.api.Test)

Aggregations

Settings (org.apache.tinkerpop.gremlin.server.Settings)12 Test (org.junit.jupiter.api.Test)9 JanusGraphSettings (org.janusgraph.graphdb.server.JanusGraphSettings)7 List (java.util.List)3 Optional (java.util.Optional)3 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)3 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)3 HashMap (java.util.HashMap)2 MapConfiguration (org.apache.commons.configuration2.MapConfiguration)2 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)2 GraphDatabaseConfigurationBuilder (org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder)2 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)2 GremlinServer (org.apache.tinkerpop.gremlin.server.GremlinServer)1 DefaultGraphManager (org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager)1 ManagementSystem (org.janusgraph.graphdb.database.management.ManagementSystem)1 ConfigurationManagementGraph (org.janusgraph.graphdb.management.ConfigurationManagementGraph)1 JanusGraphManager (org.janusgraph.graphdb.management.JanusGraphManager)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1