aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActiveAnalysisReportsAction.java20
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsAnalysisReportQueueEmptyAction.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java12
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActiveAnalysisReportsActionTest.java9
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/ws/AnalysisReportWebServiceTest.java6
7 files changed, 33 insertions, 30 deletions
diff --git a/pom.xml b/pom.xml
index e54d1df203f..5923ffc45bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,7 +55,7 @@
<repository>
<id>codehaus-nexus-staging</id>
<name>Codehaus Release Repository</name>
- <url>https://nexus.codehaus.org/service/local/staging/deploy/maven2/</url>
+ <url>https://nexus.codehaus.org/queue/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>sonar-snapshots</id>
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
index 705d69c5428..20d08702dba 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
@@ -79,8 +79,4 @@ public class ComputationService implements ServerComponent {
session.commit();
}
}
-
- public List<AnalysisReportDto> findAllUnfinishedAnalysisReports() {
- return null;
- }
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActiveAnalysisReportsAction.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActiveAnalysisReportsAction.java
index 7bcc93f440c..d37bcb2fcdf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActiveAnalysisReportsAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActiveAnalysisReportsAction.java
@@ -27,7 +27,7 @@ import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.core.computation.db.AnalysisReportDto;
-import org.sonar.server.computation.ComputationService;
+import org.sonar.server.computation.AnalysisReportQueue;
import java.util.List;
@@ -35,15 +35,15 @@ import java.util.List;
* @since 5.0
*/
public class ActiveAnalysisReportsAction implements RequestHandler {
- private final ComputationService service;
+ private final AnalysisReportQueue queue;
- public ActiveAnalysisReportsAction(ComputationService service) {
- this.service = service;
+ public ActiveAnalysisReportsAction(AnalysisReportQueue queue) {
+ this.queue = queue;
}
@Override
public void handle(Request request, Response response) throws Exception {
- List<AnalysisReportDto> reports = service.findAllUnfinishedAnalysisReports();
+ List<AnalysisReportDto> reports = queue.all();
JsonWriter json = response.newJsonWriter().beginObject();
writeReports(reports, json);
@@ -68,11 +68,11 @@ public class ActiveAnalysisReportsAction implements RequestHandler {
void define(WebService.NewController controller) {
controller
- .createAction("active")
- .setDescription("List all the active analysis reports")
- .setSince("5.0")
- .setResponseExample(Resources.getResource(getClass(), "example-list.json"))
- .setHandler(this);
+ .createAction("active")
+ .setDescription("List all the active analysis reports")
+ .setSince("5.0")
+ .setResponseExample(Resources.getResource(getClass(), "example-list.json"))
+ .setHandler(this);
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsAnalysisReportQueueEmptyAction.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsAnalysisReportQueueEmptyAction.java
index 8e48c09f355..fe7bbd0a7df 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsAnalysisReportQueueEmptyAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsAnalysisReportQueueEmptyAction.java
@@ -26,15 +26,15 @@ import org.sonar.api.server.ws.RequestHandler;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.core.computation.db.AnalysisReportDto;
-import org.sonar.server.computation.ComputationService;
+import org.sonar.server.computation.AnalysisReportQueue;
import java.util.List;
public class IsAnalysisReportQueueEmptyAction implements RequestHandler {
- private final ComputationService service;
+ private final AnalysisReportQueue queue;
- public IsAnalysisReportQueueEmptyAction(ComputationService service) {
- this.service = service;
+ public IsAnalysisReportQueueEmptyAction(AnalysisReportQueue queue) {
+ this.queue = queue;
}
void define(WebService.NewController controller) {
@@ -47,7 +47,7 @@ public class IsAnalysisReportQueueEmptyAction implements RequestHandler {
@Override
public void handle(Request request, Response response) throws Exception {
- List<AnalysisReportDto> reports = service.findAllUnfinishedAnalysisReports();
+ List<AnalysisReportDto> reports = queue.all();
boolean isQueueEmpty = reports.isEmpty();
IOUtils.write(String.valueOf(isQueueEmpty), response.stream().output());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
index 0cb3aa5d42f..28c93e300be 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
@@ -90,6 +90,9 @@ import org.sonar.server.computation.AnalysisReportTaskCleaner;
import org.sonar.server.computation.AnalysisReportTaskLauncher;
import org.sonar.server.computation.ComputationService;
import org.sonar.server.computation.db.AnalysisReportDao;
+import org.sonar.server.computation.ws.ActiveAnalysisReportsAction;
+import org.sonar.server.computation.ws.AnalysisReportWebService;
+import org.sonar.server.computation.ws.IsAnalysisReportQueueEmptyAction;
import org.sonar.server.config.ws.PropertiesWs;
import org.sonar.server.dashboard.db.DashboardDao;
import org.sonar.server.dashboard.db.WidgetDao;
@@ -270,7 +273,7 @@ class ServerComponents {
ActivityNormalizer.class,
ActivityIndex.class,
ActivityDao.class
- ));
+ ));
components.addAll(CorePropertyDefinitions.all());
components.addAll(DatabaseMigrations.CLASSES);
components.addAll(DaoUtils.getDaoClasses());
@@ -303,7 +306,7 @@ class ServerComponents {
// ws
RestartHandler.class,
SystemWs.class
- );
+ );
}
/**
@@ -320,7 +323,7 @@ class ServerComponents {
HttpDownloader.class,
UriReader.class,
ServerIdGenerator.class
- );
+ );
}
void startLevel4Components(ComponentContainer pico) {
@@ -591,6 +594,9 @@ class ServerComponents {
pico.addSingleton(ComputationService.class);
pico.add(AnalysisReportQueue.class);
pico.addSingleton(AnalysisReportTaskLauncher.class);
+ pico.addSingleton(ActiveAnalysisReportsAction.class);
+ pico.addSingleton(AnalysisReportWebService.class);
+ pico.addSingleton(IsAnalysisReportQueueEmptyAction.class);
for (Object components : level4AddedComponents) {
pico.addSingleton(components);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActiveAnalysisReportsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActiveAnalysisReportsActionTest.java
index 315d5e6ce3e..f77d527a3d3 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActiveAnalysisReportsActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActiveAnalysisReportsActionTest.java
@@ -25,7 +25,7 @@ import org.junit.Before;
import org.junit.Test;
import org.sonar.api.utils.DateUtils;
import org.sonar.core.computation.db.AnalysisReportDto;
-import org.sonar.server.computation.ComputationService;
+import org.sonar.server.computation.AnalysisReportQueue;
import org.sonar.server.ws.WsTester;
import java.util.List;
@@ -37,13 +37,14 @@ import static org.sonar.core.computation.db.AnalysisReportDto.Status.PENDING;
public class ActiveAnalysisReportsActionTest {
- ComputationService service = mock(ComputationService.class);
+ private AnalysisReportQueue queue;
WsTester tester;
@Before
public void setup() throws Exception {
- tester = new WsTester(new AnalysisReportWebService(new ActiveAnalysisReportsAction(service), new IsAnalysisReportQueueEmptyAction(service)));
+ queue = mock(AnalysisReportQueue.class);
+ tester = new WsTester(new AnalysisReportWebService(new ActiveAnalysisReportsAction(queue), new IsAnalysisReportQueueEmptyAction(queue)));
}
@Test
@@ -57,7 +58,7 @@ public class ActiveAnalysisReportsActionTest {
report.setCreatedAt(DateUtils.parseDateTime("2014-10-13T00:00:00+0200"))
.setUpdatedAt(DateUtils.parseDateTime("2014-10-14T00:00:00+0200"));
List<AnalysisReportDto> reports = Lists.newArrayList(report);
- when(service.findAllUnfinishedAnalysisReports()).thenReturn(reports);
+ when(queue.all()).thenReturn(reports);
WsTester.TestRequest request = tester.newGetRequest(AnalysisReportWebService.API_ENDPOINT, "active");
request.execute().assertJson(getClass(), "list_active_reports.json");
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/AnalysisReportWebServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/AnalysisReportWebServiceTest.java
index cdbe24e7229..59f85132510 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/AnalysisReportWebServiceTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/AnalysisReportWebServiceTest.java
@@ -23,7 +23,7 @@ package org.sonar.server.computation.ws;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.server.ws.WebService;
-import org.sonar.server.computation.ComputationService;
+import org.sonar.server.computation.AnalysisReportQueue;
import org.sonar.server.ws.WsTester;
import static org.fest.assertions.Assertions.assertThat;
@@ -35,8 +35,8 @@ public class AnalysisReportWebServiceTest {
@Before
public void setUp() throws Exception {
- this.tester = new WsTester(new AnalysisReportWebService(new ActiveAnalysisReportsAction(mock(ComputationService.class)), new IsAnalysisReportQueueEmptyAction(
- mock(ComputationService.class))));
+ this.tester = new WsTester(new AnalysisReportWebService(new ActiveAnalysisReportsAction(mock(AnalysisReportQueue.class)), new IsAnalysisReportQueueEmptyAction(
+ mock(AnalysisReportQueue.class))));
}
@Test