]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2706 Fix test and some issues
authorFabrice Bellingard <bellingard@gmail.com>
Mon, 14 May 2012 06:06:21 +0000 (08:06 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Mon, 14 May 2012 13:11:01 +0000 (15:11 +0200)
plugins/sonar-reviews-plugin/src/test/java/org/sonar/plugins/reviews/jira/JiraLinkReviewActionTest.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb

index eeade69d6ab8aa24d41e71513a4018a2a0d5632f..b73832cc598c993d58e8911bffe6180612739869 100644 (file)
@@ -95,7 +95,7 @@ public class JiraLinkReviewActionTest {
     ArgumentCaptor<Collection> reviewCaptor = ArgumentCaptor.forClass(Collection.class);
     verify(reviewDao).update(reviewCaptor.capture());
     ReviewDto reviewDto = (ReviewDto) reviewCaptor.getValue().iterator().next();
-    assertThat(reviewDto.getData(), is(action.getId() + "=FOO-15"));
+    assertThat(reviewDto.getData(), is("jira-issue-key=FOO-15"));
 
   }
 
index 788ad12341c9ac21fe15f4f1a66b44e9d5e85008..42686213f36cd385bd0ebe0a681eeef67af56086 100644 (file)
@@ -167,6 +167,9 @@ class ReviewsController < ApplicationController
         violation.review.create_comment({:user => current_user, :text => params[:text]}, params[:review_command_id])
       end
     end
+    
+    # Needs to reload as the review may have been changed on the Java side by a ReviewAction
+    violation.review.reload
 
     render :partial => "resource/violation", :locals => {:violation => violation}
   end
index 18253223c3e2a12e9399e69d5469c28bbda6861b..6fa9f5ff5f7918acb84fc4708f8b6a4b0e691b48 100644 (file)
@@ -267,10 +267,11 @@ class Review < ActiveRecord::Base
 
   def self.filter_commands(commands, violation, user=nil)
     unless commands
-      commands= Review.available_commands_for( Api::ReviewContext.new(:project => violation.snapshot.root_project) )
+      commands= available_commands_for( Api::ReviewContext.new(:project => violation.snapshot.root_project) )
     end
     
     review_context = Api::ReviewContext.new(:review => violation.review, :user => user)
+    puts "################# " + violation.review.data.to_s if violation.review
     actions = Java::OrgSonarServerUi::JRubyFacade.getInstance().filterCommands(commands, review_context.to_string_map, "org.sonar.api.reviews.LinkReviewCommand")
   end