Search in sources :

Example 1 with ZipMultiChunker

use of org.syncany.chunk.ZipMultiChunker in project syncany by syncany.

the class FrameworkCombinationTest method fillCombinations.

private void fillCombinations() throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException {
    // MultiChunks
    List<MultiChunker> multiChunkers = new LinkedList<MultiChunker>();
    int[] multiChunkSizes = new int[] { 250000, 500000 };
    for (int i = 0; i < multiChunkSizes.length; i++) {
        //multiChunkers.add(new CustomMultiChunker(multiChunkSizes[i]));
        multiChunkers.add(new ZipMultiChunker(multiChunkSizes[i]));
    }
    // Chunks
    List<Chunker> chunkers = new LinkedList<Chunker>();
    int[] chunkSizes = new int[] { 8000, 16000 };
    String[] digestAlgs = new String[] { /*"MD5" ,*/
    "SHA1" };
    String[] fingerprinters = new String[] { "Adler32" };
    for (int i = 0; i < chunkSizes.length; i++) {
        for (int j = 0; j < digestAlgs.length; j++) {
            for (int k = 0; k < fingerprinters.length; k++) {
                chunkers.add(new TttdChunker(chunkSizes[i], TttdChunker.DEFAULT_WINDOW_SIZE, digestAlgs[j], fingerprinters[k]));
            }
        }
    }
    // Compression/Encryption
    List<CipherSpec> cipherSpecs = new ArrayList<CipherSpec>();
    cipherSpecs.add(CipherSpecs.getCipherSpec(1));
    cipherSpecs.add(CipherSpecs.getCipherSpec(2));
    List<Transformer> transformerChains = new LinkedList<Transformer>();
    transformerChains.add(new NoTransformer());
    transformerChains.add(new GzipTransformer());
    transformerChains.add(new CipherTransformer(cipherSpecs, masterKey));
    transformerChains.add(new GzipTransformer(new CipherTransformer(cipherSpecs, masterKey)));
    for (MultiChunker multiChunker : multiChunkers) {
        for (Transformer transformer : transformerChains) {
            for (Chunker chunker : chunkers) {
                String configName = multiChunker + "/" + chunker + "/" + transformer;
                combinations.add(new FrameworkCombination(configName, chunker, multiChunker, transformer));
            }
        }
    }
}
Also used : GzipTransformer(org.syncany.chunk.GzipTransformer) CipherTransformer(org.syncany.chunk.CipherTransformer) GzipTransformer(org.syncany.chunk.GzipTransformer) NoTransformer(org.syncany.chunk.NoTransformer) Transformer(org.syncany.chunk.Transformer) ZipMultiChunker(org.syncany.chunk.ZipMultiChunker) TttdChunker(org.syncany.chunk.TttdChunker) Chunker(org.syncany.chunk.Chunker) MultiChunker(org.syncany.chunk.MultiChunker) CipherTransformer(org.syncany.chunk.CipherTransformer) ArrayList(java.util.ArrayList) ZipMultiChunker(org.syncany.chunk.ZipMultiChunker) MultiChunker(org.syncany.chunk.MultiChunker) TttdChunker(org.syncany.chunk.TttdChunker) LinkedList(java.util.LinkedList) NoTransformer(org.syncany.chunk.NoTransformer) ZipMultiChunker(org.syncany.chunk.ZipMultiChunker) CipherSpec(org.syncany.crypto.CipherSpec)

Example 2 with ZipMultiChunker

use of org.syncany.chunk.ZipMultiChunker in project syncany by syncany.

the class MultiChunkerTest method testChunkFileIntoMultiChunks.

@Test
public void testChunkFileIntoMultiChunks() throws Exception {
    int minMultiChunkSize = 512;
    int chunkSizeB = 16000;
    Chunker[] chunkers = new Chunker[] { new FixedChunker(chunkSizeB) };
    MultiChunker[] multiChunkers = new MultiChunker[] { //new CustomMultiChunker(minMultiChunkSize),
    new ZipMultiChunker(minMultiChunkSize) };
    for (Chunker chunker : chunkers) {
        for (MultiChunker multiChunker : multiChunkers) {
            logger.log(Level.INFO, "Running with " + chunker.getClass() + " and " + multiChunker.getClass());
            chunkFileIntoMultiChunks(chunker, multiChunker, minMultiChunkSize);
        }
    }
}
Also used : FixedChunker(org.syncany.chunk.FixedChunker) ZipMultiChunker(org.syncany.chunk.ZipMultiChunker) FixedChunker(org.syncany.chunk.FixedChunker) Chunker(org.syncany.chunk.Chunker) MultiChunker(org.syncany.chunk.MultiChunker) ZipMultiChunker(org.syncany.chunk.ZipMultiChunker) MultiChunker(org.syncany.chunk.MultiChunker) ZipMultiChunker(org.syncany.chunk.ZipMultiChunker) Test(org.junit.Test)

Aggregations

Chunker (org.syncany.chunk.Chunker)2 MultiChunker (org.syncany.chunk.MultiChunker)2 ZipMultiChunker (org.syncany.chunk.ZipMultiChunker)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 Test (org.junit.Test)1 CipherTransformer (org.syncany.chunk.CipherTransformer)1 FixedChunker (org.syncany.chunk.FixedChunker)1 GzipTransformer (org.syncany.chunk.GzipTransformer)1 NoTransformer (org.syncany.chunk.NoTransformer)1 Transformer (org.syncany.chunk.Transformer)1 TttdChunker (org.syncany.chunk.TttdChunker)1 CipherSpec (org.syncany.crypto.CipherSpec)1