Package com.splout.db.common

Examples of com.splout.db.common.SploutConfiguration


            }
          }
        });
      }

      final SploutConfiguration config = SploutConfiguration.getTestConfig();
      final int iterationsToPerform = config.getInt(QNodeProperties.VERSIONS_PER_TABLESPACE) + 5;
      for(int i = 0; i < iterationsToPerform; i++) {
        iteration.incrementAndGet();
        log.info("Deploy iteration: " + iteration.get());
        deployIteration(iteration.get(), random, client, testTablespace);

        new TestUtils.NotWaitingForeverCondition() {
          @Override
          public boolean endCondition() {
            synchronized(iterationsSeen) {
              return iterationsSeen.size() == (iteration.get() + 1);
            }
          }
        }.waitAtMost(5000);
      }

      assertEquals(false, failed.get());

      service.shutdownNow(); // will interrupt all threads
      while(!service.isTerminated()) {
        Thread.sleep(100);
      }

      CoordinationStructures coord = TestUtils.getCoordinationStructures(config);
      assertNotNull(coord.getCopyVersionsBeingServed().get(TABLESPACE));

      // Assert that there is only MAX_VERSIONS versions of the tablespace (due to old version cleanup)
      new TestUtils.NotWaitingForeverCondition() {

        @Override
        public boolean endCondition() {
          QNodeHandler handler = (QNodeHandler) qNodes.get(0).getHandler();
          int seenVersions = 0;
          for(Map.Entry<TablespaceVersion, Tablespace> tablespaceVersion : handler.getContext()
              .getTablespaceVersionsMap().entrySet()) {
            if(tablespaceVersion.getKey().getTablespace().equals(TABLESPACE)) {
              seenVersions++;
            }
          }
          return seenVersions <= config.getInt(QNodeProperties.VERSIONS_PER_TABLESPACE);
        }
      }.waitAtMost(5000);
    } finally {
      closeSploutEnsemble();
      FileUtils.deleteDirectory(new File(TMP_FOLDER));
View Full Code Here


  @Test
  public void testHdfsFetching() throws IOException, URISyntaxException {
    Configuration conf = new Configuration();
    FileSystem fS = FileSystem.getLocal(conf);
   
    SploutConfiguration testConfig = SploutConfiguration.getTestConfig();
    testConfig.setProperty(FetcherProperties.TEMP_DIR, "tmp-dir-" + TestFetcher.class.getName());
    Fetcher fetcher = new Fetcher(testConfig);
   
    Path path = new Path("tmp-" + TestFetcher.class.getName());
    OutputStream oS = fS.create(path);
    oS.write("This is what happens when you don't know what to write".getBytes());
View Full Code Here

  @Test
  public void testHdfsFetchingAndThrottling() throws IOException, URISyntaxException {
    Configuration conf = new Configuration();
    FileSystem fS = FileSystem.getLocal(conf);
   
    SploutConfiguration testConfig = SploutConfiguration.getTestConfig();
    testConfig.setProperty(FetcherProperties.TEMP_DIR, "tmp-dir-" + TestFetcher.class.getName());
    testConfig.setProperty(FetcherProperties.DOWNLOAD_BUFFER, 4);
    testConfig.setProperty(FetcherProperties.BYTES_PER_SEC_THROTTLE, 8);
    Fetcher fetcher = new Fetcher(testConfig);
   
    final String str = "This is what happens when you don't know what to write";
   
    Path path = new Path("tmp-" + TestFetcher.class.getName());
View Full Code Here

    FileUtils.deleteDirectory(f);
  }
 
  @Test
  public void testFileFetching() throws IOException, URISyntaxException {
    SploutConfiguration testConfig = SploutConfiguration.getTestConfig();
    testConfig.setProperty(FetcherProperties.TEMP_DIR, "tmp-dir-" + TestFetcher.class.getName());
    Fetcher fetcher = new Fetcher(testConfig);
   
    File file = new File("tmp-" + TestFetcher.class.getName());
    Files.write("This is what happens when you don't know what to write".getBytes(), file);
   
View Full Code Here

    FileUtils.deleteDirectory(f);
  }
 
  @Test
  public void testFileFetchingAndThrottling() throws IOException, URISyntaxException {
    SploutConfiguration testConfig = SploutConfiguration.getTestConfig();
    testConfig.setProperty(FetcherProperties.TEMP_DIR, "tmp-dir-" + TestFetcher.class.getName());
    testConfig.setProperty(FetcherProperties.DOWNLOAD_BUFFER, 4);
    testConfig.setProperty(FetcherProperties.BYTES_PER_SEC_THROTTLE, 8);
    Fetcher fetcher = new Fetcher(testConfig);
   
    final String str = "This is what happens when you don't know what to write";
   
    File file = new File("tmp-" + TestFetcher.class.getName());
View Full Code Here

  public static final int WAIT_AT_MOST = 25000;

  @Test
  public void test() throws Exception {
    SploutConfiguration testConfig = SploutConfiguration.getTestConfig();
    testConfig.setProperty(DNodeProperties.HANDLE_TEST_COMMANDS, true);
    final DNode dnode = new DNode(testConfig, new DNodeHandler());
    dnode.init();
   
    final QNode qnode = new QNode();
    qnode.start(testConfig, new QNodeHandler());
View Full Code Here

    TestUtils.cleanUpTmpFolders(this.getClass().getName(), 4);
  }

  @Test
  public void test() throws Throwable {
    final SploutConfiguration config = SploutConfiguration.getTestConfig();
    final QNodeHandler handler = new QNodeHandler();
    QNode qnode = TestUtils.getTestQNode(config, handler);

    DNodeHandler dNodeHandler1 = new DNodeHandler();

    final SploutConfiguration config1 = SploutConfiguration.getTestConfig();

    DNode dnode1 = TestUtils.getTestDNode(config1, dNodeHandler1, "dnode-" + this.getClass().getName()
        + "-1");
    final String dnode1Address = dnode1.getAddress();
View Full Code Here

  public void createSploutEnsemble(int nQnodes, int nDnodes) throws Throwable {
    /*
     * Create an ensemble of QNodes
     */
    for(int i = 0; i < nQnodes; i++) {
      SploutConfiguration qNodeConfig = SploutConfiguration.getTestConfig();
      QNode qnode = TestUtils.getTestQNode(qNodeConfig, new QNodeHandler());
      qNodes.add(qnode);
    }

    /*
     * Create an ensemble of DNodes
     */
    for(int i = 0; i < nDnodes; i++) {
      SploutConfiguration dNodeConfig = SploutConfiguration.getTestConfig();
      dNodeConfig.setProperty(DNodeProperties.HANDLE_TEST_COMMANDS, true);
      DNode dnode = TestUtils.getTestDNode(dNodeConfig, new DNodeHandler(), "dnode-" + this.getClass().getName() + "-" + i);
      dNodes.add(dnode);
    }
  }
View Full Code Here

     * The other ones have one shard and two shards with rep = 1. The more variety, the more race conditions that can be found.
     *
     * We will add nodes one by one and assert that the code is commutative. So we will take one node down and enter it again
     * and things should be ok again. And then we will remove nodes one by one until we have an empty tablespaceversion map.
     */
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    QNodeHandlerContext ctx = new QNodeHandlerContext(config, null);
   
    DNodeInfoFacade facade1 = new DNodeInfoFacade("dnode1");
    facade1.addTablespaceVersionPartition("t1", 1l, 0);
    facade1.addTablespaceVersionPartition("t1", 2l, 0);
View Full Code Here

    assertNull(tablespace2V1);
  }
 
  @Test
  public void testUpdateTablespacesImplicitLeaving() throws TablespaceVersionInfoException {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    QNodeHandlerContext ctx = new QNodeHandlerContext(config, null);
   
    DNodeInfoFacade facade1 = new DNodeInfoFacade("dnode1");
    facade1.addTablespaceVersionPartition("t1", 1l, 0);
    facade1.addTablespaceVersionPartition("t1", 2l, 0);
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.