Package org.syncany.config.to

Examples of org.syncany.config.to.RepoTO$ChunkerTO


    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
   
    // Run
    ConfigTO loadedConfigTO = ConfigHelper.loadConfigTO(testConfig.getLocalDir());
    RepoTO repoConfigTO = ConfigHelper.loadRepoTO(testConfig.getLocalDir(), loadedConfigTO);
   
    // Test
    assertNotNull(repoConfigTO);
    assertNotNull(repoConfigTO.getChunkerTO());
    assertNotNull(repoConfigTO.getMultiChunker());
    assertNotNull(repoConfigTO.getRepoId());
   
    if (TestConfigUtil.getCrypto()) {
      assertNotNull(repoConfigTO.getTransformers());
      assertEquals(2, repoConfigTO.getTransformers().size());
      assertEquals("gzip", repoConfigTO.getTransformers().get(0).getType());
      assertEquals("cipher", repoConfigTO.getTransformers().get(1).getType());
    }
    else {
      assertNull(repoConfigTO.getTransformers());
    }
   
    assertEquals("fixed", repoConfigTO.getChunkerTO().getType());
    assertEquals(1, repoConfigTO.getChunkerTO().getSettings().size());
    assertEquals("zip", repoConfigTO.getMultiChunker().getType());
    assertEquals(1, repoConfigTO.getMultiChunker().getSettings().size());
    assertEquals("010203", StringUtil.toHex(repoConfigTO.getRepoId()));
   
    // Tear down
    TestConfigUtil.deleteTestLocalConfigAndData(testConfig);     
  }
View Full Code Here


    return chunkerTO;
  }

  public static RepoTO createRepoTO() {
    // Create Repo TO
    RepoTO repoTO = new RepoTO();
    repoTO.setRepoId(new byte[] { 0x01, 0x02, 0x03 });

    // Create ChunkerTO and MultiChunkerTO
    MultiChunkerTO multiChunkerTO = createZipMultiChunkerTO();
    ChunkerTO chunkerTO = createFixedChunkerTO();
    repoTO.setChunkerTO(chunkerTO); // TODO [low] Chunker not configurable right now. Not used.
    repoTO.setMultiChunker(multiChunkerTO);

    // Create TransformerTO
    List<TransformerTO> transformerTOs = createTransformerTOs();
    repoTO.setTransformers(transformerTOs);
    return repoTO;
  }
View Full Code Here

  public static Config createDummyConfig() throws Exception {
    ConfigTO configTO = new ConfigTO();
    configTO.setMachineName("dummymachine");

    RepoTO repoTO = new RepoTO();
    repoTO.setTransformers(null);
    repoTO.setChunkerTO(createFixedChunkerTO());
    repoTO.setMultiChunker(createZipMultiChunkerTO());

    return new Config(new File("/dummy"), configTO, repoTO);
  }
View Full Code Here

  public static Config createTestLocalConfig(String machineName, TransferSettings connection) throws Exception {
    File tempLocalDir = TestFileUtil.createTempDirectoryInSystemTemp(createUniqueName("client-" + machineName, connection));
    tempLocalDir.mkdirs();

    RepoTO repoTO = createRepoTO();

    // Create config TO
    ConfigTO configTO = new ConfigTO();
    configTO.setMachineName(machineName + CipherUtil.createRandomAlphabeticString(20));
View Full Code Here

    File tempLocalDir = TestFileUtil.createTempDirectoryInSystemTemp(createUniqueName("client-" + machineName, machineName));
    File tempRepoDir = TestFileUtil.createTempDirectoryInSystemTemp(createUniqueName("repo", machineName));
    tempLocalDir.mkdirs();
    tempRepoDir.mkdirs();

    RepoTO repoTO = createRepoTO();

    // Create config TO
    ConfigTO configTO = new ConfigTO();
    configTO.setMachineName(machineName + Math.abs(new Random().nextInt()));
View Full Code Here

    if (appDir.exists()) {
      logger.log(Level.INFO, "Loading config from {0} ...", localDir);

      ConfigTO configTO = ConfigHelper.loadConfigTO(localDir);
      RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO);

      String pluginId = (configTO.getTransferSettings() != null) ? configTO.getTransferSettings().getType() : null;
      TransferPlugin plugin = Plugins.get(pluginId, TransferPlugin.class);

      if (plugin == null) {
View Full Code Here

  @Test
  public void testConfigValid() throws Exception {
    // Setup
    File localDir = new File("/some/folder");
    ConfigTO configTO = new ConfigTO();
    RepoTO repoTO = new RepoTO();
   
    configTO.setMachineName("somevalidmachinename"); // <<< valid
   
    repoTO.setChunkerTO(TestConfigUtil.createFixedChunkerTO()); // <<< valid
    repoTO.setMultiChunker(TestConfigUtil.createZipMultiChunkerTO()); // <<< valid
    repoTO.setRepoId(new byte[] { 0x01, 0x02 }); // <<< valid
    repoTO.setTransformers(null); // <<< valid   
   
    // Run!
    Config config = new Config(localDir, configTO, repoTO);
   
    // Test
View Full Code Here

 
  @Test(expected = ConfigException.class)
  public void testConfigInitLocalDirNull() throws Exception {
    File localDir = null;
    ConfigTO configTO = new ConfigTO();
    RepoTO repoTO = new RepoTO();
   
    new Config(localDir, configTO, repoTO);     
  }
View Full Code Here

 
  @Test(expected = ConfigException.class)
  public void testConfigInitConfigTONull() throws Exception {
    File localDir = new File("/some/folder");
    ConfigTO configTO = null;
    RepoTO repoTO = new RepoTO();
   
    new Config(localDir, configTO, repoTO);     
  }
View Full Code Here

 
  @Test(expected = ConfigException.class)
  public void testConfigInitRepoTONull() throws Exception {
    File localDir = new File("/some/folder");
    ConfigTO configTO = new ConfigTO();
    RepoTO repoTO = null;
   
    new Config(localDir, configTO, repoTO);     
  }
View Full Code Here

TOP

Related Classes of org.syncany.config.to.RepoTO$ChunkerTO

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.