Map<String, Object> dto = dbTester.selectFirst("select snapshot_id as \"snapshotId\", text_value as \"textValue\" from project_measures");
assertThat(dto.get("snapshotId")).isEqualTo(11L);
assertThat(dto.get("textValue")).isEqualTo(
- "<duplications><g><b s=\"1\" l=\"5\" r=\"PROJECT_KEY:file:origin/master\"/><b s=\"6\" l=\"5\" r=\"PROJECT_KEY:file:origin/master\"/></g></duplications>");
+ "<duplications><g><b s=\"1\" l=\"5\" r=\"PROJECT_KEY:origin/master:file\"/><b s=\"6\" l=\"5\" r=\"PROJECT_KEY:origin/master:file\"/></g></duplications>");
}
@Test
}
public static String createKey(String moduleKey, @Nullable String path, @Nullable String branch) {
- String effectiveKey = createEffectiveKey(moduleKey, path);
- if (StringUtils.isNotBlank(branch)) {
- return String.format(KEY_WITH_BRANCH_FORMAT, effectiveKey, branch);
- } else {
- return effectiveKey;
- }
+ String key = createKey(moduleKey, branch);
+ return createEffectiveKey(key, path);
}
}
@Test
public void create_key_from_module_key_path_and_branch() {
- assertThat(ComponentKeys.createKey("module_key", "file", "origin/master")).isEqualTo("module_key:file:origin/master");
+ assertThat(ComponentKeys.createKey("module_key", "file", "origin/master")).isEqualTo("module_key:origin/master:file");
assertThat(ComponentKeys.createKey("module_key", "file", null)).isEqualTo("module_key:file");
assertThat(ComponentKeys.createKey("module_key", null, null)).isEqualTo("module_key");
}