Package org.apache.hedwig.server.common

Examples of org.apache.hedwig.server.common.ServerConfiguration


    }

    @Test
    public void testInvalidServerConfiguration() throws Exception {
        boolean success = false;
        ServerConfiguration conf = new ServerConfiguration() {
            @Override
            public boolean isInterRegionSSLEnabled() {
                return conf.getBoolean(INTER_REGION_SSL_ENABLED, true);
            }

            @Override
            public List<String> getRegions() {
                List<String> regionsList = new LinkedList<String>();
                regionsList.add("regionHost1:4080:9876");
                regionsList.add("regionHost2:4080");
                regionsList.add("regionHost3:4080:9876");
                return regionsList;
            }
        };
        try {
            conf.validate();
        }
        catch (ConfigurationException e) {
            logger.error("Invalid configuration: ", e);
            success = true;
        }
View Full Code Here


    }

    @Test
    public void testValidServerConfiguration() throws Exception {
        boolean success = true;
        ServerConfiguration conf = new ServerConfiguration() {
            @Override
            public boolean isInterRegionSSLEnabled() {
                return conf.getBoolean(INTER_REGION_SSL_ENABLED, true);
            }

            @Override
            public List<String> getRegions() {
                List<String> regionsList = new LinkedList<String>();
                regionsList.add("regionHost1:4080:9876");
                regionsList.add("regionHost2:4080:2938");
                regionsList.add("regionHost3:4080:9876");
                return regionsList;
            }
        };
        try {
            conf.validate();
        }
        catch (ConfigurationException e) {
            logger.error("Invalid configuration: ", e);
            success = false;
        }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        bktb = new BookKeeperTestBase(numBookies);
        bktb.setUp();

        conf = new ServerConfiguration();
        scheduler = Executors.newScheduledThreadPool(1);
        tm = new TrivialOwnAllTopicManager(conf, scheduler);

        bkpm = new BookkeeperPersistenceManager(bktb.bk, bktb.getZooKeeperClient(), tm, conf, scheduler);
    }
View Full Code Here

    Callback<MessageSeqId> msgIdCallback;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        cfg = new ServerConfiguration();
        final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
        sm = new ZkSubscriptionManager(zk, new TrivialOwnAllTopicManager(cfg, scheduler),
                                       LocalDBPersistenceManager.instance(), cfg, scheduler);
        msgIdCallback = new Callback<MessageSeqId>() {
            @Override
View Full Code Here

        }
    }

    @Override
    protected ServerConfiguration getServerConfiguration(int serverPort, int sslServerPort) {
        ServerConfiguration serverConf = new TestServerConfiguration(serverPort, sslServerPort);

        org.apache.bookkeeper.conf.ClientConfiguration bkClientConf =
            new org.apache.bookkeeper.conf.ClientConfiguration();
        bkClientConf.setNumWorkerThreads(1).setReadTimeout(9999)
                    .setThrottleValue(3);
        try {
            serverConf.addConf(bkClientConf);
        } catch (Exception e) {
        }
        return serverConf;
    }
View Full Code Here

    private void startCluster(long delay) throws Exception {
        bktb = new BookKeeperTestBase(numBookies, 0L);
        bktb.setUp();

        conf = new ServerConfiguration() {
            @Override
            public int getMessagesConsumedThreadRunInterval() {
                return 2000;
            }
            @Override
View Full Code Here

public class TestFactoryLayout extends ZooKeeperTestBase {

    @Test(timeout=60000)
    public void testFactoryLayout() throws Exception {
        ServerConfiguration conf = new ServerConfiguration();
        conf.setMetadataManagerFactoryName(
            "org.apache.hedwig.server.meta.ZkMetadataManager");

        FactoryLayout layout = FactoryLayout.readLayout(zk, conf);
        Assert.assertTrue("Layout should be null", layout == null);
View Full Code Here

        layout.store(zk, conf);
    }

    @Test(timeout=60000)
    public void testCorruptedFactoryLayout() throws Exception {
        ServerConfiguration conf = new ServerConfiguration();
        StringBuilder msb = new StringBuilder();
        String factoryLayoutPath = FactoryLayout.getFactoryLayoutPath(msb, conf);
        // write corrupted manager layout
        ZkUtils.createFullPathOptimistic(zk, factoryLayoutPath, "BadLayout".getBytes(),
                                         Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
View Full Code Here

        return 1;
    }

    @Override
    PersistenceManager instantiatePersistenceManager() throws Exception {
        ServerConfiguration conf = new ServerConfiguration();
        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);

        metadataManagerFactory =
            MetadataManagerFactory.newMetadataManagerFactory(conf, bktb.getZooKeeperClient());
View Full Code Here

    protected void startHubServers() throws Exception {
        // Now create the PubSubServer Hubs
        serversList = new LinkedList<PubSubServer>();

        for (int i = 0; i < numServers; i++) {
            ServerConfiguration conf = getServerConfiguration(serverAddresses.get(i).getPort(),
                                                              serverAddresses.get(i).getSSLPort());
            PubSubServer s = new PubSubServer(conf, new ClientConfiguration(), new LoggingExceptionHandler());
            serversList.add(s);
            s.start();
        }
View Full Code Here

TOP

Related Classes of org.apache.hedwig.server.common.ServerConfiguration

Copyright © 2018 www.massapicom. 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.