@Before public void setUp() { index = new PackedMemoryCloneIndex(); }
public void computeCpd(Component component, Collection<Block> originBlocks, Collection<Block> duplicationBlocks) { CloneIndex duplicationIndex = new PackedMemoryCloneIndex(); populateIndex(duplicationIndex, originBlocks); populateIndex(duplicationIndex, duplicationBlocks); List<CloneGroup> duplications = SuffixTreeCloneDetectionAlgorithm.detect(duplicationIndex, originBlocks); Iterable<CloneGroup> filtered = from(duplications).filter(getNumberOfUnitsNotLessThan(component.getFileAttributes().getLanguageKey())); addDuplications(component, filtered); }
/** * Given: index, which accepts blocks with 4-byte hash. * Expected: exception during insertion of block with 8-byte hash. */ @Test(expected = IllegalArgumentException.class) public void attempt_to_insert_hash_of_incorrect_size() { CloneIndex index = new PackedMemoryCloneIndex(4, 1); index.insert(newBlock("a", 1)); }
/** * Given: index, which accepts blocks with 4-byte hash. * Expected: exception during search by 8-byte hash. */ @Test(expected = IllegalArgumentException.class) public void attempt_to_find_hash_of_incorrect_size() { CloneIndex index = new PackedMemoryCloneIndex(4, 1); index.getBySequenceHash(new ByteArray(1L)); }
@Before public void setUp() { index = new PackedMemoryCloneIndex(); bridge = new TokenizerBridge(new JavaTokenizer(), 10); }
/** * Given: index with initial capacity 1. * Expected: size and capacity should be increased after insertion of two blocks. */ @Test public void should_increase_capacity() { CloneIndex index = new PackedMemoryCloneIndex(8, 1); index.insert(newBlock("a", 1)); index.insert(newBlock("a", 2)); assertThat(index.getByResourceId("a").size(), is(2)); }
public void computeCpd(Component component, Collection<Block> originBlocks, Collection<Block> duplicationBlocks) { CloneIndex duplicationIndex = new PackedMemoryCloneIndex(); populateIndex(duplicationIndex, originBlocks); populateIndex(duplicationIndex, duplicationBlocks); List<CloneGroup> duplications = SuffixTreeCloneDetectionAlgorithm.detect(duplicationIndex, originBlocks); Iterable<CloneGroup> filtered = from(duplications).filter(getNumberOfUnitsNotLessThan(component.getFileAttributes().getLanguageKey())); addDuplications(component, filtered); }