Package com.splout.db.common

Examples of com.splout.db.common.SploutConfiguration


  };

  @Test
  public void testInitVersionListAndVersionChange() throws Throwable {
    final QNodeHandler handler = new QNodeHandler();
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    try {

      HazelcastInstance hz = Hazelcast.newHazelcastInstance(HazelcastConfigBuilder.build(config));
      CoordinationStructures coord = new CoordinationStructures(hz);
View Full Code Here


  @Test
  public void testDeployEnding() throws Throwable {
    // Test what happens when DNodes complete the deploy process
    final QNodeHandler handler = new QNodeHandler();
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    DNodeHandler dHandler = new DNodeHandler();
    DNode dnode = TestUtils.getTestDNode(config, dHandler, "dnode-" + this.getClass().getName() + "-1");

    try {
      handler.init(config);
View Full Code Here

  @Test
  public void testQuery() throws Throwable {
    QNodeHandler handler = new QNodeHandler();
    handler.init(SploutConfiguration.getTestConfig());

    SploutConfiguration config = SploutConfiguration.getTestConfig();
    DNode dnode = TestUtils.getTestDNode(config, dHandler, "dnode-" + this.getClass().getName() + "-2");
    try {
      ReplicationEntry repEntry = new ReplicationEntry(0, dnode.getAddress());
      Tablespace tablespace1 = new Tablespace(PartitionMap.oneShardOpenedMap(), new ReplicationMap(
          Arrays.asList(repEntry)), 0l, 0l);
View Full Code Here

  public void testQueryManualPartition() throws Throwable {
    // same as testQuery but using manual partition instead of "key"
    QNodeHandler handler = new QNodeHandler();
    handler.init(SploutConfiguration.getTestConfig());

    SploutConfiguration config = SploutConfiguration.getTestConfig();
    DNode dnode = TestUtils.getTestDNode(config, dHandler, "dnode-" + this.getClass().getName() + "-6");
    try {
      ReplicationEntry repEntry = new ReplicationEntry(0, dnode.getAddress());
      Tablespace tablespace1 = new Tablespace(PartitionMap.oneShardOpenedMap(), new ReplicationMap(
          Arrays.asList(repEntry)), 0l, 0l);
View Full Code Here

  }

  @Test
  public void testMultiDeployFiring() throws Throwable {
    // Same as test deploy firing, but with more than one DNode and different deploy actions
    SploutConfiguration config1 = SploutConfiguration.getTestConfig();

    DNode dnode1 = TestUtils.getTestDNode(config1, new IDNodeHandler() {
      @Override
      public void init(SploutConfiguration config) throws Exception {
      }

      @Override
      public String sqlQuery(String tablespace, long version, int partition, String query)
          throws DNodeException {
        return null;
      }

      @Override
      public String deploy(List<DeployAction> deployActions, long distributedBarrier)
          throws DNodeException {
        /*
         * DNode1 asserts
         */
        Assert.assertEquals(2, deployActions.size());
        Assert.assertEquals("hdfs://foo/bar1/0.db", deployActions.get(0).getDataURI());
        Assert.assertEquals("hdfs://foo/bar2/0.db", deployActions.get(1).getDataURI());
        Assert.assertEquals("partition1", deployActions.get(0).getTablespace());
        Assert.assertEquals("partition2", deployActions.get(1).getTablespace());
        return "FOO";
      }

      @Override
      public String rollback(List<RollbackAction> rollbackActions, String ignoreMe)
          throws DNodeException {
        return null;
      }

      @Override
      public String status() throws DNodeException {
        return null;
      }

      @Override
      public void stop() throws Exception {
      }

      @Override
      public void giveGreenLigth() {
      }

      @Override
      public String abortDeploy(long version) throws DNodeException {
        return null;
      }

      @Override
      public String deleteOldVersions(List<com.splout.db.thrift.TablespaceVersion> versions)
          throws DNodeException {
        return null;
      }

      @Override
      public String testCommand(String command) throws DNodeException {
        // TODO Auto-generated method stub
        return null;
      }
    }, "dnode-" + this.getClass().getName() + "-3");

    SploutConfiguration config2 = SploutConfiguration.getTestConfig();
    DNode dnode2 = TestUtils.getTestDNode(config2, new IDNodeHandler() {
      @Override
      public void init(SploutConfiguration config) throws Exception {
      }

View Full Code Here

  @Test
  public void testDeployFiring() throws Throwable {
    // Test the business logic that produces the firing of the deployment (not the continuation of it) For that, we will
    // use dummy DNodeHandlers
    QNodeHandler handler = new QNodeHandler();
    SploutConfiguration config = SploutConfiguration.getTestConfig();

    DNode dnode = TestUtils.getTestDNode(config, new IDNodeHandler() {
      @Override
      public void init(SploutConfiguration config) throws Exception {
      }
View Full Code Here

    }
  }

  @Test
  public void testInitDNodeList() throws Throwable {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    QNodeHandler handler = new QNodeHandler();
    try {
      HazelcastInstance hz = Hazelcast.newHazelcastInstance(HazelcastConfigBuilder.build(config));
      CoordinationStructures coord = new CoordinationStructures(hz);

      SploutConfiguration dNodeConfig = SploutConfiguration.getTestConfig();
      dNodeConfig.setProperty(DNodeProperties.PORT, 1000);

      coord.getDNodes().put("/localhost:1000", new DNodeInfo(dNodeConfig));

      dNodeConfig = SploutConfiguration.getTestConfig();
      dNodeConfig.setProperty(DNodeProperties.PORT, 1001);

      coord.getDNodes().put("/localhost:1001", new DNodeInfo(dNodeConfig));

      try {
        handler.init(config);
View Full Code Here

    }
  }

  @Test
  public void testDNodeDownAndUp() throws Throwable {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    QNodeHandler handler = new QNodeHandler();
    HazelcastInstance hz = Hazelcast.newHazelcastInstance(HazelcastConfigBuilder.build(config));
    try {
      CoordinationStructures coord = new CoordinationStructures(hz);
      SploutConfiguration dNodeConfig = SploutConfiguration.getTestConfig();
      dNodeConfig.setProperty(DNodeProperties.PORT, 1000);
      coord.getDNodes().put("/localhost:1000", new DNodeInfo(dNodeConfig));

      try {
        handler.init(config);
      } catch(Exception e) {
        // since the handler will try to connect to "localhost:1000" we skip the Exception and continue
        // the things we want to assert should be present anyway.
      }
      Assert.assertEquals(handler.getContext().getCoordinationStructures().getDNodes().values().size(),
          1);

      coord.getDNodes().remove(coord.getDNodes().entrySet().iterator().next().getKey());

      Thread.sleep(100);
      Assert.assertEquals(handler.getContext().getCoordinationStructures().getDNodes().values().size(),
          0);

      dNodeConfig = SploutConfiguration.getTestConfig();
      dNodeConfig.setProperty(DNodeProperties.PORT, 1001);
      coord.getDNodes().put("/localhost:1001", new DNodeInfo(dNodeConfig));
      Thread.sleep(100);

      Assert.assertEquals(handler.getContext().getCoordinationStructures().getDNodes().values().size(),
          1);

      dNodeConfig = SploutConfiguration.getTestConfig();
      dNodeConfig.setProperty(DNodeProperties.PORT, 1000);
      coord.getDNodes().put("/localhost:1000", new DNodeInfo(dNodeConfig));
      Thread.sleep(100);

      Assert.assertEquals(handler.getContext().getCoordinationStructures().getDNodes().values().size(),
          2);
View Full Code Here

* Like {@link OneShardEnsemble}, but for any number of local DNodes.
*/
public class NShardEnsemble {

  public void runForever(int nDNodes) throws Exception {
    SploutConfiguration config = SploutConfiguration.get();
    for(int i = 0; i < nDNodes; i++) {
      config = SploutConfiguration.get();
      // we need to change some props for avoiding conflicts, ports, etc
      config.setProperty(DNodeProperties.PORT, config.getInt(DNodeProperties.PORT) + i);
      config.setProperty(DNodeProperties.DATA_FOLDER, config.getString(DNodeProperties.DATA_FOLDER) + "-" + i);
      config.setProperty(FetcherProperties.TEMP_DIR, config.getString(FetcherProperties.TEMP_DIR) + "-" + i);
      DNode dnode = new DNode(config, new DNodeHandler());
      dnode.init();
    }
    QNode qnode = new QNode();
    qnode.start(config, new QNodeHandler());
View Full Code Here

    server.stop();
  }

  public static void main(String[] args) throws Exception {
    QNode qnode = new QNode();
    SploutConfiguration config = SploutConfiguration.get();
    qnode.start(config, new QNodeHandler());
    while(true) {
      Thread.sleep(100);
    }
  }
View Full Code Here

TOP

Related Classes of com.splout.db.common.SploutConfiguration

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.