From: Simon Brandhof Date: Thu, 12 Jul 2012 16:38:42 +0000 (+0200) Subject: Merge branch 'master' of /Users/sbrandhof/projects/github/sonar with conflicts. X-Git-Tag: 3.2~98 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a2a1a000cb251bd814d1977cd7037a3e69681dd2;p=sonarqube.git Merge branch 'master' of /Users/sbrandhof/projects/github/sonar with conflicts. --- diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 42fbb1b8df8..c13aadefbd2 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -1268,8 +1268,10 @@ my_profile.password.wrong_old=Wrong old password # BULK RESOURCE DELETION # #------------------------------------------------------------------------------ -bulk_deletion.no_resource_to_delete=No resource to delete -bulk_deletion.resource_name_filter_by_name=Filter resources by name +bulk_deletion.resource.projects=Projects +bulk_deletion.resource.views=Views +bulk_deletion.resource.devs=Developers +bulk_deletion.resource_name_filter_by_name=Filter by name: bulk_deletion.search=Search bulk_deletion.page_size=Page size bulk_deletion.select_all=Select all @@ -1279,7 +1281,7 @@ bulk_deletion.following_deletions_failed=The following resources could not be de bulk_deletion.hide_message=Hide message bulk_deletion.sure_to_delete_the_resources=Are you sure you want to delete the selected resources? bulk_deletion.deletion_manager.deleting_resources=Deleting resources... -bulk_deletion.deletion_manager.no_resource_to_delete=No resource to delete. +bulk_deletion.deletion_manager.no_resource_to_delete=No results. bulk_deletion.deletion_manager.currently_deleting_x_out_of_x=Currently deleting resources... ({0} out of {1}) bulk_deletion.deletion_manager.deletion_completed=Resource deletion completed. bulk_deletion.deletion_manager.however_failures_occurred=However, some failures occurred. diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java index 6f4d8f89a12..d14685681ba 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java @@ -21,72 +21,72 @@ package org.sonar.api.measures; import org.apache.commons.lang.StringUtils; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RulePriority; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; +import static org.fest.assertions.Assertions.assertThat; public class MeasureTest { + @org.junit.Rule + public ExpectedException thrown = ExpectedException.none(); + @Test public void valueCanBeNull() { Measure measure = new Measure("metric_key").setValue(null); - assertThat(measure.getValue(), nullValue()); + assertThat(measure.getValue()).isNull(); } - @Test(expected = IllegalArgumentException.class) + @Test public void valueShouldNotBeNaN() { + thrown.expect(IllegalArgumentException.class); new Measure("metric_key").setValue(Double.NaN); } @Test public void scaleValue() { - assertThat(new Measure(CoreMetrics.COVERAGE, 80.666666).getValue(), is(80.7)); - assertThat(new Measure(CoreMetrics.COVERAGE, 80.666666, 2).getValue(), is(80.67)); + assertThat(new Measure(CoreMetrics.COVERAGE, 80.666666).getValue()).isEqualTo(80.7); + assertThat(new Measure(CoreMetrics.COVERAGE, 80.666666, 2).getValue()).isEqualTo(80.67); } @Test public void defaultPersistenceModeIsFull() { - assertThat(new Measure(CoreMetrics.LINES, 32.0).getPersistenceMode(), is(PersistenceMode.FULL)); + assertThat(new Measure(CoreMetrics.LINES, 32.0).getPersistenceMode()).isEqualTo(PersistenceMode.FULL); } @Test public void persistenceModeIsDatabaseForBigDataMeasures() { Measure bigDataMeasure = new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "long data") - .setPersistenceMode(PersistenceMode.DATABASE); - assertThat(bigDataMeasure.getPersistenceMode(), is(PersistenceMode.DATABASE)); + .setPersistenceMode(PersistenceMode.DATABASE); + assertThat(bigDataMeasure.getPersistenceMode()).isEqualTo(PersistenceMode.DATABASE); } @Test public void measureWithLevelValue() { - assertThat(new Measure(CoreMetrics.ALERT_STATUS, Metric.Level.ERROR).getData(), is("ERROR")); - assertThat(new Measure(CoreMetrics.ALERT_STATUS, Metric.Level.ERROR).getDataAsLevel(), is(Metric.Level.ERROR)); - assertThat(new Measure(CoreMetrics.ALERT_STATUS).setData(Metric.Level.ERROR).getDataAsLevel(), is(Metric.Level.ERROR)); + assertThat(new Measure(CoreMetrics.ALERT_STATUS, Metric.Level.ERROR).getData()).isEqualTo("ERROR"); + assertThat(new Measure(CoreMetrics.ALERT_STATUS, Metric.Level.ERROR).getDataAsLevel()).isEqualTo(Metric.Level.ERROR); + assertThat(new Measure(CoreMetrics.ALERT_STATUS).setData(Metric.Level.ERROR).getDataAsLevel()).isEqualTo(Metric.Level.ERROR); } @Test public void measureWithIntegerValue() { - assertThat(new Measure(CoreMetrics.LINES).setIntValue(3).getValue(), is(3.0)); - assertThat(new Measure(CoreMetrics.LINES).setIntValue(null).getValue(), nullValue()); + assertThat(new Measure(CoreMetrics.LINES).setIntValue(3).getValue()).isEqualTo(3.0); + assertThat(new Measure(CoreMetrics.LINES).setIntValue(null).getValue()).isNull(); - assertThat(new Measure(CoreMetrics.LINES).setIntValue(3).getIntValue(), is(3)); - assertThat(new Measure(CoreMetrics.LINES).setIntValue(null).getIntValue(), nullValue()); + assertThat(new Measure(CoreMetrics.LINES).setIntValue(3).getIntValue()).isEqualTo(3); + assertThat(new Measure(CoreMetrics.LINES).setIntValue(null).getIntValue()).isNull(); - assertThat(new Measure(CoreMetrics.LINES).setValue(3.6).getIntValue(), is(3)); + assertThat(new Measure(CoreMetrics.LINES).setValue(3.6).getIntValue()).isEqualTo(3); } @Test public void valuesAreRoundUp() { - assertThat(new Measure(CoreMetrics.COVERAGE, 5.22222222).getValue(), is(5.2)); - assertThat(new Measure(CoreMetrics.COVERAGE, 5.7777777).getValue(), is(5.8)); + assertThat(new Measure(CoreMetrics.COVERAGE, 5.22222222).getValue()).isEqualTo(5.2); + assertThat(new Measure(CoreMetrics.COVERAGE, 5.7777777).getValue()).isEqualTo(5.8); - assertThat(new Measure(CoreMetrics.COVERAGE, 5.22222222, 3).getValue(), is(5.222)); - assertThat(new Measure(CoreMetrics.COVERAGE, 5.7777777, 3).getValue(), is(5.778)); + assertThat(new Measure(CoreMetrics.COVERAGE, 5.22222222, 3).getValue()).isEqualTo(5.222); + assertThat(new Measure(CoreMetrics.COVERAGE, 5.7777777, 3).getValue()).isEqualTo(5.778); } /** @@ -97,60 +97,60 @@ public class MeasureTest { Measure measure1 = new Measure(); Measure measure2 = new Measure(); - assertThat(measure1.equals(null), is(false)); + assertThat(measure1.equals(null)).isFalse(); // another class - assertThat(measure1.equals(""), is(false)); + assertThat(measure1.equals("")).isFalse(); // same instance - assertThat(measure1.equals(measure1), is(true)); - assertThat(measure1.hashCode(), equalTo(measure2.hashCode())); + assertThat(measure1.equals(measure1)).isTrue(); + assertThat(measure1.hashCode()).isEqualTo(measure2.hashCode()); // same key - null - assertThat(measure1.equals(measure2), is(true)); - assertThat(measure2.equals(measure1), is(true)); - assertThat(measure1.hashCode(), equalTo(measure2.hashCode())); + assertThat(measure1.equals(measure2)).isTrue(); + assertThat(measure2.equals(measure1)).isTrue(); + assertThat(measure1.hashCode()).isEqualTo(measure2.hashCode()); // different keys measure1.setMetric(CoreMetrics.COVERAGE); - assertThat(measure1.equals(measure2), is(false)); - assertThat(measure2.equals(measure1), is(false)); - assertThat(measure1.hashCode(), not(equalTo(measure2.hashCode()))); + assertThat(measure1.equals(measure2)).isFalse(); + assertThat(measure2.equals(measure1)).isFalse(); + assertThat(measure1.hashCode()).isNotEqualTo(measure2.hashCode()); measure2.setMetric(CoreMetrics.LINES); - assertThat(measure1.equals(measure2), is(false)); - assertThat(measure2.equals(measure1), is(false)); - assertThat(measure1.hashCode(), not(equalTo(measure2.hashCode()))); + assertThat(measure1.equals(measure2)).isFalse(); + assertThat(measure2.equals(measure1)).isFalse(); + assertThat(measure1.hashCode()).isNotEqualTo(measure2.hashCode()); // same key measure2.setMetric(CoreMetrics.COVERAGE); - assertThat(measure1.equals(measure2), is(true)); - assertThat(measure2.equals(measure1), is(true)); - assertThat(measure1.hashCode(), equalTo(measure2.hashCode())); + assertThat(measure1.equals(measure2)).isTrue(); + assertThat(measure2.equals(measure1)).isTrue(); + assertThat(measure1.hashCode()).isEqualTo(measure2.hashCode()); // different committer measure1.setPersonId(1); - assertThat(measure1.equals(measure2), is(false)); - assertThat(measure2.equals(measure1), is(false)); - assertThat(measure1.hashCode(), not(equalTo(measure2.hashCode()))); + assertThat(measure1.equals(measure2)).isFalse(); + assertThat(measure2.equals(measure1)).isFalse(); + assertThat(measure1.hashCode()).isNotEqualTo(measure2.hashCode()); measure2.setPersonId(2); - assertThat(measure1.equals(measure2), is(false)); - assertThat(measure2.equals(measure1), is(false)); - assertThat(measure1.hashCode(), not(equalTo(measure2.hashCode()))); + assertThat(measure1.equals(measure2)).isFalse(); + assertThat(measure2.equals(measure1)).isFalse(); + assertThat(measure1.hashCode()).isNotEqualTo(measure2.hashCode()); // same committer measure2.setPersonId(1); - assertThat(measure1.equals(measure2), is(true)); - assertThat(measure2.equals(measure1), is(true)); - assertThat(measure1.hashCode(), equalTo(measure2.hashCode())); + assertThat(measure1.equals(measure2)).isTrue(); + assertThat(measure2.equals(measure1)).isTrue(); + assertThat(measure1.hashCode()).isEqualTo(measure2.hashCode()); // value doesn't matter measure1.setValue(1.0); measure2.setValue(2.0); - assertThat(measure1.equals(measure2), is(true)); - assertThat(measure2.equals(measure1), is(true)); - assertThat(measure1.hashCode(), equalTo(measure2.hashCode())); + assertThat(measure1.equals(measure2)).isTrue(); + assertThat(measure2.equals(measure1)).isTrue(); + assertThat(measure1.hashCode()).isEqualTo(measure2.hashCode()); } @Test @@ -161,37 +161,37 @@ public class MeasureTest { @Test public void shouldGetAndSetVariations() { Measure measure = new Measure(CoreMetrics.LINES).setVariation1(1d).setVariation2(2d).setVariation3(3d); - assertThat(measure.getVariation1(), is(1d)); - assertThat(measure.getVariation2(), is(2d)); - assertThat(measure.getVariation3(), is(3d)); + assertThat(measure.getVariation1()).isEqualTo(1d); + assertThat(measure.getVariation2()).isEqualTo(2d); + assertThat(measure.getVariation3()).isEqualTo(3d); } @Test public void shouldSetVariationsWithIndex() { Measure measure = new Measure(CoreMetrics.LINES).setVariation(2, 3.3); - assertThat(measure.getVariation1(), nullValue()); - assertThat(measure.getVariation2(), is(3.3)); - assertThat(measure.getVariation3(), nullValue()); + assertThat(measure.getVariation1()).isNull(); + assertThat(measure.getVariation2()).isEqualTo(3.3); + assertThat(measure.getVariation3()).isNull(); } @Test public void notEqualRuleMeasures() { Measure measure = new Measure(CoreMetrics.VIOLATIONS, 30.0); RuleMeasure ruleMeasure = new RuleMeasure(CoreMetrics.VIOLATIONS, new Rule("foo", "bar"), RulePriority.CRITICAL, 3); - assertFalse(measure.equals(ruleMeasure)); - assertFalse(ruleMeasure.equals(measure)); + assertThat(measure.equals(ruleMeasure)).isFalse(); + assertThat(ruleMeasure.equals(measure)).isFalse(); } @Test public void shouldUnsetData() { String data = "1=10;21=456"; Measure measure = new Measure(CoreMetrics.CONDITIONS_BY_LINE).setData(data); - assertThat(measure.hasData(), is(true)); - assertThat(measure.getData(), is(data)); + assertThat(measure.hasData()).isTrue(); + assertThat(measure.getData()).isEqualTo(data); measure.unsetData(); - assertThat(measure.hasData(), is(false)); - assertThat(measure.getData(), nullValue()); + assertThat(measure.hasData()).isFalse(); + assertThat(measure.getData()).isNull(); } } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb index 432284408f9..83becec1f0a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb @@ -17,14 +17,14 @@ %> <% form_tag( {:action => 'index'}, :method => :get ) do %> - <%= message('bulk_deletion.resource_name_filter_by_name') -%>: + <%= message('bulk_deletion.resource_name_filter_by_name') -%> <%= submit_tag message('bulk_deletion.search'), :id => 'filter_resources' %> <% end %> <% if @resources.empty? %>
- <%= message('bulk_deletion.no_resource_to_delete') -%> + <%= message('no_results') -%> <% else %> <% form_remote_tag( :url => {:action => 'delete_resources'}, :loading => "window.location='#{url_for :action => 'pending_deletions'}';") do %>