Tabnine Logo
ProtobufSystemInfo$Attribute
Code IndexAdd Tabnine to your IDE (free)

How to use
ProtobufSystemInfo$Attribute
in
org.sonar.process.systeminfo.protobuf

Best Java code snippets using org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo$Attribute (Showing top 14 results out of 315)

origin: SonarSource/sonarqube

 public static void assertThatAttributeIs(ProtobufSystemInfo.Section section, String key, long expectedValue) {
  ProtobufSystemInfo.Attribute value = attribute(section, key);
  assertThat(value).as(key).isNotNull();
  assertThat(value.getLongValue()).isEqualTo(expectedValue);
 }
}
origin: SonarSource/sonarqube

public static void assertThatAttributeIs(ProtobufSystemInfo.Section section, String key, boolean expectedValue) {
 ProtobufSystemInfo.Attribute value = attribute(section, key);
 assertThat(value).as(key).isNotNull();
 assertThat(value.getBooleanValue()).isEqualTo(expectedValue);
}
origin: SonarSource/sonarqube

@CheckForNull
public static ProtobufSystemInfo.Attribute attribute(Section section, String key) {
 for (ProtobufSystemInfo.Attribute attribute : section.getAttributesList()) {
  if (attribute.getKey().equals(key)) {
   return attribute;
  }
 }
 return null;
}
origin: org.sonarsource.sonarqube/sonar-server

private void writeAttribute(ProtobufSystemInfo.Attribute attribute, JsonWriter json) {
 switch (attribute.getValueCase()) {
  case BOOLEAN_VALUE:
   json.prop(attribute.getKey(), attribute.getBooleanValue());
   break;
  case LONG_VALUE:
   json.prop(attribute.getKey(), attribute.getLongValue());
   break;
  case DOUBLE_VALUE:
   json.prop(attribute.getKey(), attribute.getDoubleValue());
   break;
  case STRING_VALUE:
   json.prop(attribute.getKey(), attribute.getStringValue());
   break;
  case VALUE_NOT_SET:
   json.name(attribute.getKey()).beginArray().values(attribute.getStringValuesList()).endArray();
   break;
  default:
   throw new IllegalArgumentException("Unsupported type: " + attribute.getValueCase());
 }
}
origin: SonarSource/sonarqube

private void writeAttribute(ProtobufSystemInfo.Attribute attribute, JsonWriter json) {
 switch (attribute.getValueCase()) {
  case BOOLEAN_VALUE:
   json.prop(attribute.getKey(), attribute.getBooleanValue());
   break;
  case LONG_VALUE:
   json.prop(attribute.getKey(), attribute.getLongValue());
   break;
  case DOUBLE_VALUE:
   json.prop(attribute.getKey(), attribute.getDoubleValue());
   break;
  case STRING_VALUE:
   json.prop(attribute.getKey(), attribute.getStringValue());
   break;
  case VALUE_NOT_SET:
   json.name(attribute.getKey()).beginArray().values(attribute.getStringValuesList()).endArray();
   break;
  default:
   throw new IllegalArgumentException("Unsupported type: " + attribute.getValueCase());
 }
}
origin: SonarSource/sonarqube

@Test
public void pool_info() {
 ProtobufSystemInfo.Section section = underTest.toProtobuf();
 assertThat(attribute(section, "Pool Max Connections").getLongValue()).isGreaterThan(0L);
 assertThat(attribute(section, "Pool Idle Connections").getLongValue()).isGreaterThanOrEqualTo(0L);
 assertThat(attribute(section, "Pool Min Idle Connections").getLongValue()).isGreaterThanOrEqualTo(0L);
 assertThat(attribute(section, "Pool Max Idle Connections").getLongValue()).isGreaterThanOrEqualTo(0L);
 assertThat(attribute(section, "Pool Max Wait (ms)")).isNotNull();
 assertThat(attribute(section, "Pool Remove Abandoned")).isNotNull();
 assertThat(attribute(section, "Pool Remove Abandoned Timeout (seconds)").getLongValue()).isGreaterThanOrEqualTo(0L);
}
origin: SonarSource/sonarqube

 @Test
 public void db_info() {
  ProtobufSystemInfo.Section section = underTest.toProtobuf();
  SystemInfoTesting.assertThatAttributeIs(section, "Database", "H2");
  assertThat(attribute(section, "Database Version").getStringValue()).startsWith("1.");
  SystemInfoTesting.assertThatAttributeIs(section, "Username", "SONAR");
  assertThat(attribute(section, "Driver Version").getStringValue()).startsWith("1.");
 }
}
origin: SonarSource/sonarqube

@Test
public void return_nb_of_processors() {
 ProtobufSystemInfo.Section section = underTest.toProtobuf();
 assertThat(attribute(section, "Processors").getLongValue()).isGreaterThan(0);
}
origin: SonarSource/sonarqube

 @Test
 public void test_attributes() {
  ProtobufSystemInfo.Section section = underTest.toProtobuf();
  assertThat(attribute(section, "Nodes").getLongValue()).isGreaterThan(0);
  assertThat(attribute(section, "State").getStringValue()).isIn("RED", "YELLOW", "GREEN");
 }
}
origin: SonarSource/sonarqube

@Test
public void index_attributes() {
 ProtobufSystemInfo.Section section = underTest.toProtobuf();
 // one index "issues"
 assertThat(attribute(section, "Index issues - Docs").getLongValue()).isEqualTo(0L);
 assertThat(attribute(section, "Index issues - Shards").getLongValue()).isGreaterThan(0);
 assertThat(attribute(section, "Index issues - Store Size").getStringValue()).isNotNull();
}
origin: SonarSource/sonarqube

@Test
public void export_system_info() {
 ProtobufSystemInfo.Section section = underTest.toProtobuf();
 assertThat(section.getName()).isEqualTo("Compute Engine Database Connection");
 assertThat(section.getAttributesCount()).isEqualTo(9);
 assertThat(section.getAttributes(0).getKey()).isEqualTo("Pool Initial Size");
 assertThat(section.getAttributes(0).getLongValue()).isGreaterThanOrEqualTo(0);
}
origin: SonarSource/sonarqube

 @Test
 public void return_nb_of_processors() {
  ProtobufSystemInfo.Section protobuf = underTest.toProtobuf();
  assertThat(attribute(protobuf, "Processors").getLongValue()).isGreaterThan(0);
 }
}
origin: SonarSource/sonarqube

public static void assertThatAttributeIs(ProtobufSystemInfo.Section section, String key, String expectedValue) {
 ProtobufSystemInfo.Attribute value = attribute(section, key);
 assertThat(value).as(key).isNotNull();
 assertThat(value.getStringValue()).isEqualTo(expectedValue);
}
origin: SonarSource/sonarqube

@Test
public void test_setAttribute_with_boolean_parameter() {
 Section.Builder builder = Section.newBuilder();
 SystemInfoUtils.setAttribute(builder, "isNull", (Boolean)null);
 SystemInfoUtils.setAttribute(builder, "isTrue", true);
 SystemInfoUtils.setAttribute(builder, "isFalse", false);
 Section section = builder.build();
 assertThat(SystemInfoUtils.attribute(section, "isNull")).isNull();
 assertThat(SystemInfoUtils.attribute(section, "isTrue").getBooleanValue()).isTrue();
 assertThat(SystemInfoUtils.attribute(section, "isFalse").getBooleanValue()).isFalse();
}
org.sonar.process.systeminfo.protobufProtobufSystemInfo$Attribute

Most used methods

  • getLongValue
  • getBooleanValue
  • getKey
  • getStringValue
  • getDoubleValue
  • getStringValuesList
  • getValueCase
  • newBuilder

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • setScale (BigDecimal)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now