This reverts commit a515be7cbe
.
tags/5.2-RC1
@@ -72,7 +72,7 @@ public class ServerTest { | |||
orchestrator.getServer().getAdminWsClient().update(new PropertyUpdateQuery("sonar.forceAuthentication", "true")); | |||
// /batch/index should never need authentication | |||
String batchIndex = orchestrator.getServer().wsClient().get("/scanner/index"); | |||
String batchIndex = orchestrator.getServer().wsClient().get("/batch/index"); | |||
assertThat(batchIndex).isNotEmpty(); | |||
String jar = batchIndex.split("\\|")[0]; | |||
@@ -80,13 +80,13 @@ public class ServerTest { | |||
// /batch/file should never need authentication | |||
HttpClient httpclient = new DefaultHttpClient(); | |||
try { | |||
HttpGet get = new HttpGet(orchestrator.getServer().getUrl() + "/scanner/file?name=" + jar); | |||
HttpGet get = new HttpGet(orchestrator.getServer().getUrl() + "/batch/file?name=" + jar); | |||
HttpResponse response = httpclient.execute(get); | |||
assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); | |||
EntityUtils.consume(response.getEntity()); | |||
// As Sonar runner is still using /batch/key, we have to also verify it | |||
get = new HttpGet(orchestrator.getServer().getUrl() + "/scanner/" + jar); | |||
get = new HttpGet(orchestrator.getServer().getUrl() + "/batch/" + jar); | |||
response = httpclient.execute(get); | |||
assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); | |||
EntityUtils.consume(response.getEntity()); |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.io.filefilter.FileFilterUtils; | |||
@@ -38,13 +38,13 @@ import java.util.Collection; | |||
* JAR files to be downloaded by sonar-runner. | |||
*/ | |||
@ServerSide | |||
public class ScannerIndex implements Startable { | |||
public class BatchIndex implements Startable { | |||
private final Server server; | |||
private String index; | |||
private File batchDir; | |||
public ScannerIndex(Server server) { | |||
public BatchIndex(Server server) { | |||
this.server = server; | |||
} | |||
@@ -17,7 +17,7 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.io.IOUtils; | |||
@@ -28,15 +28,15 @@ import org.sonar.api.server.ws.WebService; | |||
import java.io.IOException; | |||
public class ScannerWs implements WebService { | |||
public class BatchWs implements WebService { | |||
public static final String API_ENDPOINT = "scanner"; | |||
public static final String API_ENDPOINT = "batch"; | |||
private final ScannerIndex scannerIndex; | |||
private final ScannerWsAction[] actions; | |||
private final BatchIndex batchIndex; | |||
private final BatchWsAction[] actions; | |||
public ScannerWs(ScannerIndex scannerIndex, ScannerWsAction... actions) { | |||
this.scannerIndex = scannerIndex; | |||
public BatchWs(BatchIndex batchIndex, BatchWsAction... actions) { | |||
this.batchIndex = batchIndex; | |||
this.actions = actions; | |||
} | |||
@@ -48,7 +48,7 @@ public class ScannerWs implements WebService { | |||
defineIndexAction(controller); | |||
defineFileAction(controller); | |||
for (ScannerWsAction action : actions) { | |||
for (BatchWsAction action : actions) { | |||
action.define(controller); | |||
} | |||
@@ -64,7 +64,7 @@ public class ScannerWs implements WebService { | |||
public void handle(Request request, Response response) { | |||
try { | |||
response.stream().setMediaType("text/plain"); | |||
IOUtils.write(scannerIndex.getIndex(), response.stream().output()); | |||
IOUtils.write(batchIndex.getIndex(), response.stream().output()); | |||
} catch (IOException e) { | |||
throw new IllegalStateException(e); | |||
} | |||
@@ -83,7 +83,7 @@ public class ScannerWs implements WebService { | |||
String filename = request.mandatoryParam("name"); | |||
try { | |||
response.stream().setMediaType("application/java-archive"); | |||
FileUtils.copyFile(scannerIndex.getFile(filename), response.stream().output()); | |||
FileUtils.copyFile(batchIndex.getFile(filename), response.stream().output()); | |||
} catch (IOException e) { | |||
throw new IllegalStateException(e); | |||
} |
@@ -17,10 +17,10 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.sonar.server.ws.WsAction; | |||
public interface ScannerWsAction extends WsAction { | |||
public interface BatchWsAction extends WsAction { | |||
// Marker interface | |||
} |
@@ -17,20 +17,20 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.sonar.core.platform.Module; | |||
public class ScannerWsModule extends Module { | |||
public class BatchWsModule extends Module { | |||
@Override | |||
protected void configureModule() { | |||
add( | |||
ScannerIndex.class, | |||
BatchIndex.class, | |||
GlobalAction.class, | |||
ProjectAction.class, | |||
ProjectDataLoader.class, | |||
IssuesAction.class, | |||
UsersAction.class, | |||
ScannerWs.class); | |||
BatchWs.class); | |||
} | |||
} |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.apache.commons.io.IOUtils; | |||
import org.sonar.api.server.ws.Request; | |||
@@ -36,7 +36,7 @@ import org.sonar.server.exceptions.ForbiddenException; | |||
import org.sonar.server.plugins.MimeTypes; | |||
import org.sonar.server.user.UserSession; | |||
public class GlobalAction implements ScannerWsAction { | |||
public class GlobalAction implements BatchWsAction { | |||
private final DbClient dbClient; | |||
private final PropertiesDao propertiesDao; |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
@@ -43,7 +43,7 @@ import org.sonar.server.user.UserSession; | |||
import static com.google.common.collect.Maps.newHashMap; | |||
public class IssuesAction implements ScannerWsAction { | |||
public class IssuesAction implements BatchWsAction { | |||
private static final String PARAM_KEY = "key"; | |||
@@ -17,7 +17,7 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
public class Messages { | |||
private Messages() { |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
@@ -28,11 +28,11 @@ import org.sonar.api.server.ws.Response; | |||
import org.sonar.api.server.ws.WebService; | |||
import org.sonar.batch.protocol.input.FileData; | |||
import org.sonar.batch.protocol.input.ProjectRepositories; | |||
import org.sonarqube.ws.WsScanner.WsProjectResponse; | |||
import org.sonarqube.ws.WsBatch.WsProjectResponse; | |||
import static org.sonar.server.ws.WsUtils.writeProtobuf; | |||
public class ProjectAction implements ScannerWsAction { | |||
public class ProjectAction implements BatchWsAction { | |||
private static final String PARAM_KEY = "key"; | |||
private static final String PARAM_PROFILE = "profile"; |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import com.google.common.collect.ArrayListMultimap; | |||
import com.google.common.collect.Maps; |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
@@ -34,7 +34,7 @@ import org.sonar.server.user.UserSession; | |||
import org.sonar.server.user.index.UserDoc; | |||
import org.sonar.server.user.index.UserIndex; | |||
public class UsersAction implements ScannerWsAction { | |||
public class UsersAction implements BatchWsAction { | |||
private static final String PARAM_LOGINS = "logins"; | |||
@@ -19,6 +19,6 @@ | |||
*/ | |||
@ParametersAreNonnullByDefault | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -49,7 +49,7 @@ import org.sonar.server.activity.index.ActivityIndexer; | |||
import org.sonar.server.activity.ws.ActivitiesWs; | |||
import org.sonar.server.activity.ws.ActivityMapping; | |||
import org.sonar.server.authentication.ws.AuthenticationWs; | |||
import org.sonar.server.scanner.ScannerWsModule; | |||
import org.sonar.server.batch.BatchWsModule; | |||
import org.sonar.server.charts.ChartFactory; | |||
import org.sonar.server.charts.DistributionAreaChart; | |||
import org.sonar.server.charts.DistributionBarChart; | |||
@@ -343,7 +343,7 @@ public class PlatformLevel4 extends PlatformLevel { | |||
ActivityIndex.class, | |||
// batch | |||
ScannerWsModule.class, | |||
BatchWsModule.class, | |||
// Dashboard | |||
DashboardsWs.class, |
@@ -17,7 +17,7 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.lang.CharUtils; | |||
@@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
public class ScannerIndexTest { | |||
public class BatchIndexTest { | |||
@Rule | |||
public TemporaryFolder temp = new TemporaryFolder(); | |||
@@ -60,21 +60,21 @@ public class ScannerIndexTest { | |||
@Test | |||
public void get_index() { | |||
ScannerIndex scannerIndex = new ScannerIndex(server); | |||
scannerIndex.start(); | |||
BatchIndex batchIndex = new BatchIndex(server); | |||
batchIndex.start(); | |||
String index = scannerIndex.getIndex(); | |||
String index = batchIndex.getIndex(); | |||
assertThat(index).isEqualTo("sonar-batch.jar|acbd18db4cc2f85cedef654fccc4a4d8" + CharUtils.LF); | |||
scannerIndex.stop(); | |||
batchIndex.stop(); | |||
} | |||
@Test | |||
public void get_file() { | |||
ScannerIndex scannerIndex = new ScannerIndex(server); | |||
scannerIndex.start(); | |||
BatchIndex batchIndex = new BatchIndex(server); | |||
batchIndex.start(); | |||
File file = scannerIndex.getFile("sonar-batch.jar"); | |||
File file = batchIndex.getFile("sonar-batch.jar"); | |||
assertThat(file).isEqualTo(jar); | |||
} | |||
@@ -87,10 +87,10 @@ public class ScannerIndexTest { | |||
thrown.expect(IllegalArgumentException.class); | |||
thrown.expectMessage("Bad filename: ../sonar-batch.jar"); | |||
ScannerIndex scannerIndex = new ScannerIndex(server); | |||
scannerIndex.start(); | |||
BatchIndex batchIndex = new BatchIndex(server); | |||
batchIndex.start(); | |||
scannerIndex.getFile("../sonar-batch.jar"); | |||
batchIndex.getFile("../sonar-batch.jar"); | |||
} | |||
@Test | |||
@@ -98,9 +98,9 @@ public class ScannerIndexTest { | |||
thrown.expect(IllegalArgumentException.class); | |||
thrown.expectMessage("Bad filename: other.jar"); | |||
ScannerIndex scannerIndex = new ScannerIndex(server); | |||
scannerIndex.start(); | |||
BatchIndex batchIndex = new BatchIndex(server); | |||
batchIndex.start(); | |||
scannerIndex.getFile("other.jar"); | |||
batchIndex.getFile("other.jar"); | |||
} | |||
} |
@@ -17,18 +17,18 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.junit.Test; | |||
import org.sonar.core.platform.ComponentContainer; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
public class ScannerWsModuleTest { | |||
public class BatchWsModuleTest { | |||
@Test | |||
public void verify_count_of_added_components() { | |||
ComponentContainer container = new ComponentContainer(); | |||
new ScannerWsModule().configure(container); | |||
new BatchWsModule().configure(container); | |||
assertThat(container.size()).isEqualTo(9); | |||
} | |||
@@ -17,7 +17,7 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import java.io.File; | |||
import org.apache.commons.io.FileUtils; | |||
@@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
@RunWith(MockitoJUnitRunner.class) | |||
public class ScannerWsTest { | |||
public class BatchWsTest { | |||
@Rule | |||
public UserSessionRule userSessionRule = UserSessionRule.standalone(); | |||
@@ -52,13 +52,13 @@ public class ScannerWsTest { | |||
public ExpectedException thrown = ExpectedException.none(); | |||
@Mock | |||
ScannerIndex scannerIndex; | |||
BatchIndex batchIndex; | |||
WsTester tester; | |||
@Before | |||
public void before() { | |||
tester = new WsTester(new ScannerWs(scannerIndex, | |||
tester = new WsTester(new BatchWs(batchIndex, | |||
new GlobalAction(mock(DbClient.class), mock(PropertiesDao.class), userSessionRule), | |||
new ProjectAction(mock(ProjectDataLoader.class)), | |||
new IssuesAction(mock(DbClient.class), mock(IssueIndex.class), userSessionRule, mock(ComponentFinder.class)))); | |||
@@ -66,9 +66,9 @@ public class ScannerWsTest { | |||
@Test | |||
public void download_index() throws Exception { | |||
when(scannerIndex.getIndex()).thenReturn("sonar-batch.jar|acbd18db4cc2f85cedef654fccc4a4d8"); | |||
when(batchIndex.getIndex()).thenReturn("sonar-batch.jar|acbd18db4cc2f85cedef654fccc4a4d8"); | |||
String index = tester.newGetRequest("scanner", "index").execute().outputAsString(); | |||
String index = tester.newGetRequest("batch", "index").execute().outputAsString(); | |||
assertThat(index).isEqualTo("sonar-batch.jar|acbd18db4cc2f85cedef654fccc4a4d8"); | |||
} | |||
@@ -78,9 +78,9 @@ public class ScannerWsTest { | |||
File file = temp.newFile(filename); | |||
FileUtils.writeStringToFile(file, "foo"); | |||
when(scannerIndex.getFile(filename)).thenReturn(file); | |||
when(batchIndex.getFile(filename)).thenReturn(file); | |||
String jar = tester.newGetRequest("scanner", "file").setParam("name", filename).execute().outputAsString(); | |||
String jar = tester.newGetRequest("batch", "file").setParam("name", filename).execute().outputAsString(); | |||
assertThat(jar).isEqualTo("foo"); | |||
} | |||
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.junit.Before; | |||
import org.junit.Rule; | |||
@@ -66,7 +66,7 @@ public class GlobalActionTest { | |||
when(dbClient.openSession(false)).thenReturn(session); | |||
when(dbClient.metricDao()).thenReturn(metricDao); | |||
tester = new WsTester(new ScannerWs(mock(ScannerIndex.class), new GlobalAction(dbClient, propertiesDao, userSessionRule))); | |||
tester = new WsTester(new BatchWs(mock(BatchIndex.class), new GlobalAction(dbClient, propertiesDao, userSessionRule))); | |||
} | |||
@Test | |||
@@ -78,7 +78,7 @@ public class GlobalActionTest { | |||
.setWorstValue(0d).setBestValue(100d).setOptimizedBestValue(false).setDirection(1).setEnabled(true) | |||
)); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "global"); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "global"); | |||
request.execute().assertJson(getClass(), "return_global_referentials.json"); | |||
} | |||
@@ -92,7 +92,7 @@ public class GlobalActionTest { | |||
new PropertyDto().setKey("foo.license.secured").setValue("5678") | |||
)); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "global"); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "global"); | |||
request.execute().assertJson(getClass(), "return_global_settings.json"); | |||
} | |||
@@ -106,7 +106,7 @@ public class GlobalActionTest { | |||
new PropertyDto().setKey("foo.license.secured").setValue("5678") | |||
)); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "global"); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "global"); | |||
request.execute().assertJson(getClass(), "return_only_license_settings_without_scan_but_with_preview_permission.json"); | |||
} | |||
@@ -122,6 +122,6 @@ public class GlobalActionTest { | |||
thrown.expect(ForbiddenException.class); | |||
tester.newGetRequest("scanner", "global").execute(); | |||
tester.newGetRequest("batch", "global").execute(); | |||
} | |||
} |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import java.io.ByteArrayInputStream; | |||
import java.util.Arrays; | |||
@@ -90,7 +90,7 @@ public class IssuesActionTest { | |||
issueAuthorizationIndexer = new IssueAuthorizationIndexer(null, es.client()); | |||
issuesAction = new IssuesAction(db.getDbClient(), issueIndex, userSessionRule, new ComponentFinder(db.getDbClient())); | |||
tester = new WsTester(new ScannerWs(new ScannerIndex(mock(Server.class)), issuesAction)); | |||
tester = new WsTester(new BatchWs(new BatchIndex(mock(Server.class)), issuesAction)); | |||
} | |||
@Test | |||
@@ -114,7 +114,7 @@ public class IssuesActionTest { | |||
userSessionRule.login("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "issues").setParam("key", PROJECT_KEY); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", PROJECT_KEY); | |||
ServerIssue serverIssue = ServerIssue.parseDelimitedFrom(new ByteArrayInputStream(request.execute().output())); | |||
assertThat(serverIssue.getKey()).isEqualTo("EFGH"); | |||
@@ -153,7 +153,7 @@ public class IssuesActionTest { | |||
userSessionRule.login("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "issues").setParam("key", PROJECT_KEY); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", PROJECT_KEY); | |||
ServerIssue serverIssue = ServerIssue.parseDelimitedFrom(new ByteArrayInputStream(request.execute().output())); | |||
assertThat(serverIssue.getKey()).isEqualTo("EFGH"); | |||
@@ -192,7 +192,7 @@ public class IssuesActionTest { | |||
userSessionRule.login("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "issues").setParam("key", MODULE_KEY); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", MODULE_KEY); | |||
ServerIssue serverIssue = ServerIssue.parseDelimitedFrom(new ByteArrayInputStream(request.execute().output())); | |||
assertThat(serverIssue.getKey()).isEqualTo("EFGH"); | |||
assertThat(serverIssue.getModuleKey()).isEqualTo(MODULE_KEY); | |||
@@ -230,7 +230,7 @@ public class IssuesActionTest { | |||
userSessionRule.login("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "issues").setParam("key", FILE_KEY); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", FILE_KEY); | |||
ServerIssue serverIssue = ServerIssue.parseDelimitedFrom(new ByteArrayInputStream(request.execute().output())); | |||
assertThat(serverIssue.getKey()).isEqualTo("EFGH"); | |||
assertThat(serverIssue.getModuleKey()).isEqualTo(MODULE_KEY); | |||
@@ -267,7 +267,7 @@ public class IssuesActionTest { | |||
userSessionRule.login("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "issues").setParam("key", MODULE_KEY); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", MODULE_KEY); | |||
ServerIssue previousIssue = ServerIssue.parseDelimitedFrom(new ByteArrayInputStream(request.execute().output())); | |||
assertThat(previousIssue.getKey()).isEqualTo("EFGH"); | |||
assertThat(previousIssue.getModuleKey()).isEqualTo(MODULE_KEY); | |||
@@ -306,7 +306,7 @@ public class IssuesActionTest { | |||
userSessionRule.login("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "issues").setParam("key", PROJECT_KEY); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", PROJECT_KEY); | |||
ServerIssue serverIssue = ServerIssue.parseDelimitedFrom(new ByteArrayInputStream(request.execute().output())); | |||
assertThat(serverIssue.getKey()).isEqualTo("EFGH"); | |||
// Module key of removed file should be returned | |||
@@ -317,7 +317,7 @@ public class IssuesActionTest { | |||
public void fail_without_preview_permission() throws Exception { | |||
userSessionRule.login("henry").setGlobalPermissions(GlobalPermissions.PROVISIONING); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "issues").setParam("key", PROJECT_KEY); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", PROJECT_KEY); | |||
request.execute(); | |||
} | |||
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
@@ -38,7 +38,7 @@ public class ProjectActionTest { | |||
@Before | |||
public void setUp() { | |||
tester = new WsTester(new ScannerWs(mock(ScannerIndex.class), new ProjectAction(projectDataLoader))); | |||
tester = new WsTester(new BatchWs(mock(BatchIndex.class), new ProjectAction(projectDataLoader))); | |||
} | |||
@Test | |||
@@ -51,7 +51,7 @@ public class ProjectActionTest { | |||
ArgumentCaptor<ProjectDataQuery> queryArgumentCaptor = ArgumentCaptor.forClass(ProjectDataQuery.class); | |||
when(projectDataLoader.load(queryArgumentCaptor.capture())).thenReturn(projectReferentials); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "project") | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "project") | |||
.setParam("key", projectKey) | |||
.setParam("profile", "Default") | |||
.setParam("preview", "false"); |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import com.google.common.collect.ImmutableMap; | |||
import java.util.Date; |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.server.scanner; | |||
package org.sonar.server.batch; | |||
import org.junit.Before; | |||
import org.junit.ClassRule; | |||
@@ -60,7 +60,7 @@ public class UsersActionTest { | |||
userIndex = new UserIndex(es.client()); | |||
usersAction = new UsersAction(userIndex, userSessionRule); | |||
tester = new WsTester(new ScannerWs(new ScannerIndex(mock(Server.class)), usersAction)); | |||
tester = new WsTester(new BatchWs(new BatchIndex(mock(Server.class)), usersAction)); | |||
} | |||
@Test | |||
@@ -71,7 +71,7 @@ public class UsersActionTest { | |||
userSessionRule.login("sonarqtech").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); | |||
WsTester.TestRequest request = tester.newGetRequest("scanner", "users").setParam("logins", "ada.lovelace,grace.hopper"); | |||
WsTester.TestRequest request = tester.newGetRequest("batch", "users").setParam("logins", "ada.lovelace,grace.hopper"); | |||
ByteArrayInputStream input = new ByteArrayInputStream(request.execute().output()); | |||
@@ -9,8 +9,8 @@ ActionController::Routing::Routes.draw do |map| | |||
map.connect 'api', :controller => 'api/java_ws', :action => 'redirect_to_ws_listing' | |||
# deprecated, sonar-runner should use batch/index and batch/file?name=xxx | |||
map.connect 'batch_bootstrap/index', :controller => 'api/java_ws', :action => 'index', :wspath => 'scanner', :wsaction => 'index' | |||
map.connect 'scanner/:name', :controller => 'api/java_ws', :action => 'index', :wspath => 'scanner', :wsaction => 'file', :requirements => { :name => /.*/ } | |||
map.connect 'batch_bootstrap/index', :controller => 'api/java_ws', :action => 'index', :wspath => 'batch', :wsaction => 'index' | |||
map.connect 'batch/:name', :controller => 'api/java_ws', :action => 'index', :wspath => 'batch', :wsaction => 'file', :requirements => { :name => /.*/ } | |||
map.connect 'api/server/:action', :controller => 'api/server' | |||
map.connect 'api/resoures', :controller => 'api/resources', :action => 'index' |
@@ -19,26 +19,23 @@ | |||
*/ | |||
package org.sonar.batch.repository; | |||
import org.apache.commons.io.IOUtils; | |||
import org.sonar.batch.util.BatchUtils; | |||
import org.sonarqube.ws.WsScanner.WsProjectResponse.FileDataByPath; | |||
import org.sonarqube.ws.WsScanner.WsProjectResponse.Settings; | |||
import org.sonarqube.ws.WsScanner.WsProjectResponse; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import com.google.common.collect.Table; | |||
import com.google.common.collect.HashBasedTable; | |||
import org.sonar.batch.cache.WSLoaderResult; | |||
import org.sonar.batch.cache.WSLoader; | |||
import org.apache.commons.lang.mutable.MutableBoolean; | |||
import javax.annotation.Nullable; | |||
import com.google.common.collect.Table; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.util.Date; | |||
import java.util.Map; | |||
import javax.annotation.Nullable; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang.mutable.MutableBoolean; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.sonar.batch.cache.WSLoader; | |||
import org.sonar.batch.cache.WSLoaderResult; | |||
import org.sonar.batch.util.BatchUtils; | |||
import org.sonarqube.ws.WsBatch.WsProjectResponse; | |||
import org.sonarqube.ws.WsBatch.WsProjectResponse.FileDataByPath; | |||
import org.sonarqube.ws.WsBatch.WsProjectResponse.Settings; | |||
public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoader { | |||
private static final Logger LOG = LoggerFactory.getLogger(DefaultProjectRepositoriesLoader.class); | |||
@@ -90,7 +87,7 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad | |||
Map<String, FileDataByPath> fileDataByModuleAndPath = response.getFileDataByModuleAndPath(); | |||
for (Map.Entry<String, FileDataByPath> e1 : fileDataByModuleAndPath.entrySet()) { | |||
for (Map.Entry<String, org.sonarqube.ws.WsScanner.WsProjectResponse.FileData> e2 : e1.getValue().getFileDataByPath().entrySet()) { | |||
for (Map.Entry<String, org.sonarqube.ws.WsBatch.WsProjectResponse.FileData> e2 : e1.getValue().getFileDataByPath().entrySet()) { | |||
FileData fd = new FileData(e2.getValue().getHash(), e2.getValue().getRevision()); | |||
fileDataTable.put(e1.getKey(), e2.getKey(), fd); | |||
} |
@@ -19,21 +19,20 @@ | |||
*/ | |||
package org.sonar.batch.repository; | |||
import org.sonarqube.ws.WsScanner.WsProjectResponse; | |||
import org.sonar.batch.cache.WSLoaderResult; | |||
import org.sonar.batch.cache.WSLoader; | |||
import org.apache.commons.lang.mutable.MutableBoolean; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import org.apache.commons.lang.mutable.MutableBoolean; | |||
import org.junit.Before; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonar.batch.cache.WSLoader; | |||
import org.sonar.batch.cache.WSLoaderResult; | |||
import org.sonarqube.ws.WsBatch.WsProjectResponse; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.mockito.Matchers.anyString; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.verify; |
@@ -3824,23 +3824,20 @@ public final class WsCe { | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
boolean hasExecutedAt(); | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
java.lang.String getExecutedAt(); | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
com.google.protobuf.ByteString | |||
getExecutedAtBytes(); | |||
getExecutedAtBytes(); | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
boolean hasIsLastExecuted(); | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
@@ -4378,14 +4375,12 @@ public final class WsCe { | |||
public static final int EXECUTEDAT_FIELD_NUMBER = 10; | |||
private volatile java.lang.Object executedAt_; | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
public boolean hasExecutedAt() { | |||
return ((bitField0_ & 0x00000200) == 0x00000200); | |||
} | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
@@ -4403,12 +4398,11 @@ public final class WsCe { | |||
return s; | |||
} | |||
} | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
public com.google.protobuf.ByteString | |||
getExecutedAtBytes() { | |||
getExecutedAtBytes() { | |||
java.lang.Object ref = executedAt_; | |||
if (ref instanceof java.lang.String) { | |||
com.google.protobuf.ByteString b = | |||
@@ -4423,14 +4417,12 @@ public final class WsCe { | |||
public static final int ISLASTEXECUTED_FIELD_NUMBER = 11; | |||
private boolean isLastExecuted_; | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
public boolean hasIsLastExecuted() { | |||
return ((bitField0_ & 0x00000400) == 0x00000400); | |||
} | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
@@ -5540,14 +5532,12 @@ public final class WsCe { | |||
} | |||
private java.lang.Object executedAt_ = ""; | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
public boolean hasExecutedAt() { | |||
return ((bitField0_ & 0x00000200) == 0x00000200); | |||
} | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
@@ -5565,12 +5555,11 @@ public final class WsCe { | |||
return (java.lang.String) ref; | |||
} | |||
} | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
public com.google.protobuf.ByteString | |||
getExecutedAtBytes() { | |||
getExecutedAtBytes() { | |||
java.lang.Object ref = executedAt_; | |||
if (ref instanceof String) { | |||
com.google.protobuf.ByteString b = | |||
@@ -5582,7 +5571,6 @@ public final class WsCe { | |||
return (com.google.protobuf.ByteString) ref; | |||
} | |||
} | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
@@ -5596,7 +5584,6 @@ public final class WsCe { | |||
onChanged(); | |||
return this; | |||
} | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
@@ -5606,7 +5593,6 @@ public final class WsCe { | |||
onChanged(); | |||
return this; | |||
} | |||
/** | |||
* <code>optional string executedAt = 10;</code> | |||
*/ | |||
@@ -5621,22 +5607,19 @@ public final class WsCe { | |||
return this; | |||
} | |||
private boolean isLastExecuted_; | |||
private boolean isLastExecuted_ ; | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
public boolean hasIsLastExecuted() { | |||
return ((bitField0_ & 0x00000400) == 0x00000400); | |||
} | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
public boolean getIsLastExecuted() { | |||
return isLastExecuted_; | |||
} | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
@@ -5646,7 +5629,6 @@ public final class WsCe { | |||
onChanged(); | |||
return this; | |||
} | |||
/** | |||
* <code>optional bool isLastExecuted = 11;</code> | |||
*/ | |||
@@ -5689,7 +5671,7 @@ public final class WsCe { | |||
return this; | |||
} | |||
private boolean logs_; | |||
private boolean logs_ ; | |||
/** | |||
* <code>optional bool logs = 13;</code> | |||
*/ | |||
@@ -5818,11 +5800,11 @@ public final class WsCe { | |||
"ey\030\004 \001(\t\022\025\n\rcomponentName\030\005 \001(\t\022+\n\006statu" + | |||
"s\030\006 \001(\0162\033.sonarqube.ws.ce.TaskStatus\022\023\n\013" + | |||
"submittedAt\030\007 \001(\t\022\026\n\016submitterLogin\030\010 \001(" + | |||
"\t\022\021\n\tstartedAt\030\t \001(\t\022\022\n\nexecutedAt\030\n \001(\t" + | |||
"\022\026\n\016isLastExecuted\030\013 \001(\010\022\027\n\017executionTim" + | |||
"eMs\030\014 \001(\003\022\014\n\004logs\030\r \001(\010*Q\n\nTaskStatus\022\013\n" + | |||
"\007PENDING\020\000\022\017\n\013IN_PROGRESS\020\001\022\013\n\007SUCCESS\020\002" + | |||
"\022\n\n\006FAILED\020\003\022\014\n\010CANCELED\020\004B\032\n\020org.sonarq", | |||
"\t\022\021\n\tstartedAt\030\t \001(\t\022\022\n\nexecutedAt\030\n \001(\t" + | |||
"\022\026\n\016isLastExecuted\030\013 \001(\010\022\027\n\017executionTim" + | |||
"eMs\030\014 \001(\003\022\014\n\004logs\030\r \001(\010*Q\n\nTaskStatus\022\013\n" + | |||
"\007PENDING\020\000\022\017\n\013IN_PROGRESS\020\001\022\013\n\007SUCCESS\020\002" + | |||
"\022\n\n\006FAILED\020\003\022\014\n\010CANCELED\020\004B\032\n\020org.sonarq", | |||
"ube.wsB\004WsCeH\001" | |||
}; | |||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = | |||
@@ -5873,8 +5855,7 @@ public final class WsCe { | |||
internal_static_sonarqube_ws_ce_Task_fieldAccessorTable = new | |||
com.google.protobuf.GeneratedMessage.FieldAccessorTable( | |||
internal_static_sonarqube_ws_ce_Task_descriptor, | |||
new java.lang.String[] {"Id", "Type", "ComponentId", "ComponentKey", "ComponentName", "Status", "SubmittedAt", "SubmitterLogin", "StartedAt", "ExecutedAt", "IsLastExecuted", | |||
"ExecutionTimeMs", "Logs",}); | |||
new java.lang.String[] { "Id", "Type", "ComponentId", "ComponentKey", "ComponentName", "Status", "SubmittedAt", "SubmitterLogin", "StartedAt", "ExecutedAt", "IsLastExecuted", "ExecutionTimeMs", "Logs", }); | |||
org.sonarqube.ws.Common.getDescriptor(); | |||
} | |||
@@ -21,11 +21,11 @@ syntax = "proto2"; | |||
package sonarqube.ws.batch; | |||
option java_package = "org.sonarqube.ws"; | |||
option java_outer_classname = "WsScanner"; | |||
option java_outer_classname = "WsBatch"; | |||
option optimize_for = SPEED; | |||
// WS api/scanner/project | |||
// WS api/batch/project | |||
message WsProjectResponse { | |||
optional int64 timestamp = 1; | |||
map<string, Settings> settingsByModule = 2; |