use of com.baidu.hugegraph.backend.serializer.AbstractSerializer in project incubator-hugegraph by apache.
the class SerializerFactoryTest method testSerializer.
@Test
public void testSerializer() {
HugeConfig config = FakeObjects.newConfig();
AbstractSerializer serializer = SerializerFactory.serializer(config, "text");
Assert.assertEquals(TextSerializer.class, serializer.getClass());
serializer = SerializerFactory.serializer(config, "binary");
Assert.assertEquals(BinarySerializer.class, serializer.getClass());
serializer = SerializerFactory.serializer(config, "binaryscatter");
Assert.assertEquals(BinaryScatterSerializer.class, serializer.getClass());
Assert.assertThrows(BackendException.class, () -> {
SerializerFactory.serializer(config, "invalid");
}, e -> {
Assert.assertContains("Not exists serializer:", e.getMessage());
});
}
use of com.baidu.hugegraph.backend.serializer.AbstractSerializer in project incubator-hugegraph by apache.
the class StandardHugeGraph method serializer.
private AbstractSerializer serializer() {
String name = this.configuration.get(CoreOptions.SERIALIZER);
LOG.debug("Loading serializer '{}' for graph '{}'", name, this.name);
AbstractSerializer serializer = SerializerFactory.serializer(this.configuration, name);
if (serializer == null) {
throw new HugeException("Can't load serializer with name " + name);
}
return serializer;
}
Aggregations