Package com.netflix.astyanax

Examples of com.netflix.astyanax.Cluster


                .buildCluster(ThriftFamilyFactory.getInstance());

        clusterContext.start();

        if (TEST_INIT_KEYSPACE) {
            Cluster cluster = clusterContext.getEntity();
            try {
                LOG.info("Dropping keyspace: " + TEST_KEYSPACE_NAME);
                cluster.dropKeyspace(TEST_KEYSPACE_NAME);
                Thread.sleep(10000);
            } catch (ConnectionException e) {
                LOG.warn(e.getMessage());
            }

            Map<String, String> stratOptions = new HashMap<String, String>();
            stratOptions.put("replication_factor", "3");

            try {
                LOG.info("Creating keyspace: " + TEST_KEYSPACE_NAME);

                KeyspaceDefinition ksDef = cluster.makeKeyspaceDefinition();

                ksDef.setName(TEST_KEYSPACE_NAME)
                        .setStrategyOptions(stratOptions)
                        .setStrategyClass("SimpleStrategy")
                        .addColumnFamily(
                                cluster.makeColumnFamilyDefinition()
                                        .setName(CF_DATA.getName())
                                        .setComparatorType("UTF8Type"));
                cluster.addKeyspace(ksDef);
                Thread.sleep(1000);
            } catch (ConnectionException e) {
                LOG.error(e.getMessage());
            }
        }
View Full Code Here


                .buildCluster(ThriftFamilyFactory.getInstance());

        clusterContext.start();

        if (TEST_INIT_KEYSPACE) {
            Cluster cluster = clusterContext.getEntity();
            try {
                LOG.info("Dropping keyspace: " + TEST_KEYSPACE_NAME);
                cluster.dropKeyspace(TEST_KEYSPACE_NAME);
                Thread.sleep(10000);
            } catch (ConnectionException e) {
                LOG.warn(e.getMessage());
            }

            Map<String, String> stratOptions = new HashMap<String, String>();
            stratOptions.put("replication_factor", "3");

            try {
                LOG.info("Creating keyspace: " + TEST_KEYSPACE_NAME);

                KeyspaceDefinition ksDef = cluster.makeKeyspaceDefinition();

                ksDef.setName(TEST_KEYSPACE_NAME)
                        .setStrategyOptions(stratOptions)
                        .setStrategyClass("SimpleStrategy")
                        .addColumnFamily(
                                cluster.makeColumnFamilyDefinition()
                                        .setName(CF_DATA.getName())
                                        .setComparatorType("UTF8Type")
                        // .setKeyValidationClass("LongType")
                        // .setDefaultValidationClass("BytesType")
                        )
                        .addColumnFamily(
                                cluster.makeColumnFamilyDefinition()
                                        .setName(CF_INDEX.getName())
                                        .setComparatorType(
                                                "CompositeType(LongType, LongType)")
                                        .setDefaultValidationClass("BytesType"));
                cluster.addKeyspace(ksDef);
                Thread.sleep(2000);
                populateKeyspace();
            } catch (ConnectionException e) {
                LOG.error(e.getMessage());
            }
View Full Code Here

                                .setMaxConnsPerHost(1))
                .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
                .buildCluster(ThriftFamilyFactory.getInstance());

        clusterContext.start();
        Cluster cluster = clusterContext.getEntity();

        try {
            cluster.describeClusterName();
            List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
            LOG.info("Keyspace count:" + keyspaces.size());
            for (KeyspaceDefinition keyspace : keyspaces) {
                LOG.info("Keyspace: " + keyspace.getName());
            }
            Assert.assertNotNull(keyspaces);
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.Cluster

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.