action.createParam(PARAM_COMMENT)
.setDescription("Comment key")
- .setDeprecatedKey("key", "6.3")
.setSince("6.3")
.setRequired(true)
.setExampleValue(UUID_EXAMPLE_01);
action.createParam(PARAM_COMMENT)
.setDescription("Comment key")
- .setDeprecatedKey("key", "6.3")
.setSince("6.3")
.setRequired(true)
.setExampleValue(UUID_EXAMPLE_01);
Collection<ComponentDto> components = data.getComponents();
List<Issues.Component> result = new ArrayList<>();
for (ComponentDto dto : components) {
- String uuid = dto.uuid();
Component.Builder builder = Component.newBuilder()
.setKey(dto.getKey())
- .setUuid(uuid)
.setQualifier(dto.qualifier())
.setName(nullToEmpty(dto.name()))
.setLongName(nullToEmpty(dto.longName()))
private final OperationResponseWriter responseWriter;
public SetTagsAction(UserSession userSession, DbClient dbClient, IssueFinder issueFinder, IssueFieldsSetter issueFieldsSetter, IssueUpdater issueUpdater,
- OperationResponseWriter responseWriter) {
+ OperationResponseWriter responseWriter) {
this.userSession = userSession;
this.dbClient = dbClient;
this.issueFinder = issueFinder;
action.createParam(PARAM_ISSUE)
.setDescription("Issue key")
.setSince("6.3")
- .setDeprecatedKey("key", "6.3")
.setExampleValue(Uuids.UUID_EXAMPLE_01)
.setRequired(true);
action.createParam(PARAM_TAGS)
verifyContentOfPreloadedSearchResponseData(issueDto);
}
- @Test
- public void delete_comment_using_deprecated_key_parameter() {
- IssueDto issueDto = issueDbTester.insertIssue();
- UserDto user = dbTester.users().insertUser();
- IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, user, "please fix it");
- loginAndAddProjectPermission(user, issueDto, USER);
-
- tester.newRequest().setParam("key", commentDto.getKey()).setParam("text", "please have a look").execute();
-
- verify(responseWriter).write(eq(issueDto.getKey()), preloadedSearchResponseDataCaptor.capture(), any(Request.class), any(Response.class));
- assertThat(dbClient.issueChangeDao().selectCommentByKey(dbTester.getSession(), commentDto.getKey())).isNotPresent();
- verifyContentOfPreloadedSearchResponseData(issueDto);
- }
-
@Test
public void fail_when_comment_does_not_belong_to_current_user() {
IssueDto issueDto = issueDbTester.insertIssue();
assertThat(issueComment.getUpdatedAt()).isEqualTo(NOW);
}
- @Test
- public void edit_comment_using_deprecated_key_parameter() {
- IssueDto issueDto = newIssue();
- UserDto user = dbTester.users().insertUser();
- IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, user, "please fix it");
- loginWithBrowsePermission(user, USER, issueDto);
-
- tester.newRequest().setParam("key", commentDto.getKey()).setParam("text", "please have a look").execute();
-
- verify(responseWriter).write(eq(issueDto.getKey()), preloadedSearchResponseDataCaptor.capture(), any(Request.class), any(Response.class));
-
- verifyContentOfPreloadedSearchResponseData(issueDto);
- IssueChangeDto issueComment = dbClient.issueChangeDao().selectCommentByKey(dbTester.getSession(), commentDto.getKey()).get();
- assertThat(issueComment.getChangeData()).isEqualTo("please have a look");
- assertThat(issueComment.getUpdatedAt()).isEqualTo(NOW);
- }
-
@Test
public void fail_when_comment_is_for_hotspot() {
IssueDto hotspot = issueDbTester.insertHotspot();
String commentDtoKey = commentDto.getKey();
assertThatThrownBy(() -> call(commentDtoKey, "please have a look"))
- .isInstanceOf(NotFoundException.class)
- .hasMessage("Issue with key '%s' does not exist", hotspot.getKey());
+ .isInstanceOf(NotFoundException.class)
+ .hasMessage("Issue with key '%s' does not exist", hotspot.getKey());
}
@Test
assertThat(issueReloaded.getTags()).isEmpty();
}
- @Test
- public void set_tags_using_deprecated_key_param() {
- IssueDto issueDto = insertIssueForPublicProject(i -> i.setTags(singletonList("old-tag")));
- logIn(issueDto);
-
- ws.newRequest().setParam("key", issueDto.getKey()).setParam("tags", "bug").execute();
-
- IssueDto issueReloaded = dbClient.issueDao().selectByKey(db.getSession(), issueDto.getKey()).get();
- assertThat(issueReloaded.getTags()).containsOnly("bug");
- }
-
@Test
public void tags_are_stored_as_lowercase() {
IssueDto issueDto = insertIssueForPublicProject(i -> i.setTags(singletonList("old-tag")));
"components": [
{
"key": "FILE_KEY",
- "uuid": "FILE_ID",
"enabled": true,
"qualifier": "FIL",
"name": "NAME_FILE_ID",
},
{
"key": "PROJECT_KEY",
- "uuid": "PROJECT_ID",
"enabled": true,
"qualifier": "TRK",
"name": "NAME_PROJECT_ID",
"components": [
{
"key": "FILE_KEY",
- "uuid": "FILE_ID",
"enabled": true,
"qualifier": "FIL",
"name": "NAME_FILE_ID",
"components": [
{
"key": "FILE_KEY",
- "uuid": "FILE_ID",
"enabled": true,
"qualifier": "FIL",
"name": "NAME_FILE_ID",
},
{
"key": "PROJECT_KEY",
- "uuid": "PROJECT_ID",
"enabled": true,
"qualifier": "TRK",
"name": "NAME_PROJECT_ID",
"components": [
{
"key": "FILE_KEY",
- "uuid": "FILE_ID",
"enabled": true,
"qualifier": "FIL",
"name": "NAME_FILE_ID",
},
{
"key": "PROJECT_KEY",
- "uuid": "PROJECT_ID",
"enabled": true,
"qualifier": "TRK",
"name": "NAME_PROJECT_ID",
"components": [
{
"key": "ANOTHER_FILE_KEY",
- "uuid": "ANOTHER_FILE_ID",
"enabled": true,
"qualifier": "UTS",
"name": "NAME_ANOTHER_FILE_ID",
},
{
"key": "PROJECT_KEY",
- "uuid": "PROJECT_ID",
"enabled": true,
"qualifier": "TRK",
"name": "NAME_PROJECT_ID",
}],
"components": [ {
"key": "FILE_KEY",
- "uuid": "FILE_ID",
"enabled": true,
"qualifier": "FIL",
"name": "NAME_FILE_ID",
},
{
"key": "PROJECT_KEY",
- "uuid": "PROJECT_ID",
"enabled": true,
"qualifier": "TRK",
"name": "NAME_PROJECT_ID",
}
message Component {
- reserved 11; //drop organization
+ reserved 3, 11; //drop organization
optional int64 deprecatedId = 1;
optional string key = 2;
- optional string uuid = 3;
optional bool enabled = 4;
optional string qualifier = 5;
optional string name = 6;