Package com.splout.db.common

Examples of com.splout.db.common.SploutConfiguration


public class TestCoordinationStructures {

  @Test
  public void testUniqueIdGenerator() throws HazelcastConfigBuilderException {
    try {
      SploutConfiguration config = SploutConfiguration.getTestConfig();
      HazelcastInstance hz = Hazelcast.newHazelcastInstance(HazelcastConfigBuilder.build(config));
      CoordinationStructures cS = new CoordinationStructures(hz);
     
      for(int i = 0; i < 1000; i++) {
        long version1 = cS.uniqueVersionId();
View Full Code Here


  public void cleanup() throws Exception {
    Hazelcast.shutdownAll();
  }

  protected static Config buildHZConfig(boolean multicast) throws HazelcastConfigBuilderException {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    Config c = HazelcastConfigBuilder.build(config);
    c.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(multicast);
    c.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(!multicast);
    if(!multicast) {
      c.getNetworkConfig().setPortAutoIncrement(false);
View Full Code Here

public class TestHazelcastConfigBuilder {

  @Test
  public void testDefaults() throws HazelcastConfigBuilderException {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    HazelcastConfigBuilder.build(config);
  }
View Full Code Here

    HazelcastConfigBuilder.build(config);
  }
 
  @Test
  public void testUseXML() throws HazelcastConfigBuilderException {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    config.setProperty(HazelcastProperties.USE_DEFAULT_OR_XML_CONFIG, true);
    HazelcastConfigBuilder.build(config);
  }
View Full Code Here

    HazelcastConfigBuilder.build(config);
  }
 
  @Test
  public void testAWS() throws HazelcastConfigBuilderException {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    config.setProperty(HazelcastProperties.JOIN_METHOD, "aws");
    config.setProperty(HazelcastProperties.AWS_KEY, "key");
    config.setProperty(HazelcastProperties.AWS_SECRET, "secret");
    config.setProperty(HazelcastProperties.AWS_SECURITY_GROUP, "sgroup");
   
    Config cfg = HazelcastConfigBuilder.build(config);
   
    assertEquals(true, cfg.getNetworkConfig().getJoin().getAwsConfig().isEnabled());
    assertEquals("key", cfg.getNetworkConfig().getJoin().getAwsConfig().getAccessKey());
View Full Code Here

    assertEquals("sgroup", cfg.getNetworkConfig().getJoin().getAwsConfig().getSecurityGroupName());
  }
 
  @Test
  public void testMulticast() throws HazelcastConfigBuilderException {
    SploutConfiguration config = SploutConfiguration.getTestConfig();
    config.setProperty(HazelcastProperties.JOIN_METHOD, "multicast");
    config.setProperty(HazelcastProperties.MULTICAST_PORT, "5432");
    config.setProperty(HazelcastProperties.MULTICAST_GROUP, "mgroup");
   
    Config cfg = HazelcastConfigBuilder.build(config);
   
    assertEquals(true, cfg.getNetworkConfig().getJoin().getMulticastConfig().isEnabled());
    assertEquals("mgroup", cfg.getNetworkConfig().getJoin().getMulticastConfig().getMulticastGroup());
View Full Code Here

  }
 
  // Use this main for testing purposes, as a client
  // args: [file] [server]
  public static void main(String[] args) throws IOException {
    SploutConfiguration conf = SploutConfiguration.get();
    HttpFileExchanger fileExchanger = new HttpFileExchanger(conf, new ReceiveFileCallback() {
      @Override
      public void onProgress(String tablespace, Integer partition, Long version, File file, long totalSize,
          long sizeDownloaded) {
      }
View Full Code Here

    server.stop();
    servingThread.join();
  }

  public static void main(String[] args) throws Exception {
    SploutConfiguration config;
    if(args.length == 1) {
      // config root
      config = SploutConfiguration.get(args[0]);
    } else {
      config = SploutConfiguration.get();
View Full Code Here

    BufferedWriter writer = new BufferedWriter(new FileWriter(fileToSend));
    for(int i = 0; i < 1000; i++) {
      writer.write(FOO_CONTENT + "\n");
    }

    SploutConfiguration conf = SploutConfiguration.getTestConfig();
    conf.setProperty(FetcherProperties.DOWNLOAD_BUFFER, 16);
    conf.setProperty(FetcherProperties.TEMP_DIR, TMP_DOWNLOAD_DIR);

    final AtomicInteger failed = new AtomicInteger(0);

    HttpFileExchanger exchanger = new HttpFileExchanger(conf, new ReceiveFileCallback() {
      @Override
      public void onProgress(String tablespace, Integer partition, Long version, File file,
          long totalSize, long sizeDownloaded) {
      }
      @Override
      public void onFileReceived(String tablespace, Integer partition, Long version, File file) {
      }
      @Override
      public void onBadCRC(String tablespace, Integer partition, Long version, File file) {
      }
      @Override
      public void onError(Throwable t, String tablespace, Integer partition, Long version, File file) {
        if(t.getMessage().contains("Incoming file already being transferred")) {
          failed.incrementAndGet();
        }
      }
    });
    exchanger.init();
    exchanger.run();

    String dnodeHost = conf.getString(DNodeProperties.HOST);
    int httpPort = conf.getInt(HttpFileExchangerProperties.HTTP_PORT);

    exchanger.send("t1", 1, 1l, fileToSend, "http://" + dnodeHost + ":" + httpPort, true);
    exchanger.send("t1", 1, 1l, fileToSend, "http://" + dnodeHost + ":" + httpPort, true);
   
    final File downloadedFile = new File(new File(TMP_DOWNLOAD_DIR,
View Full Code Here

    String fileContents = "This is a text file. It is not very big, but it is ok for a test. "
        + "Specially if we use a small buffer size to try to detect race conditions.";
    Files.write(fileContents.getBytes(), fileToSend);

    SploutConfiguration conf = SploutConfiguration.getTestConfig();
    conf.setProperty(FetcherProperties.DOWNLOAD_BUFFER, 16);
    conf.setProperty(FetcherProperties.TEMP_DIR, TMP_DOWNLOAD_DIR);

    final AtomicBoolean receivedOk = new AtomicBoolean(false);

    HttpFileExchanger exchanger = new HttpFileExchanger(conf, new ReceiveFileCallback() {
      @Override
      public void onProgress(String tablespace, Integer partition, Long version, File file,
          long totalSize, long sizeDownloaded) {
      }
      @Override
      public void onFileReceived(String tablespace, Integer partition, Long version, File file) {
        receivedOk.set(true);
      }
      @Override
      public void onBadCRC(String tablespace, Integer partition, Long version, File file) {
      }
      @Override
      public void onError(Throwable t, String tablespace, Integer partition, Long version, File file) {
      }
    });
    exchanger.init();
    exchanger.run();

    String dnodeHost = conf.getString(DNodeProperties.HOST);
    int httpPort = conf.getInt(HttpFileExchangerProperties.HTTP_PORT);

    exchanger.send("t1", 0, 1l, fileToSend, "http://" + dnodeHost + ":" + httpPort, true);

    final File downloadedFile = new File(new File(TMP_DOWNLOAD_DIR,
        DNodeHandler.getLocalStoragePartitionRelativePath("t1", 0, 1l)), fileToSend.getName());
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.