.setOrganization(organizationKey)
.setProject(projectKey)
.setKey(result.getKey())
- .setName(result.longName())
- .setMatch(hit.getHighlightedText().orElse(HtmlEscapers.htmlEscaper().escape(result.longName())))
+ .setName(result.name())
+ .setMatch(hit.getHighlightedText().orElse(HtmlEscapers.htmlEscaper().escape(result.name())))
.setIsRecentlyBrowsed(recentlyBrowsedKeys.contains(result.getKey()))
.setIsFavorite(favoriteUuids.contains(result.uuid()))
.build();
@Test
public void suggestions_without_query_should_order_results() throws Exception {
- ComponentDto project1 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Alpha").setLongName("Alpha"));
- ComponentDto project2 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Bravo").setLongName("Bravo"));
- ComponentDto project3 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Charlie").setLongName("Charlie"));
- ComponentDto project4 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Delta").setLongName("Delta"));
+ ComponentDto project1 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Alpha"));
+ ComponentDto project2 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Bravo"));
+ ComponentDto project3 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Charlie"));
+ ComponentDto project4 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Delta"));
doReturn(asList(project4, project2)).when(favoriteFinder).list();
componentIndexer.indexOnStartup(null);
assertThat(response.getWarning()).contains(SHORT_INPUT_WARNING);
}
+ @Test
+ public void should_contain_component_names() throws Exception {
+ OrganizationDto organization1 = db.organizations().insert(o -> o.setKey("org-1").setName("Organization One"));
+
+ ComponentDto project1 = db.components().insertComponent(newPrivateProjectDto(organization1).setName("Project1"));
+ componentIndexer.indexProject(project1.projectUuid(), ProjectIndexer.Cause.PROJECT_CREATION);
+ authorizationIndexerTester.allowOnlyAnyone(project1);
+
+ SuggestionsWsResponse response = ws.newRequest()
+ .setMethod("POST")
+ .setParam(PARAM_QUERY, "Project")
+ .executeProtobuf(SuggestionsWsResponse.class);
+
+ assertThat(response.getResultsList())
+ .flatExtracting(Category::getItemsList)
+ .extracting(Suggestion::getKey, Suggestion::getName)
+ .containsExactlyInAnyOrder(tuple(project1.getKey(), project1.name()));
+ }
+
@Test
public void should_contain_organization_names() throws Exception {
OrganizationDto organization1 = db.organizations().insert(o -> o.setKey("org-1").setName("Organization One"));