Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.Profile


    " pages: " + issues.paging().pages() + " max results reached: " + issues.maxResultsReached());
  }

  private static void testGetProfile() {
    SonarServer sonarServer = SonarServer.create("https://sonar.corp.mobile.de/sonar");
    final Profile profile = sonarServer.getProfile("java", "mobile_relaxed");
    System.out.println("rules count: " + profile.getRules().size());
  }
View Full Code Here


public class ProfileUnmarshallerTest extends UnmarshallerTestCase {

  @Test
  public void shouldNotHaveProfile() {
    Profile profile = new ProfileUnmarshaller().toModel("[]");
    assertThat(profile, nullValue());
  }
View Full Code Here

    assertThat(profile, nullValue());
  }

  @Test
  public void shouldGetProfile() {
    Profile profile = new ProfileUnmarshaller().toModel(loadFile("/profiles/profile.json"));
    assertThat(profile.getLanguage(), is("java"));
    assertThat(profile.getName(), is("Sonar way"));
    assertThat(profile.getParentName(), nullValue());
    assertThat(profile.isDefaultProfile(), is(true));

    assertThat(profile.getRules().size(), is(116));
    Profile.Rule rule1 = profile.getRules().get(0);
    assertThat(rule1.getKey(), is("com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck"));
    assertThat(rule1.getRepository(), is("checkstyle"));
    assertThat(rule1.getInheritance(), nullValue());
    assertThat(rule1.getSeverity(), is("MAJOR"));
    assertThat(rule1.getParameters().size(), is(0));
    assertThat(rule1.getParameter("foo"), nullValue());

    Profile.Rule rule2 = profile.getRule("checkstyle", "com.puppycrawl.tools.checkstyle.checks.naming.LocalFinalVariableNameCheck");
    assertThat(rule2.getParameters().size(), is(1));
    assertThat(rule2.getParameter("format"), is("^[a-z][a-zA-Z0-9]*$"));
  }
View Full Code Here

public class ProfileUnmarshaller extends AbstractUnmarshaller<Profile> {

  @Override
  protected Profile parse(Object json) {
    WSUtils utils = WSUtils.getINSTANCE();
    Profile profile = new Profile();
    Boolean defaultProfile = utils.getBoolean(json, "default");
    profile
        .setLanguage(utils.getString(json, "language"))
        .setName(utils.getString(json, "name"))
        .setDefaultProfile(defaultProfile != null ? defaultProfile : false)
        .setParentName(utils.getString(json, "parent"));
View Full Code Here

TOP

Related Classes of org.sonar.wsclient.services.Profile

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.