Package com.netflix.astyanax

Examples of com.netflix.astyanax.Keyspace


          .withConnectionPoolConfiguration(
              new ConnectionPoolConfigurationImpl(keyspaceName)
              .setMaxConnsPerHost(1).setSeeds(SEEDS))
              .buildKeyspace(ThriftFamilyFactory.getInstance());

      Keyspace ks = null;
      try {
        keyspaceContext.start();
        ks = keyspaceContext.getClient();

        Properties props = new Properties();
        props.setProperty("name", keyspaceName);
        props.setProperty("strategy_class", "SimpleStrategy");
        props.setProperty("strategy_options.replication_factor", "1");

        try {
          ks.createKeyspaceIfNotExists(props);

          KeyspaceDefinition ksDef = ks.describeKeyspace();
          Assert.assertNotNull(ksDef);

        } catch (Exception e) {
          Assert.fail(e.getMessage());
        }


        // NOW create is again.
        try {
          ks.createKeyspaceIfNotExists(props);
        } catch (Exception e) {
          Assert.fail(e.getMessage());
        }
      } finally {

        try {
          if (ks != null) {
            ks.dropKeyspace();
          }
        } catch (Exception e) {
          LOG.info(e.getMessage());
        }
View Full Code Here


            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());
       
        kc.start();

        Keyspace ks = kc.getClient();
       
        try {
            ks.createKeyspace(props);
            Assert.fail("Should have gotten name mismatch error");
        }
        catch (BadRequestException e) {
            LOG.info(e.getMessage());
        }
       
        props.put("name", keyspaceName);
        ks.createKeyspace(props);
       
        Properties props1 = ks.getKeyspaceProperties();
       
        LOG.info(props.toString());
        LOG.info(props1.toString());
    }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.Keyspace

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.