Package org.syncany.config.to

Examples of org.syncany.config.to.ConfigTO


  public void testConfigHelperLoadConfigTO() throws Exception {
    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
   
    // Run
    ConfigTO loadedConfigTO = ConfigHelper.loadConfigTO(testConfig.getLocalDir());
   
    // Test
    assertNotNull(loadedConfigTO);
    assertEquals(testConfig.getDisplayName(), loadedConfigTO.getDisplayName());
    assertEquals(testConfig.getMachineName(), loadedConfigTO.getMachineName());
    assertEquals(testConfig.getMasterKey(), loadedConfigTO.getMasterKey());
   
    // Tear down
    TestConfigUtil.deleteTestLocalConfigAndData(testConfig);   
  }
View Full Code Here


  public void testConfigHelperLoadRepoTO() throws Exception {   
    // 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());
View Full Code Here

    // B.connect()
    File localDirB = TestFileUtil.createTempDirectoryInSystemTemp(TestConfigUtil.createUniqueName("clientB", initOperationOptionsA));
    File localConnectDirB = new File(localDirB, Config.DIR_APPLICATION);

    ConfigTO connectionConfigToB = initOperationOptionsA.getConfigTO();
    connectionConfigToB.setMachineName("clientB" + Math.abs(new Random().nextInt()));
    connectionConfigToB.setMasterKey(null);

    ConnectOperationOptions connectOperationOptionsB = new ConnectOperationOptions();
    connectOperationOptionsB.setStrategy(ConnectOptionsStrategy.CONNECTION_TO);
    connectOperationOptionsB.setConfigTO(connectionConfigToB);
    connectOperationOptionsB.setPassword(initOperationOptionsA.getPassword());
View Full Code Here

    // B.connect()
    File localDirB = TestFileUtil.createTempDirectoryInSystemTemp(TestConfigUtil.createUniqueName("client-B", initOperationOptionsA));
    File localConnectDirB = new File(localDirB, Config.DIR_APPLICATION);

    ConfigTO connectionConfigToB = initOperationOptionsA.getConfigTO();
    ((LocalTransferSettings) connectionConfigToB.getTransferSettings()).setPath(new File("/does/not/exist")); // <<< Point to non-existing repo
    connectionConfigToB.setMachineName("client-B" + Math.abs(new Random().nextInt()));
    connectionConfigToB.setMasterKey(null);

    ConnectOperationOptions connectOperationOptionsB = new ConnectOperationOptions();
    connectOperationOptionsB.setStrategy(ConnectOptionsStrategy.CONNECTION_TO);
    connectOperationOptionsB.setConfigTO(connectionConfigToB);
    connectOperationOptionsB.setPassword(initOperationOptionsA.getPassword());
View Full Code Here

      return masterKey;
    }
  }

  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());
View Full Code Here

    tempLocalDir.mkdirs();

    RepoTO repoTO = createRepoTO();

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

    // Get Masterkey
    SaltedSecretKey masterKey = getMasterKey();
    configTO.setMasterKey(masterKey);

    LocalTransferSettings localConnection = (LocalTransferSettings) connection;
    // Create connection TO
    Map<String, String> localConnectionSettings = new HashMap<String, String>();
    localConnectionSettings.put("path", localConnection.getPath().getAbsolutePath());

    configTO.setTransferSettings(connection);

    // Create
    Config config = new Config(tempLocalDir, configTO, repoTO);

    config.setConnection(connection);
View Full Code Here

    tempRepoDir.mkdirs();

    RepoTO repoTO = createRepoTO();

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

    // Get Masterkey
    SaltedSecretKey masterKey = getMasterKey();
    configTO.setMasterKey(masterKey);

    // Generic connection settings wont work anymore, because they are plugin dependent now.
    LocalTransferSettings transferSettings = Plugins.get("local", TransferPlugin.class).createEmptySettings();
    transferSettings.setPath(tempRepoDir);

    configTO.setTransferSettings(transferSettings);

    InitOperationOptions operationOptions = new InitOperationOptions();

    operationOptions.setLocalDir(tempLocalDir);
    operationOptions.setConfigTO(configTO);
View Full Code Here

    File appDir = new File(localDir, Config.DIR_APPLICATION);

    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) {
        logger.log(Level.WARNING, "Not loading config! Plugin with id '{0}' does not exist.", pluginId);
        throw new ConfigException("Plugin with id '" + pluginId + "' does not exist. Try 'sy plugin install " + pluginId + "'.");
View Full Code Here

public class ConfigTest {
  @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   
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

TOP

Related Classes of org.syncany.config.to.ConfigTO

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.