Package org.apache.cassandra.dht

Examples of org.apache.cassandra.dht.OrderPreservingPartitioner


    @Test
    public void testSingleWrite() throws IOException {
        File f = tempSSTableFileName();

        // write test data
        SSTableWriter writer = new SSTableWriter(f.getAbsolutePath(), 1, new OrderPreservingPartitioner());
        Random random = new Random();
        byte[] bytes = new byte[1024];
        random.nextBytes(bytes);

        String key = Integer.toString(1);
View Full Code Here


        {
            map.put(Integer.toString(i), ("Avinash Lakshman is a good man: " + i).getBytes());
        }

        // write
        SSTableWriter writer = new SSTableWriter(f.getAbsolutePath(), 1000, new OrderPreservingPartitioner());
        for (String key: map.navigableKeySet())
        {
            writer.append(key, map.get(key));
        }
        SSTableReader ssTable = writer.closeAndOpenReader();
View Full Code Here

    @Test
    public void testStringEndpoints() throws UnknownHostException
    {
        TokenMetadata tmd = new TokenMetadata();
        IPartitioner partitioner = new OrderPreservingPartitioner();
        AbstractReplicationStrategy strategy = new RackUnawareStrategy(tmd, null);

        List<Token> endPointTokens = new ArrayList<Token>();
        List<Token> keyTokens = new ArrayList<Token>();
        for (int i = 0; i < 5; i++) {
            endPointTokens.add(new StringToken(String.valueOf((char)('a' + i * 2))));
            keyTokens.add(partitioner.getToken(String.valueOf((char)('a' + i * 2 + 1))));
        }
        for (String table : DatabaseDescriptor.getNonSystemTables())
            testGetEndpoints(tmd, strategy, endPointTokens.toArray(new Token[0]), keyTokens.toArray(new Token[0]), table);
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.dht.OrderPreservingPartitioner

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.