Package org.syncany.config.to

Examples of org.syncany.config.to.RepoTO


 
  @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 {
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 {
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
   
    repoTO.setMultiChunker(null); // <<< INVALID !!
       
    // Run!
    try {
      new Config(localDir, configTO, repoTO);
      fail("Config should not been have initialized.");
View Full Code Here

  // 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

    repoTO.setChunkerTO(null); // <<< INVALID !!

    // Run!
    try {
      new Config(localDir, configTO, repoTO);
      fail("Config should not been have initialized.");
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
   
    // Set invalid transformer
    TransformerTO invalidTransformerTO = new TransformerTO();
    invalidTransformerTO.setType("invalid-typeXXX");
    invalidTransformerTO.setSettings(new HashMap<String, String>());   

    ArrayList<TransformerTO> transformers = new ArrayList<TransformerTO>();
    transformers.add(invalidTransformerTO);
   
    repoTO.setTransformers(transformers); // <<< INVALID !
   
    // Run!
    try {
      new Config(localDir, configTO, repoTO);
      fail("Transformer should NOT have been found.");
View Full Code Here

  @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>() {
      {
        put("cipherspecs", "1,2");
      }
    });

    ArrayList<TransformerTO> transformers = new ArrayList<TransformerTO>();
    transformers.add(invalidTransformerTO);
   
    repoTO.setTransformers(transformers); // <<< valid
   
    // Run!
    Config config = new Config(localDir, configTO, repoTO);
   
    // Test
View Full Code Here

  @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>() {
      {
        put("cipherspecs", "1,INVALIDXXXX"); // <<<< INVALID !
      }
    });

    ArrayList<TransformerTO> transformers = new ArrayList<TransformerTO>();
    transformers.add(invalidTransformerTO);
   
    repoTO.setTransformers(transformers);
   
    // Run!
    try {
      new Config(localDir, configTO, repoTO);
      fail("Transformer should NOT have been able to initialize.");
View Full Code Here

    String password = validateAndGetPassword(options, optionNoEncryption, optionPassword);
    operationOptions.setPassword(password);
   
    // Create configTO and repoTO
    ConfigTO configTO = createConfigTO(transferSettings);
    RepoTO repoTO = createRepoTO(chunkerTO, multiChunkerTO, transformersTO);

    operationOptions.setLocalDir(localDir);
    operationOptions.setConfigTO(configTO);
    operationOptions.setRepoTO(repoTO);
View Full Code Here

    return cipherSpecs;
  }

  protected RepoTO createRepoTO(ChunkerTO chunkerTO, MultiChunkerTO multiChunkerTO, List<TransformerTO> transformersTO) throws Exception {
    // Make transfer object
    RepoTO repoTO = new RepoTO();

    // Create random repo identifier
    byte[] newRepoId = new byte[REPO_ID_LENGTH];
    new SecureRandom().nextBytes(newRepoId);

    repoTO.setRepoId(newRepoId);

    // Add to repo transfer object
    repoTO.setChunkerTO(chunkerTO);
    repoTO.setMultiChunker(multiChunkerTO);
    repoTO.setTransformers(transformersTO);

    return repoTO;
  }
View Full Code Here

TOP

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

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.