case PROJECT:
String projectKey = keyGenerator.generateKey(component, null);
String uuid = uuidSupplier.apply(projectKey);
+ String projectPublicKey = publicKeyGenerator.generateKey(component, null);
return ComponentImpl.builder(Component.Type.PROJECT)
.setUuid(uuid)
.setKey(projectKey)
- .setPublicKey(publicKeyGenerator.generateKey(component, null))
+ .setPublicKey(projectPublicKey)
.setName(nameOfProject(component))
.setStatus(convertStatus(component.getStatus()))
.setDescription(trimToNull(component.getDescription()))
case MODULE:
String moduleKey = keyGenerator.generateKey(component, null);
+ String modulePublicKey = publicKeyGenerator.generateKey(component, null);
return ComponentImpl.builder(Component.Type.MODULE)
.setUuid(uuidSupplier.apply(moduleKey))
.setKey(moduleKey)
- .setPublicKey(publicKeyGenerator.generateKey(component, null))
- .setName(nameOfOthers(component, moduleKey))
+ .setPublicKey(modulePublicKey)
+ .setName(nameOfOthers(component, modulePublicKey))
.setStatus(convertStatus(component.getStatus()))
.setDescription(trimToNull(component.getDescription()))
.setReportAttributes(createAttributesBuilder(component).build())
case DIRECTORY:
case FILE:
String key = keyGenerator.generateKey(closestModule, component);
+ String publicKey = publicKeyGenerator.generateKey(closestModule, component);
return ComponentImpl.builder(convertDirOrFileType(component.getType()))
.setUuid(uuidSupplier.apply(key))
.setKey(key)
- .setPublicKey(publicKeyGenerator.generateKey(closestModule, component))
- .setName(nameOfOthers(component, key))
+ .setPublicKey(publicKey)
+ .setName(nameOfOthers(component, publicKey))
.setStatus(convertStatus(component.getStatus()))
.setDescription(trimToNull(component.getDescription()))
.setReportAttributes(createAttributesBuilder(component).build())
Component root = call(project);
Component module = root.getChildren().iterator().next();
- assertThat(module.getName()).isEqualTo("generated_M");
+ assertThat(module.getName()).isEqualTo("public_M");
Component directory = module.getChildren().iterator().next();
- assertThat(directory.getName()).isEqualTo("generated_M:src/js");
+ assertThat(directory.getName()).isEqualTo("public_M:src/js");
Component file = directory.getChildren().iterator().next();
- assertThat(file.getName()).isEqualTo("generated_M:src/js/Foo.js");
+ assertThat(file.getName()).isEqualTo("public_M:src/js/Foo.js");
}
@Test
- public void names_of_module_directory_and_file_are_keys_if_names_are_empty_in_report() {
+ public void names_of_module_directory_and_file_are_public_keys_if_names_are_empty_in_report() {
ScannerReport.Component project = newBuilder()
.setType(PROJECT)
.setKey(projectInDb.getKey())
Component root = call(project);
Component module = root.getChildren().iterator().next();
- assertThat(module.getName()).isEqualTo("generated_M");
+ assertThat(module.getName()).isEqualTo("public_M");
Component directory = module.getChildren().iterator().next();
- assertThat(directory.getName()).isEqualTo("generated_M:src/js");
+ assertThat(directory.getName()).isEqualTo("public_M:src/js");
Component file = directory.getChildren().iterator().next();
- assertThat(file.getName()).isEqualTo("generated_M:src/js/Foo.js");
+ assertThat(file.getName()).isEqualTo("public_M:src/js/Foo.js");
}
private void assertThatFileAttributesAreNotSet(Component root) {