Package voldemort

Examples of voldemort.MockTime


        return create(failureDetectorConfig, true);
    }

    @Override
    protected Time createTime() throws Exception {
        return new MockTime(0);
    }
View Full Code Here


        testThrottler(100, 100, 50, 5000);
    }

    public void testThrottler(int readSize, int numReads, long readTime, long throttledRate) {
        long startTime = 1000;
        MockTime time = new MockTime(startTime);
        EventThrottler throttler = new EventThrottler(time, throttledRate, 50);
        for(int i = 0; i < numReads; i++) {
            time.addMilliseconds(readTime);
            throttler.maybeThrottle(readSize);
        }
        long doneTime = time.getMilliseconds();
        long bytesRead = numReads * (long) readSize;
        double unthrottledSecs = readTime * numReads / (double) Time.MS_PER_SECOND;
        double ellapsedSecs = (double) (doneTime - startTime) / Time.MS_PER_SECOND;
        double observedRate = bytesRead / ellapsedSecs;
        double unthrottledRate = bytesRead / unthrottledSecs;
View Full Code Here

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        when(inner.call()).thenReturn(CALL_RESULT);
        mockTime = new MockTime();
        cachedCallable = new CachedCallable<Long>(inner,
                                                  CACHE_TTL_MS,
                                                  mockTime);
    }
View Full Code Here

        return Arrays.asList(data);
    }

    @Before
    public void setUp() throws Exception {
        time = new MockTime();
        storeDir = TestUtils.createTempDir();
        FileDeleteStrategy.FORCE.delete(storeDir);

        // lets use all the default values.
        Props props = new Props();
View Full Code Here

    public void setUp() {
        config.setEnableServerRouting(true); // this is turned off by default
        metadataDir = new File(config.getMetadataDirectory());
        metadataDir.mkdir();
        config.setBdbCacheSize(100000);
        this.scheduler = new SchedulerService(1, new MockTime());
        this.storeRepository = new StoreRepository();
        storage = new StorageService(storeRepository, mdStore, scheduler, config);
        storage.start();
    }
View Full Code Here

        File temp = TestUtils.createTempDir();
        VoldemortConfig config = new VoldemortConfig(0, temp.getAbsolutePath());
        new File(config.getMetadataDirectory()).mkdir();
        this.serverMap = new HashMap<Integer, VoldemortServer>();
        this.scheduler = new SchedulerService(1, new MockTime());
        this.cluster = VoldemortTestConstants.getNineNodeCluster();
        StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
        this.storeDefs = mapper.readStoreList(new StringReader((VoldemortTestConstants.getSingleStore322Xml())));
        this.storeRepository = new StoreRepository();
        this.metadataStore = ServerTestUtils.createMetadataStore(cluster, storeDefs);
View Full Code Here

TOP

Related Classes of voldemort.MockTime

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.