int maxPosition = key.length() == SINGLE_INDEX_SIZE ? 0 : key.length() - MINIMUM_KEY_SIZE;
for (int position = 0; position <= maxPosition; position++) {
dto.setPosition(position);
- dto.setKey(substring(key, position, MAXIMUM_KEY_SIZE));
+ dto.setKey(substring(key, position, position + MAXIMUM_KEY_SIZE));
mapper.insert(dto);
}
}
@Test
public void restrict_indexed_combinations_to_400_characters() {
String longName = repeat("a", 2_000);
- ComponentDto project = new ComponentDto().setId(1L).setKey("the_key").setName(longName).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT);
+ ComponentDto project = new ComponentDto().setKey("the_key").setName(longName).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT);
DbSession session = dbTester.getSession();
dbTester.getDbClient().componentDao().insert(session, project);
dbTester.getDbClient().snapshotDao().insert(session, new SnapshotDto().setComponentId(project.getId()).setRootProjectId(project.getId()).setLast(true));