Package org.sonar.batch.bootstrap

Examples of org.sonar.batch.bootstrap.ServerClient.request()


  @Test
  public void should_download_source_from_ws_if_preview_mode() {
    db.prepareDbUnit(getClass(), "last_snapshot.xml");
    ServerClient server = mock(ServerClient.class);
    when(server.request(anyString(), eq("GET"), eq(false), eq(30 * 1000))).thenReturn("downloaded source of Bar.c");

    when(mode.isPreview()).thenReturn(true);
    LastSnapshots lastSnapshots = new LastSnapshots(mode, new SnapshotSourceDao(db.myBatis()), server);

    String source = lastSnapshots.getSource(newFile());
View Full Code Here


  @Test
  public void should_download_source_with_space_from_ws_if_preview_mode() {
    db.prepareDbUnit(getClass(), "last_snapshot.xml");
    ServerClient server = mock(ServerClient.class);
    when(server.request(anyString(), eq("GET"), eq(false), eq(30 * 1000))).thenReturn("downloaded source of Foo Bar.c");

    when(mode.isPreview()).thenReturn(true);
    LastSnapshots lastSnapshots = new LastSnapshots(mode, new SnapshotSourceDao(db.myBatis()), server);

    String source = lastSnapshots.getSource(newFile());
View Full Code Here

  @Test
  public void should_fail_to_download_source_from_ws() throws URISyntaxException {
    db.prepareDbUnit(getClass(), "last_snapshot.xml");
    ServerClient server = mock(ServerClient.class);
    when(server.request(anyString(), eq("GET"), eq(false), eq(30 * 1000))).thenThrow(new HttpDownloader.HttpException(new URI(""), 500));

    when(mode.isPreview()).thenReturn(true);
    LastSnapshots lastSnapshots = new LastSnapshots(mode, new SnapshotSourceDao(db.myBatis()), server);

    thrown.expect(HttpDownloader.HttpException.class);
View Full Code Here

  @Test
  public void should_return_empty_source_if_preview_mode_and_no_last_snapshot() throws URISyntaxException {
    db.prepareDbUnit(getClass(), "last_snapshot.xml");
    ServerClient server = mock(ServerClient.class);
    when(server.request(anyString(), eq("GET"), eq(false), eq(30 * 1000))).thenThrow(new HttpDownloader.HttpException(new URI(""), 404));

    when(mode.isPreview()).thenReturn(true);
    LastSnapshots lastSnapshots = new LastSnapshots(mode, new SnapshotSourceDao(db.myBatis()), server);

    String source = lastSnapshots.getSource(newFileWithSpace());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.