Codota Logo
Rules$ListResponse$Rule
Code IndexAdd Codota to your IDE (free)

How to use
Rules$ListResponse$Rule
in
org.sonarqube.ws

Best Java code snippets using org.sonarqube.ws.Rules$ListResponse$Rule (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

private static void assertRule(org.sonar.api.batch.rule.Rule r) {
 Rule testRule = getTestRule();
 assertThat(r.name()).isEqualTo(testRule.getName());
 assertThat(r.internalKey()).isEqualTo(testRule.getInternalKey());
 assertThat(r.key().rule()).isEqualTo(testRule.getKey());
 assertThat(r.key().repository()).isEqualTo(testRule.getRepository());
}
origin: SonarSource/sonarqube

@Override
public void handle(Request wsRequest, Response wsResponse) throws Exception {
 final ListResponse.Builder listResponseBuilder = ListResponse.newBuilder();
 final ListResponse.Rule.Builder ruleBuilder = ListResponse.Rule.newBuilder();
 try (DbSession dbSession = dbClient.openSession(false)) {
  dbClient.ruleDao().selectEnabled(dbSession, resultContext -> {
   RuleDefinitionDto dto = resultContext.getResultObject();
   ruleBuilder
    .clear()
    .setRepository(dto.getRepositoryKey())
    .setKey(dto.getRuleKey())
    .setName(nullToEmpty(dto.getName()))
    .setInternalKey(nullToEmpty(dto.getConfigKey()));
   listResponseBuilder.addRules(ruleBuilder.build());
  });
 }
 // JSON response is voluntarily not supported. This WS is for internal use.
 wsResponse.stream().setMediaType(MediaTypes.PROTOBUF);
 listResponseBuilder.build().writeTo(wsResponse.stream().output());
}
origin: SonarSource/sonarqube

public ScannerMediumTester addRule(String key, String repoKey, String internalKey, String name) {
 Rule.Builder builder = Rule.newBuilder();
 builder.setKey(key);
 builder.setRepository(repoKey);
 if (internalKey != null) {
  builder.setInternalKey(internalKey);
 }
 builder.setName(name);
 rulesLoader.addRule(builder.build());
 return this;
}
origin: SonarSource/sonarqube

 private static Rules load(RulesLoader ref) {
  Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
  List<Rule> loadedRules = ref.load();
  RulesBuilder builder = new RulesBuilder();

  for (Rule r : loadedRules) {
   NewRule newRule = builder.add(RuleKey.of(r.getRepository(), r.getKey()));
   newRule.setName(r.getName());
   newRule.setInternalKey(r.getInternalKey());
  }

  profiler.stopInfo();

  return builder.build();
 }
}
origin: SonarSource/sonarqube

 private static Rule getTestRule() {
  Rule.Builder ruleBuilder = Rule.newBuilder();
  ruleBuilder.setKey("key1");
  ruleBuilder.setRepository("repo1");
  ruleBuilder.setName("name");
  ruleBuilder.setInternalKey("key1");
  return ruleBuilder.build();

 }
}
origin: SonarSource/sonarqube

 @Test
 public void return_rules_in_protobuf() {
  dbTester.rules().insert(RuleTesting.newRule(RuleKey.of("java", "S001")).setConfigKey(null).setName(null));
  dbTester.rules().insert(RuleTesting.newRule(RuleKey.of("java", "S002")).setConfigKey("I002").setName("Rule Two"));
  dbTester.getSession().commit();

  Rules.ListResponse listResponse = tester.newRequest()
   .executeProtobuf(Rules.ListResponse.class);

  assertThat(listResponse.getRulesCount()).isEqualTo(2);

  assertThat(listResponse.getRules(0).getKey()).isEqualTo("S001");
  assertThat(listResponse.getRules(0).getInternalKey()).isEqualTo("");
  assertThat(listResponse.getRules(0).getName()).isEqualTo("");
  assertThat(listResponse.getRules(1).getKey()).isEqualTo("S002");
  assertThat(listResponse.getRules(1).getInternalKey()).isEqualTo("I002");
  assertThat(listResponse.getRules(1).getName()).isEqualTo("Rule Two");
 }
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

 private static Rules load(RulesLoader ref) {
  Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
  List<Rule> loadedRules = ref.load();
  RulesBuilder builder = new RulesBuilder();

  for (Rule r : loadedRules) {
   NewRule newRule = builder.add(RuleKey.of(r.getRepository(), r.getKey()));
   newRule.setName(r.getName());
   newRule.setInternalKey(r.getInternalKey());
  }

  profiler.stopInfo();

  return builder.build();
 }
}
origin: org.sonarsource.sonarqube/sonar-batch

 private static Rules load(RulesLoader ref) {
  Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
  MutableBoolean fromCache = new MutableBoolean();
  List<Rule> loadedRules = ref.load(fromCache);
  RulesBuilder builder = new RulesBuilder();

  for (Rule r : loadedRules) {
   NewRule newRule = builder.add(RuleKey.of(r.getRepository(), r.getKey()));
   newRule.setName(r.getName());
   newRule.setInternalKey(r.getInternalKey());
  }

  profiler.stopInfo(fromCache.booleanValue());

  return builder.build();
 }
}
origin: org.sonarsource.sonarqube/sonar-server

@Override
public void handle(Request wsRequest, Response wsResponse) throws Exception {
 final ListResponse.Builder listResponseBuilder = ListResponse.newBuilder();
 final ListResponse.Rule.Builder ruleBuilder = ListResponse.Rule.newBuilder();
 try (DbSession dbSession = dbClient.openSession(false)) {
  dbClient.ruleDao().selectEnabled(dbSession, resultContext -> {
   RuleDefinitionDto dto = resultContext.getResultObject();
   ruleBuilder
    .clear()
    .setRepository(dto.getRepositoryKey())
    .setKey(dto.getRuleKey())
    .setName(nullToEmpty(dto.getName()))
    .setInternalKey(nullToEmpty(dto.getConfigKey()));
   listResponseBuilder.addRules(ruleBuilder.build());
  });
 }
 // JSON response is voluntarily not supported. This WS is for internal use.
 wsResponse.stream().setMediaType(MediaTypes.PROTOBUF);
 listResponseBuilder.build().writeTo(wsResponse.stream().output());
}
org.sonarqube.wsRules$ListResponse$Rule

Most used methods

  • getInternalKey
  • getKey
  • getName
  • getRepository
  • newBuilder

Popular in Java

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Socket (java.net)
    Provides a client-side TCP socket.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now