Package org.sonar.server.ws

Examples of org.sonar.server.ws.WsTester$Result


      setFaultCode(fCode);
    }
   
    setFaultString(getMessage());
   
    Result r = this.objectFactory.createResult();
    ErrInfo ei = this.objectFactory.createErrInfo();

    if (errCode != null) {
      ei.setErrCode(errCode);
    }

    ei.setValue(getMessage());

     r.setErrno(errno);

    if (ei != null) {
      r.setErrInfo(ei);
    }

    addResult(r);
  }
View Full Code Here


  {
    if (this.dispReport==null) {
      this.dispReport = this.objectFactory.createDispositionReport();
    }

    Result jaxbResult = this.objectFactory.createResult();
    this.dispReport.getResult().add(jaxbResult);
   
    if (result.getErrInfo() != null) jaxbResult.setErrInfo(result.getErrInfo());
    if (result.getKeyType() != null) jaxbResult.setKeyType(result.getKeyType());
    jaxbResult.setErrno(result.getErrno());
  }
View Full Code Here

            keyResultArr = new Result[resultList.size()];
            resultList.toArray(keyResultArr);
           
            log.debug("After deleting Business. Obtained vector size:" + keyResultArr != null ? keyResultArr.length : 0);
            for (int i = 0; keyResultArr != null && i < keyResultArr.length; i++) {
                Result result = (Result) keyResultArr[i];
                int errno = result.getErrno();
                if (errno == 0) {
                    coll.addAll(keys);
                }
                else {
                    ErrInfo errinfo = result.getErrInfo();
                    DeleteException de = new DeleteException(errinfo.getErrCode() + ":" + errinfo.getValue());
                    bulk.setStatus(JAXRResponse.STATUS_FAILURE);
                    exceptions.add(de);
                }
            }
View Full Code Here

  @Mock
  RuleService ruleService;

  @Before
  public void setUp() throws Exception {
    tester = new WsTester(new RulesWebService(mock(SearchAction.class), mock(ShowAction.class), mock(TagsAction.class), mock(CreateAction.class), mock(AppAction.class),
      mock(UpdateAction.class), new DeleteAction(ruleService)));
  }
View Full Code Here

      mock(ActionPlanService.class), mock(UserFinder.class),
      debtModelService, mock(RuleService.class), i18n, durations);
    SearchAction searchAction = new SearchAction(mock(DbClient.class), mock(IssueChangeDao.class), mock(IssueService.class), mock(IssueActionsWriter.class),
      mock(IssueQueryService.class), mock(RuleService.class),
      mock(ActionPlanService.class), mock(UserFinder.class), mock(I18n.class), mock(Durations.class), mock(Languages.class));
    tester = new WsTester(new IssuesWs(showAction, searchAction));
  }
View Full Code Here

  QProfileLoader profileLoader;

  @Test
  public void should_generate_app_init_info() throws Exception {
    AppAction app = new AppAction(languages, ruleRepositories, i18n, debtModel, profileLoader);
    WsTester tester = new WsTester(new RulesWebService(
      mock(SearchAction.class), mock(ShowAction.class), mock(TagsAction.class), mock(CreateAction.class),
      app, mock(UpdateAction.class), mock(DeleteAction.class)));

    MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);

    QualityProfileDto profile1 = QProfileTesting.newXooP1();
    QualityProfileDto profile2 = QProfileTesting.newXooP2().setParentKee(QProfileTesting.XOO_P1_KEY);
    when(profileLoader.findAll()).thenReturn(ImmutableList.of(profile1, profile2));

    Language xoo = mock(Language.class);
    when(xoo.getKey()).thenReturn("xoo");
    when(xoo.getName()).thenReturn("Xoo");
    Language whitespace = mock(Language.class);
    when(whitespace.getKey()).thenReturn("ws");
    when(whitespace.getName()).thenReturn("Whitespace");
    when(languages.get("xoo")).thenReturn(xoo);
    when(languages.all()).thenReturn(new Language[]{xoo, whitespace});

    RuleRepositories.Repository repo1 = mock(RuleRepositories.Repository.class);
    when(repo1.key()).thenReturn("xoo");
    when(repo1.name()).thenReturn("SonarQube");
    when(repo1.language()).thenReturn("xoo");
    RuleRepositories.Repository repo2 = mock(RuleRepositories.Repository.class);
    when(repo2.key()).thenReturn("squid");
    when(repo2.name()).thenReturn("SonarQube");
    when(repo2.language()).thenReturn("ws");
    when(ruleRepositories.repositories()).thenReturn(ImmutableList.of(repo1, repo2));

    when(i18n.message(isA(Locale.class), anyString(), anyString())).thenAnswer(new Answer<String>() {
      @Override
      public String answer(InvocationOnMock invocation) throws Throwable {
        return (String) invocation.getArguments()[1];
      }
    });

    int parentId = 42;
    DefaultDebtCharacteristic char1 = new DefaultDebtCharacteristic();
    char1.setId(parentId).setKey("REUSABILITY").setName("Reusability");
    DefaultDebtCharacteristic char2 = new DefaultDebtCharacteristic();
    char2.setId(24).setParentId(parentId).setKey("MODULARITY").setName("Modularity");
    when(debtModel.allCharacteristics()).thenReturn(ImmutableList.<DebtCharacteristic>of(char1, char2));

    tester.newGetRequest("api/rules", "app").execute().assertJson(this.getClass(), "app.json");
  }
View Full Code Here

  WebService.Controller controller;

  @Before
  public void setUp() throws Exception {
    WsTester tester = new WsTester(new ComponentsWs(new ComponentAppAction(mock(DbClient.class), mock(IssueService.class), mock(Views.class),
      mock(RuleService.class), mock(Periods.class), mock(Durations.class), mock(I18n.class))));
    controller = tester.controller("api/components");
  }
View Full Code Here

    when(issueService.findSeveritiesByComponent(anyString(), any(Date.class), eq(session))).thenReturn(mock(Multiset.class));
    when(issueService.findRulesByComponent(anyString(), any(Date.class), eq(session))).thenReturn(mock(RulesAggregation.class));
    when(measureDao.findByComponentKeyAndMetricKeys(anyString(), anyListOf(String.class), eq(session))).thenReturn(measures);

    tester = new WsTester(new ComponentsWs(new ComponentAppAction(dbClient, issueService, views, ruleService, periods, durations, i18n)));
  }
View Full Code Here

  WsTester tester;

  @Before
  public void setUp() throws Exception {
    when(dbClient.openSession(false)).thenReturn(session);
    tester = new WsTester(new DuplicationsWs(new ShowAction(dbClient, componentDao, measureDao, parser, duplicationsJsonWriter)));
  }
View Full Code Here

  WsTester tester;

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

TOP

Related Classes of org.sonar.server.ws.WsTester$Result

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.