Package org.syncany.config.to

Examples of org.syncany.config.to.ConfigTO


  }
 
  @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

  }
 
  @Test
  public void testConfigMachineNameInvalidChars() throws Exception {
    File localDir = new File("/some/folder");
    ConfigTO configTO = new ConfigTO();
    RepoTO repoTO = new RepoTO();
   
    configTO.setMachineName("invalid machine name");
   
    // Run!
    try {
      new Config(localDir, configTO, repoTO);
      fail("Machine name should not have been accepted.");
View Full Code Here

  }
 
  @Test
  public void testConfigMachineNameInvalidNull() throws Exception {
    File localDir = new File("/some/folder");
    ConfigTO configTO = new ConfigTO();
    RepoTO repoTO = new RepoTO();
   
    configTO.setMachineName(null); // <<< Invalid
     
    // Run!
    try {
      new Config(localDir, configTO, repoTO);
      fail("Machine name should not have been accepted.");
View Full Code Here

 
  @Test
  public void testConfigMultiChunkerNull() 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.setRepoId(new byte[] { 0x01, 0x02 }); // <<< valid
    repoTO.setTransformers(null); // <<< valid
   
View Full Code Here

  @Ignore
  // TODO [low] ChunkerTO is not used yet; so no test for it.
  public void testConfigChunkerNull() throws Exception {
    // Setup
    File localDir = new File("/some/folder");
    ConfigTO configTO = new ConfigTO();
    RepoTO repoTO = new RepoTO();
   
    configTO.setMachineName("somevalidmachinename"); // <<< valid
   
    repoTO.setMultiChunker(TestConfigUtil.createZipMultiChunkerTO()); // <<< valid
    repoTO.setRepoId(new byte[] { 0x01, 0x02 }); // <<< valid
    repoTO.setTransformers(null); // <<< valid
View Full Code Here

 
  @Test
  public void testConfigCipherTransformersInvalidType() 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
   
View Full Code Here

  @Test
  @SuppressWarnings("serial")
  public void testConfigCipherTransformersCipherFound() 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
    configTO.setMasterKey(createDummyMasterKey()); // <<< valid
   
    // Set invalid transformer
    TransformerTO invalidTransformerTO = new TransformerTO();
    invalidTransformerTO.setType("cipher");
    invalidTransformerTO.setSettings(new HashMap<String, String>() {
View Full Code Here

  @Test
  @SuppressWarnings("serial")
  public void testConfigCipherTransformersCipherNotFound() 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
    configTO.setMasterKey(createDummyMasterKey()); // <<< valid
   
    // Set invalid transformer
    TransformerTO invalidTransformerTO = new TransformerTO();
    invalidTransformerTO.setType("cipher");
    invalidTransformerTO.setSettings(new HashMap<String, String>() {
View Full Code Here

    final String bazTest = "baz";
    final int numberTest = 1234;

    final DummyTransferSettings ts = new DummyTransferSettings();
    final LocalTransferSettings lts = new LocalTransferSettings();
    final ConfigTO conf = TestConfigUtil.createTestInitOperationOptions("syncanytest").getConfigTO();

    conf.setTransferSettings(ts);

    ts.foo = fooTest;
    ts.baz = bazTest;
    ts.number = numberTest;
    lts.setPath(File.createTempFile("aaa", "bbb"));
    ts.subsettings = lts;

    assertTrue(ts.isValid());

    Serializer serializer = new Persister();
    serializer.write(conf, tmpFile);

    System.out.println(new String(Files.readAllBytes(Paths.get(tmpFile.toURI()))));

    ConfigTO confRestored = ConfigTO.load(tmpFile);
    TransferPlugin plugin = Plugins.get(confRestored.getTransferSettings().getType(), TransferPlugin.class);
    assertNotNull(plugin);

    TransferSettings tsRestored = confRestored.getTransferSettings();
    assertNotNull(tsRestored);

    DummyTransferManager transferManager = plugin.createTransferManager(tsRestored, config);
    assertNotNull(transferManager);
  }
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.