List of usage examples for org.apache.commons.configuration Configuration getList
List getList(String key, List defaultValue);
From source file:org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPoolTest.java
@Test public void shouldConfigPoolOnConstructionWithDefaults() throws Exception { final Configuration conf = new BaseConfiguration(); final GryoPool pool = GryoPool.build() .ioRegistries(conf.getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).create(); assertReaderWriter(pool.takeWriter(), pool.takeReader(), 1, Integer.class); }
From source file:org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPoolTest.java
@Test public void shouldConfigPoolOnConstructionWithPoolSizeOneAndNoIoRegistry() throws Exception { final Configuration conf = new BaseConfiguration(); final GryoPool pool = GryoPool.build().poolSize(1) .ioRegistries(conf.getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).create(); final GryoReader reader = pool.takeReader(); final GryoWriter writer = pool.takeWriter(); pool.offerReader(reader);/*from w ww. ja v a 2 s .co m*/ pool.offerWriter(writer); for (int ix = 0; ix < 100; ix++) { final GryoReader r = pool.takeReader(); final GryoWriter w = pool.takeWriter(); assertReaderWriter(w, r, 1, Integer.class); // should always return the same original instance assertEquals(reader, r); assertEquals(writer, w); pool.offerReader(r); pool.offerWriter(w); } }
From source file:org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPoolTest.java
@Test public void shouldConfigPoolOnConstructionWithCustomIoRegistryConstructor() throws Exception { final Configuration conf = new BaseConfiguration(); conf.setProperty(GryoPool.CONFIG_IO_REGISTRY, IoXIoRegistry.ConstructorBased.class.getName()); final GryoPool pool = GryoPool.build() .ioRegistries(conf.getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).create(); assertReaderWriter(pool.takeWriter(), pool.takeReader(), new IoX("test"), IoX.class); }
From source file:org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPoolTest.java
@Test public void shouldConfigPoolOnConstructionWithCustomIoRegistryInstance() throws Exception { final Configuration conf = new BaseConfiguration(); conf.setProperty(GryoPool.CONFIG_IO_REGISTRY, IoXIoRegistry.InstanceBased.class.getName()); final GryoPool pool = GryoPool.build() .ioRegistries(conf.getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).create(); assertReaderWriter(pool.takeWriter(), pool.takeReader(), new IoX("test"), IoX.class); }
From source file:org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPoolTest.java
@Test public void shouldConfigPoolOnConstructionWithMultipleCustomIoRegistries() throws Exception { final Configuration conf = new BaseConfiguration(); conf.setProperty(GryoPool.CONFIG_IO_REGISTRY, IoXIoRegistry.InstanceBased.class.getName() + "," + IoYIoRegistry.InstanceBased.class.getName()); final GryoPool pool = GryoPool.build() .ioRegistries(conf.getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).create(); assertReaderWriter(pool.takeWriter(), pool.takeReader(), new IoX("test"), IoX.class); assertReaderWriter(pool.takeWriter(), pool.takeReader(), new IoY(100, 200), IoY.class); }
From source file:org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPoolTest.java
@Test(expected = IllegalArgumentException.class) public void shouldConfigPoolOnConstructionWithoutCustomIoRegistryAndFail() throws Exception { final Configuration conf = new BaseConfiguration(); final GryoPool pool = GryoPool.build() .ioRegistries(conf.getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).create(); assertReaderWriter(pool.takeWriter(), pool.takeReader(), new IoX("test"), IoX.class); }
From source file:org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPoolTest.java
@Test(expected = IllegalStateException.class) public void shouldConfigPoolOnConstructionWithoutBadIoRegistryAndFail() throws Exception { final Configuration conf = new BaseConfiguration(); conf.setProperty(GryoPool.CONFIG_IO_REGISTRY, "some.class.that.does.not.exist"); GryoPool.build().ioRegistries(conf.getList(GryoPool.CONFIG_IO_REGISTRY, Collections.emptyList())).create(); }
From source file:org.neo4j.server.webadmin.rest.console.ConsoleService.java
@SuppressWarnings("unchecked") public ConsoleService(@Context Configuration config, @Context Database database, @Context HttpServletRequest req, @Context OutputFormat output, @Context CypherExecutor cypherExecutor) { this(new SessionFactoryImpl(req.getSession(true), (List) config.getList(MANAGEMENT_CONSOLE_ENGINES, DEFAULT_MANAGEMENT_CONSOLE_ENGINES), cypherExecutor), database, database.getLogging(), output); }
From source file:org.neo4j.server.webadmin.rest.ConsoleService.java
@SuppressWarnings("unchecked") public ConsoleService(@Context Configuration config, @Context Database database, @Context HttpServletRequest req, @Context OutputFormat output) { this(new SessionFactoryImpl(req.getSession(true), config.getList(Configurator.MANAGEMENT_CONSOLE_ENGINES, Configurator.DEFAULT_MANAGEMENT_CONSOLE_ENGINES)), database, output); }