Examples of ClientConfiguration


Examples of org.apache.bookkeeper.conf.ClientConfiguration

        }
    }

    @Test
    public void testAbsentLedgerManagerLayout() throws Exception {
        ClientConfiguration conf = new ClientConfiguration();
        String ledgersLayout = conf.getZkLedgersRootPath() + "/" + LedgerLayout.LAYOUT_ZNODE;
        // write bad format ledger layout
        StringBuilder sb = new StringBuilder();
        sb.append(LedgerLayout.LAYOUT_FORMAT_VERSION).append("\n");
        zkc.create(ledgersLayout, sb.toString().getBytes(),
                                 Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

        try {
            LedgerLayout.readLayout(zkc, conf.getZkLedgersRootPath());
            fail("Shouldn't reach here!");
        } catch (IOException ie) {
            assertTrue("Invalid exception", ie.getMessage().contains("version absent from"));
        }
    }
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

        }
    }

    @Test
    public void testBaseLedgerManagerLayout() throws Exception {
        ClientConfiguration conf = new ClientConfiguration();
        String rootPath = conf.getZkLedgersRootPath();
        String ledgersLayout = rootPath + "/" + LedgerLayout.LAYOUT_ZNODE;
        // write bad format ledger layout
        StringBuilder sb = new StringBuilder();
        sb.append(LedgerLayout.LAYOUT_FORMAT_VERSION).append("\n")
          .append(FlatLedgerManager.NAME);
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

    /**
     * Test bad client configuration
     */
    @Test
    public void testBadConf() throws Exception {
        ClientConfiguration conf = new ClientConfiguration();
       
        // success case
        String root0 = "/goodconf0";
        zkc.create(root0, new byte[0],
                   Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        conf.setZkLedgersRootPath(root0);

        LedgerManager m = LedgerManagerFactory.newLedgerManager(conf, zkc);
        assertTrue("Ledger manager is unexpected type",
                   (m instanceof FlatLedgerManager));

        // mismatching conf
        conf.setLedgerManagerType(HierarchicalLedgerManager.NAME);
        try {
            LedgerManagerFactory.newLedgerManager(conf, zkc);
            fail("Shouldn't reach here");
        } catch (Exception e) {
            assertTrue("Invalid exception",
                       e.getMessage().contains("does not match existing layout"));
        }

        // invalid ledger manager
        String root1 = "/badconf1";
        zkc.create(root1, new byte[0],
                   Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        conf.setZkLedgersRootPath(root1);

        conf.setLedgerManagerType("DoesNotExist");
        try {
            LedgerManagerFactory.newLedgerManager(conf, zkc);
            fail("Shouldn't reach here");
        } catch (Exception e) {
            assertTrue("Invalid exception",
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

    /**
     * Test bad zk configuration
     */
    @Test
    public void testBadZkContents() throws Exception {
        ClientConfiguration conf = new ClientConfiguration();
       
        // bad type in zookeeper
        String root0 = "/badzk0";
        zkc.create(root0, new byte[0],
                   Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        conf.setZkLedgersRootPath(root0);
       
        new LedgerLayout("DoesNotExist",
                         0xdeadbeef).store(zkc, root0);
       
        try {
            LedgerManagerFactory.newLedgerManager(conf, zkc);
            fail("Shouldn't reach here");
        } catch (Exception e) {
            assertTrue("Invalid exception",
                    e.getMessage().contains("Unknown ledger manager type"));
        }

        // bad version in zookeeper
        String root1 = "/badzk1";
        zkc.create(root1, new byte[0],
                   Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        conf.setZkLedgersRootPath(root1);
       
        new LedgerLayout(FlatLedgerManager.NAME,
                         0xdeadbeef).store(zkc, root1);
       
        try {
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

                });
            latch.await();
        }

        public void run() {
            ClientConfiguration conf = new ClientConfiguration();
            conf.setLedgerManagerType(type);

            try {
                barrier.await();
                LedgerManagerFactory.newLedgerManager(conf, zkc);
               
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

    private ConnectionState state;
    private final ClientConfiguration conf;

    public PerChannelBookieClient(OrderedSafeExecutor executor, ClientSocketChannelFactory channelFactory,
                                  InetSocketAddress addr, AtomicLong totalBytesOutstanding) {
        this(new ClientConfiguration(), executor, channelFactory, addr, totalBytesOutstanding);
    }
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

        byte hello[] = "hello".getBytes();
        long ledger = Long.parseLong(args[2]);
        ClientSocketChannelFactory channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
                .newCachedThreadPool());
        OrderedSafeExecutor executor = new OrderedSafeExecutor(1);
        BookieClient bc = new BookieClient(new ClientConfiguration(), channelFactory, executor);
        InetSocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1]));

        for (int i = 0; i < 100000; i++) {
            counter.inc();
            bc.addEntry(addr, ledger, new byte[0], i, ChannelBuffers.wrappedBuffer(hello), cb, counter, 0);
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

     * @throws KeeperException
     *             Throws this exception if there is an error instantiating the
     *             BookKeeper client.
     */
    public BookKeeperAdmin(String zkServers) throws IOException, InterruptedException, KeeperException {
        this(new ClientConfiguration().setZkServers(zkServers));
    }
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

     * @throws InterruptedException
     * @throws KeeperException
     */
    public BookKeeper(String servers) throws IOException, InterruptedException,
        KeeperException {
        this(new ClientConfiguration().setZkServers(servers));
    }
View Full Code Here

Examples of org.apache.bookkeeper.conf.ClientConfiguration

    OrderedSafeExecutor executor = new OrderedSafeExecutor(1);


    public BookieBenchmark(String bookieHostPortthrows Exception {
        channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
        bkc = new BookieClient(new ClientConfiguration(), channelFactory, executor);
        String[] hostPort = bookieHostPort.split(":");
        addr = new InetSocketAddress(hostPort[0], Integer.parseInt(hostPort[1]));

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.