Package co.nubetech.crux.model

Examples of co.nubetech.crux.model.Connection


    HTablePool hTablePool = (HTablePool) key;
  }

  @Override
  public Object makeObject(Object obj) {
    Connection connection = (Connection) obj;
    Configuration conf = Utility.getConfiguration(connection);
    HTablePool hTablePool = new HTablePool(conf,
        CruxConstants.HTABLE_POOL_MAX_SIZE);
    return hTablePool;
  }
View Full Code Here


  private final static Logger logger = Logger
      .getLogger(co.nubetech.crux.pool.TestHBaseConnectionPool.class);

  @Test
  public void testSave() throws Exception {
    Connection connection = new Connection();
    connection.setName("HbaseConn1");
    ConnectionProperty connectionProperty = new ConnectionProperty();
    connectionProperty.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
    connectionProperty.setValue("h1:2181,h2:8080");
    connection.addProperty(connectionProperty);

    HBaseConnectionPool pool = new HBaseConnectionPool(
        new HBaseConnectionPoolFactory());

    // pool.save(connection);
View Full Code Here

public class TestHBaseConnectionPoolFactory {

  // Can't test for multiple machines.
  @Test
  public void testGetConfiguration() {
    Connection connection = new Connection();

    ConnectionProperty property = new ConnectionProperty();
    property.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
    property.setValue("h1:2181");
    connection.addProperty(property);

    HBaseConnectionPoolFactory hbaseConnectionPoolFactory = new HBaseConnectionPoolFactory();
    Utility utility = new Utility();
    Configuration conf = utility.getConfiguration(connection);
    assertEquals(conf.get("hbase.zookeeper.quorum"), "h1");
View Full Code Here

  // InComplete
  @Test
  public void testMakeObject() {

    Connection connection = new Connection();

    ConnectionProperty property = new ConnectionProperty();
    property.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
    property.setValue("h1:2181");
    connection.addProperty(property);

    HBaseConnectionPoolFactory hbaseConnectionPoolFactory = new HBaseConnectionPoolFactory();
    HTablePool htablePool = (HTablePool) hbaseConnectionPoolFactory
        .makeObject(connection);
  }
View Full Code Here

  private final static Logger logger = Logger
      .getLogger(co.nubetech.crux.pool.TestHBaseConnectionPool.class);

  @Test
  public void testSave() throws Exception {
    Connection connection = new Connection();
    connection.setName("HbaseConn1");
    ConnectionProperty connectionProperty = new ConnectionProperty();
    connectionProperty.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
    connectionProperty.setValue("h1:2181,h2:8080");
    connection.addProperty(connectionProperty);

    HBaseConnectionPool pool = new HBaseConnectionPool(
        new HBaseConnectionPoolFactory());

    // pool.save(connection);
View Full Code Here

public class TestHBaseConnectionPoolFactory {

  @Test
  public void testGetCluster() {
    Connection connection = new Connection();

    ConnectionProperty restProperty = new ConnectionProperty();
    restProperty.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
    restProperty.setValue("h1:8080,h2:8080");
    connection.addProperty(restProperty);

    HBaseConnectionPoolFactory hbaseConnectionPoolFactory = new HBaseConnectionPoolFactory();
    Cluster cluster = hbaseConnectionPoolFactory.getCluster(connection);
    assertEquals(cluster.isEmpty(), false); // Cluster is not empty.
View Full Code Here

  }

  @Test
  public void testMakeObject() {

    Connection connection = new Connection();

    ConnectionProperty restProperty = new ConnectionProperty();
    restProperty.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
    restProperty.setValue("h1:8080,h2:8080");
    connection.addProperty(restProperty);

    HBaseConnectionPoolFactory hbaseConnectionPoolFactory = new HBaseConnectionPoolFactory();
    Client client = (Client) hbaseConnectionPoolFactory
        .makeObject(connection);
    Cluster cluster = client.getCluster();
View Full Code Here

  public Session session;
  @TransactionTarget
  public Transaction transaction;

  public Connection findById(Long id) throws CruxException {
    Connection connection;
    try {
      logger.debug("Id to find connection is: " + id);
      connection = (Connection) session.get(Connection.class, id);
      connection.getId();
    } catch (NullPointerException e) {
      logger.debug(id + " not exists.");
      throw new CruxException(
          "Selected connection does not exists in the database.", e);
    }
View Full Code Here

    Datastore datastore = new Datastore();
    datastore.setId(121212);
    datastore.setName("Hbase");
   
    //connection 1
    Connection connection1 = new Connection();
    ConnectionProperty connectionProperty1 = new ConnectionProperty(connection1, CruxConstants.HBASE_ZOOKEEPER_PROPERTY,"value1");
    ConnectionProperty connectionProperty2 = new ConnectionProperty(connection1, CruxConstants.HBASE_ZOOKEEPER_PROPERTY,"value2");
   
    connection1.addProperty(connectionProperty1);
    connection1.addProperty(connectionProperty2);
    connection1.setDatastore(datastore);
    connection1.setUser(user);
    connection1.setId(1);
    connection1.setName("ConnectionName1");       
   
    //connection 2
    Connection connection2 = new Connection();
    ConnectionProperty connectionProperty3 = new ConnectionProperty(connection2, CruxConstants.HBASE_ZOOKEEPER_PROPERTY, "value1");
    ConnectionProperty connectionProperty4 = new ConnectionProperty(connection2, CruxConstants.HBASE_ZOOKEEPER_PROPERTY, "value2");
   
    connection2.addProperty(connectionProperty3);
    connection2.addProperty(connectionProperty4);
    connection2.setDatastore(datastore);
    connection2.setUser(user);
    connection2.setId(2);
    connection2.setName("ConnectionName2");
   
    //connection 3
    Connection connection3 = new Connection();
    ConnectionProperty connectionProperty5 = new ConnectionProperty(connection3, CruxConstants.HBASE_ZOOKEEPER_PROPERTY, "value1");
    ConnectionProperty connectionProperty6 = new ConnectionProperty(connection3, CruxConstants.HBASE_ZOOKEEPER_PROPERTY, "value2");
   
    connection3.addProperty(connectionProperty5);
    connection3.addProperty(connectionProperty6);
    connection3.setDatastore(datastore);
    connection3.setUser(user);
    connection3.setId(3);
    connection3.setName("ConnectionName3");
   
    //create list of the above created connections
    List<Connection> connectionList = new ArrayList<Connection>();
    connectionList.add(connection1);
    connectionList.add(connection2);
View Full Code Here

    Datastore datastore = new Datastore();
    datastore.setId(121212);
    datastore.setName("Hbase");
   
    //connection
    Connection connection = new Connection();
    ConnectionProperty connectionProperty = new ConnectionProperty(connection, CruxConstants.HBASE_ZOOKEEPER_PROPERTY,"value1");
   
    connection.addProperty(connectionProperty);
    connection.setDatastore(datastore);
    connection.setUser(user);
    connection.setId(1);
    connection.setName("ConnectionName1");       
   
   
    //Code for creating List<Mapping> & mock for it.
    ValueType valueType = new ValueType(101, datastore, "valueType1", "className1",
        "className1", true);
View Full Code Here

TOP

Related Classes of co.nubetech.crux.model.Connection

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.