use of org.syncany.config.to.RepoTO.TransformerTO in project syncany by syncany.
the class DefaultRepoTOFactory method getTransformersTO.
public List<TransformerTO> getTransformersTO(boolean gzipEnabled, List<CipherSpec> cipherSpecs) {
List<TransformerTO> transformersTO = new ArrayList<TransformerTO>();
if (gzipEnabled) {
transformersTO.add(getGzipTransformerTO());
}
if (cipherSpecs.size() > 0) {
TransformerTO cipherTransformerTO = getCipherTransformerTO(cipherSpecs);
transformersTO.add(cipherTransformerTO);
}
return transformersTO;
}
use of org.syncany.config.to.RepoTO.TransformerTO in project syncany by syncany.
the class DefaultRepoTOFactory method getCipherTransformerTO.
protected TransformerTO getCipherTransformerTO(List<CipherSpec> cipherSpec) {
String cipherSuitesIdStr = StringUtil.join(cipherSpec, ",", new StringJoinListener<CipherSpec>() {
@Override
public String getString(CipherSpec cipherSpec) {
return "" + cipherSpec.getId();
}
});
Map<String, String> cipherTransformerSettings = new HashMap<String, String>();
cipherTransformerSettings.put(CipherTransformer.PROPERTY_CIPHER_SPECS, cipherSuitesIdStr);
// Note: Property 'password' is added dynamically by CommandLineClient
TransformerTO cipherTransformerTO = new TransformerTO();
cipherTransformerTO.setType(CipherTransformer.TYPE);
cipherTransformerTO.setSettings(cipherTransformerSettings);
return cipherTransformerTO;
}
use of org.syncany.config.to.RepoTO.TransformerTO in project syncany by syncany.
the class ConfigTest method testConfigCipherTransformersCipherFound.
@Test
@SuppressWarnings("serial")
public void testConfigCipherTransformersCipherFound() throws Exception {
// Setup
File localDir = new File("/some/folder");
ConfigTO configTO = new ConfigTO();
RepoTO repoTO = new RepoTO();
// <<< valid
configTO.setMachineName("somevalidmachinename");
// <<< valid
repoTO.setChunkerTO(TestConfigUtil.createFixedChunkerTO());
// <<< valid
repoTO.setMultiChunker(TestConfigUtil.createZipMultiChunkerTO());
// <<< valid
repoTO.setRepoId(new byte[] { 0x01, 0x02 });
// <<< valid
configTO.setMasterKey(createDummyMasterKey());
// Set invalid transformer
TransformerTO invalidTransformerTO = new TransformerTO();
invalidTransformerTO.setType("cipher");
invalidTransformerTO.setSettings(new HashMap<String, String>() {
{
put("cipherspecs", "1,2");
}
});
List<TransformerTO> transformers = new ArrayList<TransformerTO>();
transformers.add(invalidTransformerTO);
// <<< valid
repoTO.setTransformers(transformers);
// Run!
Config config = new Config(localDir, configTO, repoTO);
// Test
assertNotNull(config.getChunker());
assertNotNull(config.getMultiChunker());
assertNotNull(config.getTransformer());
assertEquals("CipherTransformer", config.getTransformer().getClass().getSimpleName());
}
use of org.syncany.config.to.RepoTO.TransformerTO in project syncany by syncany.
the class TestConfigUtil method createRepoTO.
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();
// TODO [low] Chunker not configurable right now. Not used.
repoTO.setChunkerTO(chunkerTO);
repoTO.setMultiChunker(multiChunkerTO);
// Create TransformerTO
List<TransformerTO> transformerTOs = createTransformerTOs();
repoTO.setTransformers(transformerTOs);
return repoTO;
}
Aggregations