Package com.taobao.metamorphosis.server.utils

Examples of com.taobao.metamorphosis.server.utils.MetaConfig


    }


    protected void init(final String path) throws Exception {

        final MetaConfig config = new MetaConfig();
        config.setFlushTxLogAtCommit(1);
        config.setNumPartitions(10);
        final List<String> topics = new ArrayList<String>();
        topics.add("topic1");
        topics.add("topic2");
        config.setTopics(topics);
        config.setDataPath(path);
        this.messageStoreManager = new MessageStoreManager(config, null);
        this.transactionStore = new JournalTransactionStore(path, this.messageStoreManager, config);
        this.journalStore = this.transactionStore.getJournalStore();
    }
View Full Code Here



    @Before
    public void setUp() throws Exception {
        final String tmpPath = System.getProperty("java.io.tmpdir");
        this.metaConfig = new MetaConfig();
        this.metaConfig.setDataPath(tmpPath);
        final PutCommand cmd1 = new PutCommand(this.topic, this.partition, "hello".getBytes(), null, 0, 0);
        this.metaConfig.setUnflushThreshold(1);
        // ���ƴ�10����Ϣ��roll�ļ�
        this.metaConfig.setMaxSegmentSize(MessageUtils.makeMessageBuffer(1, cmd1).capacity() * MSG_COUNT);
 
View Full Code Here

    private MetaConfig metaConfig;


    @Before
    public void setUp() throws Exception {
        this.metaConfig = new MetaConfig();
        final String topic = "MessageStoreManagerUnitTest";
        this.metaConfig.getTopics().add(topic);
        final TopicConfig topicConfig = new TopicConfig(topic, this.metaConfig);
        topicConfig.setDeletePolicy("delete,10s");
        topicConfig.setDeleteWhen("0/1 * * * * ?");
 
View Full Code Here


    @Test
    public void testGetMetaConfig() throws Exception {
        final File file = ResourcesUtils.getResourceAsFile("server.ini");
        final MetaConfig config = MetamorphosisStartup.getMetaConfig(file.getAbsolutePath());
        assertEquals(1111, config.getBrokerId());
        assertEquals("test.localhost", config.getHostName());
        assertEquals(10, config.getNumPartitions());
        assertEquals(8124, config.getServerPort());
        assertEquals("/home/admin", config.getDataPath());
        assertEquals("/home/datalog", config.getDataLogPath());
        assertEquals(10000, config.getUnflushThreshold());
        assertEquals(100000, config.getUnflushInterval());
        assertEquals(1024 * 1024 * 1024, config.getMaxSegmentSize());
        assertEquals(1024 * 1024, config.getMaxTransferSize());
        assertEquals(90, config.getGetProcessThreadCount());
        assertEquals(90, config.getPutProcessThreadCount());
        assertEquals(2, config.getTopics().size());
        assertTrue(config.getTopics().contains("test1"));
        assertTrue(config.getTopics().contains("test2"));

        final Map<String, TopicConfig> topicConfigs = config.getTopicConfigMap();
        assertEquals(2, topicConfigs.size());
        assertEquals(11, topicConfigs.get("test1").getNumPartitions());
        assertEquals(13, topicConfigs.get("test2").getNumPartitions());

        assertEquals("delete,77", config.getTopicConfig("test1").getDeletePolicy());

        assertEquals("127.0.0.1:2181", config.getZkConfig().zkConnect);
        assertEquals(30000, config.getZkConfig().zkSessionTimeoutMs);
        assertEquals(40000, config.getZkConfig().zkConnectionTimeoutMs);
        assertEquals(5000, config.getZkConfig().zkSyncTimeMs);

        assertEquals("delete,999", config.getDeletePolicy());

        final TopicConfig topicConfig1 = config.getTopicConfig("test1");
        final TopicConfig topicConfig2 = config.getTopicConfig("test2");
        assertEquals("/home/admin", topicConfig1.getDataPath());
        assertEquals("/test2", topicConfig2.getDataPath());
        assertFalse(topicConfig1.isStat());
        assertTrue(topicConfig2.isStat());
    }
View Full Code Here

    private BrokerZooKeeper slaveBrokerZooKeeper;


    @Before
    public void setUp() {
        MetaConfig metaConfig = new MetaConfig();
        this.brokerZooKeeper = new BrokerZooKeeper(metaConfig);
        this.client = this.brokerZooKeeper.getZkClient();
    }
View Full Code Here

    }


    private BrokerZooKeeper createSlaveBrokerZooKeeper() {
        MetaConfig slaveMetaConfig = new MetaConfig();
        slaveMetaConfig.setSlaveConfig(new SlaveConfig(0));
        this.slaveBrokerZooKeeper = new BrokerZooKeeper(slaveMetaConfig);
        return this.slaveBrokerZooKeeper;
    }
View Full Code Here

    private ConsumerFilterManager consumerFilterManager;


    @Before
    public void setUp() throws Exception {
        MetaConfig metaConfig = new MetaConfig();
        TopicConfig topicConfig = metaConfig.getTopicConfig("test");
        topicConfig.addFilterClass("test-group1", "com.taobao.metamorphosis.server.filter.NotExistsFilter");
        topicConfig.addFilterClass("test-group2", "com.taobao.metamorphosis.server.filter.TestFilter");
        this.consumerFilterManager = new ConsumerFilterManager(metaConfig);
    }
View Full Code Here

    private final String group = "boyan-test";


    @Before
    public void setUp() {
        MetaConfig metaConfig = new MetaConfig();
        metaConfig.getTopicConfig("test").setStat(true);
        metaConfig.getTopicConfig("test2").setStat(true);
        this.statsManager = new StatsManager(metaConfig, null, null);
        this.statsManager.init();
    }
View Full Code Here

    protected ConsumerFilterManager consumerFilterManager;


    protected void mock() {

        this.metaConfig = new MetaConfig();
        this.mocksControl = EasyMock.createControl();
        this.storeManager = this.mocksControl.createMock(MessageStoreManager.class);
        this.conn = this.mocksControl.createMock(Connection.class);
        try {
            this.consumerFilterManager = new ConsumerFilterManager(this.metaConfig);
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
        this.sessionContext = new SessionContextImpl(null, this.conn);
        EasyMock.expect(this.conn.getAttribute(SessionContextHolder.GLOBAL_SESSION_KEY)).andReturn(this.sessionContext)
        .anyTimes();
        this.statsManager = new StatsManager(new MetaConfig(), null, null);
        this.idWorker = this.mocksControl.createMock(IdWorker.class);
        this.brokerZooKeeper = this.mocksControl.createMock(BrokerZooKeeper.class);
        this.executorsManager = this.mocksControl.createMock(ExecutorsManager.class);
        this.commandProcessor = new BrokerCommandProcessor();
        this.commandProcessor.setMetaConfig(this.metaConfig);
View Full Code Here

        // this.brokerZooKeeper.resetBrokerIdPath();
        // EasyMock.expect(this.metaMorphosisBroker.getStoreManager()).andReturn(null);
        // EasyMock.expect(metaMorphosisBroker.getIdWorker()).andReturn(null);
        // EasyMock.expect(this.metaMorphosisBroker.getStatsManager()).andReturn(null);
        // EasyMock.expect(this.metaMorphosisBroker.getBrokerProcessor()).andReturn(this.brokerCommandProcessor);
        final MetaConfig metaConfig = new MetaConfig();
        // metaConfig.setSlaveId(1);
        EasyMock.expect(this.metaMorphosisBroker.getMetaConfig()).andReturn(metaConfig).anyTimes();
        this.mocksControl.replay();

        final BrokerPlugins brokerPlugins = new BrokerPlugins(pluginsInfo, this.metaMorphosisBroker);
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.server.utils.MetaConfig

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.