aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-07-23 14:03:42 +0200
committerStas Vilchik <vilchiks@gmail.com>2014-07-23 14:03:42 +0200
commit2a2294d055cc7f7cebb6f3f2138cd0637a646576 (patch)
tree10bf56ee0abfd8a2e6c90235c81fe488da5f5f9e /server
parent3017f1dd753af8baa461cc9901f9d5a737a28946 (diff)
parent4d828a37de90b1664855ab601836fbc931370102 (diff)
downloadsonarqube-2a2294d055cc7f7cebb6f3f2138cd0637a646576.tar.gz
sonarqube-2a2294d055cc7f7cebb6f3f2138cd0637a646576.zip
Merge remote-tracking branch 'origin/branch-4.4'
Conflicts: sonar-server/src/main/coffee/component-viewer/header/scm-header.coffee sonar-server/src/main/coffee/component-viewer/main.coffee
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java3
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java14
-rw-r--r--server/sonar-web/src/main/coffee/component-viewer/mixins/main-scm.coffee6
-rw-r--r--server/sonar-web/src/main/hbs/component-viewer/header/cw-scm-header.hbs11
4 files changed, 31 insertions, 3 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java
index ca756649a80..4213c5553be 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java
@@ -117,7 +117,8 @@ public class TestsShowAction implements RequestHandler {
json.prop("name", cursor.getAttrValue("name"));
json.prop("status", cursor.getAttrValue("status").toUpperCase());
- json.prop("durationInMs", Long.parseLong(cursor.getAttrValue("time")));
+ // time can contain float value, we have to truncate it
+ json.prop("durationInMs", ((Double) Double.parseDouble(cursor.getAttrValue("time"))).longValue());
SMInputCursor errorCursor = cursor.childElementCursor();
if (errorCursor.getNext() != null) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java
index 49c28868be6..9f7648e975a 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java
@@ -117,6 +117,20 @@ public class TestsShowActionTest {
request.execute().assertJson(getClass(), "show_from_test_data.json");
}
+ @Test
+ public void show_from_test_data_with_a_time_in_float() throws Exception {
+ MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, "SonarQube", TEST_PLAN_KEY);
+
+ when(measureDao.findByComponentKeyAndMetricKey(TEST_PLAN_KEY, "test_data", session)).thenReturn(MeasureDto.createFor(MeasureKey.of(TEST_PLAN_KEY, "test_data"))
+ .setTextValue("<tests-details>" +
+ "<testcase status=\"ok\" time=\"12.5\" name=\"test1\"/>" +
+ "</tests-details>"));
+
+ WsTester.TestRequest request = tester.newGetRequest("api/tests", "show").setParam("key", TEST_PLAN_KEY);
+
+ request.execute().assertJson(getClass(), "show_from_test_data_with_a_time_in_float.json");
+ }
+
private MutableTestCase testCase(String name, TestCase.Status status, Long durationInMs, int coveredLines, @Nullable String message, @Nullable String stackTrace) {
MutableTestCase testCase = mock(MutableTestCase.class);
when(testCase.name()).thenReturn(name);
diff --git a/server/sonar-web/src/main/coffee/component-viewer/mixins/main-scm.coffee b/server/sonar-web/src/main/coffee/component-viewer/mixins/main-scm.coffee
index 23c899f185f..d13be6b4e18 100644
--- a/server/sonar-web/src/main/coffee/component-viewer/mixins/main-scm.coffee
+++ b/server/sonar-web/src/main/coffee/component-viewer/mixins/main-scm.coffee
@@ -47,6 +47,10 @@ define [], () ->
@sourceView.render()
+ filterByModifiedLines: ->
+ @filterBySCM()
+
+
filterBySCM: ->
requests = [@requestSCM(@key)]
if @settings.get('issues') && !@state.get('hasIssues')
@@ -76,4 +80,4 @@ define [], () ->
@sourceView.addShowBlock scmBlockLine, line.lineNumber - 1
if predicate
@sourceView.addShowBlock scmBlockLine, _.size @source.get 'source'
- @sourceView.render() \ No newline at end of file
+ @sourceView.render()
diff --git a/server/sonar-web/src/main/hbs/component-viewer/header/cw-scm-header.hbs b/server/sonar-web/src/main/hbs/component-viewer/header/cw-scm-header.hbs
index d5802abdd57..599f9f71e33 100644
--- a/server/sonar-web/src/main/hbs/component-viewer/header/cw-scm-header.hbs
+++ b/server/sonar-web/src/main/hbs/component-viewer/header/cw-scm-header.hbs
@@ -2,4 +2,13 @@
<a class="highlighted-link js-scm-time-changes">
{{#if period}}Δ {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}}
</a>
-</div> \ No newline at end of file
+</div>
+
+<div class="component-viewer-header-expanded-bar-section">
+ <ul class="component-viewer-header-expanded-bar-section-list">
+ <li><a class="item js-filter-modified-lines">
+ <span>{{t 'component_viewer.scm.modified_lines'}}</span>
+ <i class="icon-chevron-right"></i>
+ </a></li>
+ </ul>
+</div>