Package org.sonar.server.ws

Examples of org.sonar.server.ws.WsTester$TestResponse$TestStream


  WsTester tester;

  @Before
  public void setUp() throws Exception {
    tester = new WsTester(new SourcesWs(new ShowAction(sourceService), mock(RawAction.class), new ScmAction(sourceService, mock(ScmWriter.class))));
  }
View Full Code Here


  WsTester tester;

  @Before
  public void setUp() throws Exception {
    tester = new WsTester(new PermissionsWs());
  }
View Full Code Here

  WsTester tester;

  @Before
  public void setUp() throws Exception {
    tester = new WsTester(new UpdateCenterWs());
  }
View Full Code Here

    when(system.isOsWindows()).thenReturn(false);

    RestartHandler restartHandler = new RestartHandler(settings, platform, system);
    SystemWs ws = new SystemWs(restartHandler);

    WsTester tester = new WsTester(ws);
    tester.newPostRequest("api/system", "restart").execute();

    verify(platform).restart();
  }
View Full Code Here

    Platform platform = mock(Platform.class);
    Settings settings = new Settings();
    RestartHandler restartHandler = new RestartHandler(settings, platform, system);
    SystemWs ws = new SystemWs(restartHandler);

    WsTester tester = new WsTester(ws);
    try {
      tester.newPostRequest("api/system", "restart").execute();
      fail();
    } catch (ForbiddenException e) {
      verifyZeroInteractions(platform);
    }
  }
View Full Code Here

    when(system.isJavaAtLeast17()).thenReturn(false);

    RestartHandler restartHandler = new RestartHandler(settings, platform, system);
    SystemWs ws = new SystemWs(restartHandler);

    WsTester tester = new WsTester(ws);
    try {
      tester.newPostRequest("api/system", "restart").execute();
      fail();
    } catch (ForbiddenException e) {
      verifyZeroInteractions(platform);
    }
  }
View Full Code Here

    Date now = new Date();
    Date aBitLater = new Date(now.getTime() + 1000);
    when(server.getStartedAt()).thenReturn(now);

    Result result = new WsTester(new L10nWs(i18n, server)).newGetRequest("api/l10n", "index").setParam("ts", DateUtils.formatDateTime(aBitLater)).execute();
    verifyZeroInteractions(i18n);
    verify(server).getStartedAt();

    result.assertNotModified();
  }
View Full Code Here

    when(i18n.getPropertyKeys()).thenReturn(ImmutableSet.of(key1, key2, key3));
    when(i18n.message(locale, key1, key1)).thenReturn(key1);
    when(i18n.message(locale, key2, key2)).thenReturn(key2);
    when(i18n.message(locale, key3, key3)).thenReturn(key3);

    Result result = new WsTester(new L10nWs(i18n, server)).newGetRequest("api/l10n", "index").setParam("ts", DateUtils.formatDateTime(aBitEarlier)).execute();
    verify(i18n).getPropertyKeys();
    verify(i18n).message(locale, key1, key1);
    verify(i18n).message(locale, key2, key2);
    verify(i18n).message(locale, key3, key3);
View Full Code Here

    when(i18n.getPropertyKeys()).thenReturn(ImmutableSet.of(key1, key2, key3));
    when(i18n.message(override, key1, key1)).thenReturn(key1);
    when(i18n.message(override, key2, key2)).thenReturn(key2);
    when(i18n.message(override, key3, key3)).thenReturn(key3);

    Result result = new WsTester(new L10nWs(i18n, server)).newGetRequest("api/l10n", "index").setParam("locale", override.toString()).execute();
    verify(i18n).getPropertyKeys();
    verify(i18n).message(override, key1, key1);
    verify(i18n).message(override, key2, key2);
    verify(i18n).message(override, key3, key3);
View Full Code Here

  WebService.Controller controller;

  @Before
  public void setUp() throws Exception {
    WsTester tester = new WsTester(new UsersWs());
    controller = tester.controller("api/users");
  }
View Full Code Here

TOP

Related Classes of org.sonar.server.ws.WsTester$TestResponse$TestStream

Copyright © 2018 www.massapicom. 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.