Package voldemort.utils

Examples of voldemort.utils.ByteArray


        return byteArrayKeyList;
    }

    @Override
    public void testDelete() {
        ByteArray key = getKey();
        Store<ByteArray, byte[], byte[]> store = getStore();
        VectorClock c1 = getClock(1, 1);
        byte[] value = getValue();

        // can't delete something that isn't there
View Full Code Here


        assertGetAllValues(keysForGet, valuesForGet, result);
    }

    @Test
    public void testConcurrentWriteFailure() {
        ByteArray key = getKey();
        Store<ByteArray, byte[], byte[]> store = getStore();
        VectorClock c1 = getClock(1, 1);
        VectorClock c2 = getClock(1, 2);
        byte[] value = getValue();
View Full Code Here

            }
            for(Integer nodeId: vservers.keySet()) {
                VoldemortServer vs = vservers.get(nodeId);
                Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository()
                                                           .getLocalStore(storeDef.getName());
                byte[] real = store.get(new ByteArray("AB".getBytes()), null).get(0).getValue();
                assertTrue(Arrays.equals(real, "CD".getBytes()));
            }
        } catch(InsufficientOperationalNodesException e) {
            fail("Failed with exception: " + e);
        }
View Full Code Here

                    continue;
                }
                VoldemortServer vs = vservers.get(nodeId);
                Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository()
                                                           .getLocalStore(storeDef.getName());
                byte[] real = store.get(new ByteArray("AB".getBytes()), null).get(0).getValue();
                assertTrue(Arrays.equals(real, "CD".getBytes()));
            }
        } catch(InsufficientOperationalNodesException e) {
            fail("Failed with exception: " + e);
            e.printStackTrace();
View Full Code Here

    }

    public List<ByteArray> getKeys(int numValues, int size) {
        List<ByteArray> keys = Lists.newArrayList();
        for(byte[] array: this.getByteValues(numValues, size))
            keys.add(new ByteArray(array));
        return keys;
    }
View Full Code Here

    @Test
    public void testEmptyByteArray() throws Exception {
        Store<ByteArray, byte[], byte[]> store = getStore();
        Versioned<byte[]> bytes = new Versioned<byte[]>(new byte[0]);
        store.put(new ByteArray(new byte[0]), bytes, null);
        List<Versioned<byte[]>> found = store.get(new ByteArray(new byte[0]), null);
        assertEquals("Incorrect number of results.", 1, found.size());
        assertEquals("Get doesn't equal put.", bytes, found.get(0));
    }
View Full Code Here

    public void testGetWithBigValueSizes(Store<ByteArray, byte[], byte[]> store,
                                         int keySize,
                                         int valueSize) throws Exception {

        List<ByteArray> keys = getKeys(1, keySize);
        ByteArray key = keys.get(0);
        VectorClock vc = getClock(0, 0);

        List<byte[]> values = getValues(1, valueSize);
        byte[] value = values.get(0);
View Full Code Here

    private void doOperations(int nodeId,
                              Store<ByteArray, byte[], byte[]> store,
                              MetadataStore metadata,
                              StoreDefinition storeDef) {
        for(int i = 0; i < LOOP_COUNT;) {
            ByteArray key = new ByteArray(ByteUtils.md5(Integer.toString((int) (Math.random() * Integer.MAX_VALUE))
                                                               .getBytes()));
            byte[] value = "value".getBytes();
            RoutingStrategy routingStrategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDef,
                                                                                                 metadata.getCluster());

            if(containsNodeId(routingStrategy.routeRequest(key.get()), nodeId)) {
                i++; // increment count
                switch(i % 4) {
                    case 0:
                        store.get(key, null);
                        break;
View Full Code Here

                                                 node.getHttpPort(),
                                                 httpClient);
    }

    public <T extends Exception> void testBadUrlOrPort(String url, int port, Class<T> expected) {
        ByteArray key = new ByteArray("test".getBytes());
        RequestFormat requestFormat = new RequestFormatFactory().getRequestFormat(RequestFormatType.VOLDEMORT_V1);

        HttpParams clientParams = httpClient.getParams();
        HttpConnectionParams.setConnectionTimeout(clientParams, 5000);
View Full Code Here

            @Override
            public void doOperation(int index) throws Exception {
                try {
                    totalResults.incrementAndGet();
                    int curr = current.getAndIncrement();
                    List<Versioned<byte[]>> results = store.get(new ByteArray(keySerializer.toBytes(requestIds.take())),
                                                                null);
                    if(curr % progressIncrement == 0)
                        System.out.println(curr);

                    if(results.size() == 0)
View Full Code Here

TOP

Related Classes of voldemort.utils.ByteArray

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.