]> source.dussan.org Git - sonarqube.git/commitdiff
persist measures on server side - SONAR-6253 150/head
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 13 Mar 2015 15:15:47 +0000 (16:15 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 20 Mar 2015 07:30:32 +0000 (08:30 +0100)
47 files changed:
server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentAppAction.java
server/sonar-server/src/main/java/org/sonar/server/computation/ComputationContainer.java
server/sonar-server/src/main/java/org/sonar/server/computation/measure/BatchReportMeasureUtils.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/computation/measure/MetricCache.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputationSteps.java
server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/duplication/ws/ShowAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MeasureDao.java
server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java
server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java
server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/measure/BatchReportMeasureUtilsTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/computation/measure/MetricCacheTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java
server/sonar-server/src/test/java/org/sonar/server/source/SourceServiceTest.java
server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java
server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java
server/sonar-server/src/test/resources/org/sonar/server/computation/measure/MetricCacheTest/metrics.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/computation/step/PersistMeasuresStepTest/shared.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/empty.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/insert-result.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/shared.xml
sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java
sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/input/BatchInput.java
sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java
sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceDb.java
sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java
sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java
sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java
sonar-batch-protocol/src/main/protobuf/batch_report.proto
sonar-batch-protocol/src/main/protobuf/constants.proto
sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java
sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java
sonar-batch/src/main/java/org/sonar/batch/deprecated/components/DefaultTimeMachine.java
sonar-batch/src/main/java/org/sonar/batch/index/MeasurePersister.java
sonar-core/src/main/java/org/sonar/core/measure/db/MeasureDto.java
sonar-core/src/main/java/org/sonar/core/measure/db/MeasureKey.java [deleted file]
sonar-core/src/main/java/org/sonar/core/measure/db/MeasureMapper.java
sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java
sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml
sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java
sonar-core/src/test/java/org/sonar/core/measure/db/MeasureKeyTest.java [deleted file]
sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java

index c5132c9c93488a2bfc75477634c70312c33e5588..e08f7aa136af2836708e018f6dbd34abc515501d 100644 (file)
@@ -183,8 +183,8 @@ public class ComponentAppAction implements RequestHandler {
   private Map<String, MeasureDto> measuresByMetricKey(ComponentDto component, DbSession session) {
     Map<String, MeasureDto> measuresByMetricKey = newHashMap();
     String fileKey = component.getKey();
-    for (MeasureDto measureDto : dbClient.measureDao().findByComponentKeyAndMetricKeys(fileKey, METRIC_KEYS, session)) {
-      measuresByMetricKey.put(measureDto.getKey().metricKey(), measureDto);
+    for (MeasureDto measureDto : dbClient.measureDao().findByComponentKeyAndMetricKeys(session, fileKey, METRIC_KEYS)) {
+      measuresByMetricKey.put(measureDto.getMetricKey(), measureDto);
     }
     return measuresByMetricKey;
   }
@@ -199,29 +199,31 @@ public class ComponentAppAction implements RequestHandler {
 
   @CheckForNull
   private String formatMeasure(@Nullable MeasureDto measure) {
-    if (measure != null) {
-      Metric metric = CoreMetrics.getMetric(measure.getKey().metricKey());
-      Metric.ValueType metricType = metric.getType();
-      Double value = measure.getValue();
-      String data = measure.getData();
-      if (BooleanUtils.isTrue(metric.isOptimizedBestValue()) && value == null) {
-        value = metric.getBestValue();
-      }
-      if (metricType.equals(Metric.ValueType.FLOAT) && value != null) {
-        return i18n.formatDouble(UserSession.get().locale(), value);
-      }
-      if (metricType.equals(Metric.ValueType.INT) && value != null) {
-        return i18n.formatInteger(UserSession.get().locale(), value.intValue());
-      }
-      if (metricType.equals(Metric.ValueType.PERCENT) && value != null) {
-        return i18n.formatDouble(UserSession.get().locale(), value) + "%";
-      }
-      if (metricType.equals(Metric.ValueType.WORK_DUR) && value != null) {
-        return durations.format(UserSession.get().locale(), durations.create(value.longValue()), Durations.DurationFormat.SHORT);
-      }
-      if ((metricType.equals(Metric.ValueType.STRING) || metricType.equals(Metric.ValueType.RATING)) && data != null) {
-        return data;
-      }
+    if (measure == null) {
+      return null;
+    }
+
+    Metric metric = CoreMetrics.getMetric(measure.getMetricKey());
+    Metric.ValueType metricType = metric.getType();
+    Double value = measure.getValue();
+    String data = measure.getData();
+    if (BooleanUtils.isTrue(metric.isOptimizedBestValue()) && value == null) {
+      value = metric.getBestValue();
+    }
+    if (metricType.equals(Metric.ValueType.FLOAT) && value != null) {
+      return i18n.formatDouble(UserSession.get().locale(), value);
+    }
+    if (metricType.equals(Metric.ValueType.INT) && value != null) {
+      return i18n.formatInteger(UserSession.get().locale(), value.intValue());
+    }
+    if (metricType.equals(Metric.ValueType.PERCENT) && value != null) {
+      return i18n.formatDouble(UserSession.get().locale(), value) + "%";
+    }
+    if (metricType.equals(Metric.ValueType.WORK_DUR) && value != null) {
+      return durations.format(UserSession.get().locale(), durations.create(value.longValue()), Durations.DurationFormat.SHORT);
+    }
+    if ((metricType.equals(Metric.ValueType.STRING) || metricType.equals(Metric.ValueType.RATING)) && data != null) {
+      return data;
     }
     return null;
   }
index 21e9e7c9cb278f886600c02001a540479d304c12..95ad3ef370e7f089f56b3baf910c61791b47df70 100644 (file)
@@ -21,13 +21,8 @@ package org.sonar.server.computation;
 
 import org.sonar.api.platform.ComponentContainer;
 import org.sonar.core.issue.db.UpdateConflictResolver;
-import org.sonar.server.computation.issue.IssueCache;
-import org.sonar.server.computation.issue.IssueComputation;
-import org.sonar.server.computation.issue.RuleCache;
-import org.sonar.server.computation.issue.RuleCacheLoader;
-import org.sonar.server.computation.issue.ScmAccountCache;
-import org.sonar.server.computation.issue.ScmAccountCacheLoader;
-import org.sonar.server.computation.issue.SourceLinesCache;
+import org.sonar.server.computation.issue.*;
+import org.sonar.server.computation.measure.MetricCache;
 import org.sonar.server.computation.step.ComputationSteps;
 import org.sonar.server.platform.Platform;
 import org.sonar.server.view.index.ViewIndex;
@@ -37,22 +32,6 @@ import java.util.List;
 
 public class ComputationContainer {
 
-  public void execute(ReportQueue.Item item) {
-    ComponentContainer container = Platform.getInstance().getContainer();
-    ComponentContainer child = container.createChild();
-    child.addSingletons(componentClasses());
-    child.addSingletons(ComputationSteps.orderedStepClasses());
-    child.startComponents();
-    try {
-      child.getComponentByType(ComputationService.class).process(item);
-    } finally {
-      child.stopComponents();
-      // TODO not possible to have multiple children -> will be
-      // a problem when we will have multiple concurrent computation workers
-      container.removeChild();
-    }
-  }
-
   /**
    * List of all objects to be injected in the picocontainer dedicated to computation stack.
    * Does not contain the steps declared in {@link org.sonar.server.computation.step.ComputationSteps#orderedStepClasses()}.
@@ -70,9 +49,26 @@ public class ComputationContainer {
       RuleCache.class,
       RuleCacheLoader.class,
       IssueCache.class,
+      MetricCache.class,
       UpdateConflictResolver.class,
 
       // views
       ViewIndex.class);
   }
+
+  public void execute(ReportQueue.Item item) {
+    ComponentContainer container = Platform.getInstance().getContainer();
+    ComponentContainer child = container.createChild();
+    child.addSingletons(componentClasses());
+    child.addSingletons(ComputationSteps.orderedStepClasses());
+    child.startComponents();
+    try {
+      child.getComponentByType(ComputationService.class).process(item);
+    } finally {
+      child.stopComponents();
+      // TODO not possible to have multiple children -> will be
+      // a problem when we will have multiple concurrent computation workers
+      container.removeChild();
+    }
+  }
 }
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/measure/BatchReportMeasureUtils.java b/server/sonar-server/src/main/java/org/sonar/server/computation/measure/BatchReportMeasureUtils.java
new file mode 100644 (file)
index 0000000..3e35b99
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.measure;
+
+import org.sonar.batch.protocol.output.BatchReport;
+
+import javax.annotation.CheckForNull;
+
+public class BatchReportMeasureUtils {
+  private BatchReportMeasureUtils() {
+    // static methods only
+  }
+
+  /**
+   * return the numerical value as a double. It's the type used in db.
+   * Returns null if no numerical value found
+   */
+  @CheckForNull
+  public static Double valueAsDouble(BatchReport.Measure measure) {
+    switch (measure.getValueType()) {
+      case BOOLEAN:
+        return measure.getBooleanValue() ? 1.0d : 0.0d;
+      case INT:
+        return Double.valueOf(measure.getIntValue());
+      case LONG:
+        return Double.valueOf(measure.getLongValue());
+      case DOUBLE:
+        return measure.getDoubleValue();
+      default:
+        return null;
+    }
+  }
+
+  /**
+   * check that measure has a value (numerical or string) and a metric key
+   */
+  public static void checkMeasure(BatchReport.Measure measure) {
+    if (!measure.hasValueType() || !measure.hasMetricKey()) {
+      throw newIllegalStateException(measure);
+    }
+
+    boolean hasValueOrData = false;
+    switch (measure.getValueType()) {
+      case DOUBLE:
+        hasValueOrData = measure.hasDoubleValue();
+        break;
+      case INT:
+        hasValueOrData = measure.hasIntValue();
+        break;
+      case LONG:
+        hasValueOrData = measure.hasLongValue();
+        break;
+      case STRING:
+        hasValueOrData = measure.hasStringValue();
+        break;
+      case BOOLEAN:
+        hasValueOrData = measure.hasBooleanValue();
+        break;
+    }
+
+    if (!hasValueOrData) {
+      throw newIllegalStateException(measure);
+    }
+  }
+
+  private static IllegalStateException newIllegalStateException(BatchReport.Measure measure) {
+    return new IllegalStateException(String.format("Measure %s does not have value", measure));
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/measure/MetricCache.java b/server/sonar-server/src/main/java/org/sonar/server/computation/measure/MetricCache.java
new file mode 100644 (file)
index 0000000..cd908bf
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.measure;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Maps;
+import org.sonar.core.measure.db.MetricDto;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.server.db.DbClient;
+import org.sonar.server.exceptions.NotFoundException;
+
+import java.util.List;
+import java.util.Map;
+
+public class MetricCache {
+  private final Map<String, MetricDto> metrics;
+
+  public MetricCache(DbClient dbClient) {
+    try (DbSession dbSession = dbClient.openSession(false)) {
+      List<MetricDto> metricList = dbClient.metricDao().findEnabled(dbSession);
+      this.metrics = Maps.uniqueIndex(metricList, new Function<MetricDto, String>() {
+        @Override
+        public String apply(MetricDto metric) {
+          return metric.getKey();
+        }
+      });
+    }
+  }
+
+  public MetricDto get(String key) {
+    MetricDto metric = metrics.get(key);
+    if (metric == null) {
+      throw new NotFoundException(String.format("Not found: '%s'", key));
+    }
+
+    return metric;
+  }
+}
index 81cdeea9eda6adcf444f6778f7c8fe13cd7fb470..530fcaad11b40130361355d4f3e445ee51a46810 100644 (file)
@@ -41,6 +41,7 @@ public class ComputationSteps {
       ParseReportStep.class,
 
       // Persist data
+      PersistMeasuresStep.class,
       PersistIssuesStep.class,
       PersistComponentLinksStep.class,
       PersistEventsStep.class,
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java
new file mode 100644 (file)
index 0000000..68d8ea1
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.step;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import org.sonar.api.resources.Qualifiers;
+import org.sonar.api.rule.RuleKey;
+import org.sonar.batch.protocol.output.BatchReport;
+import org.sonar.batch.protocol.output.BatchReportReader;
+import org.sonar.core.measure.db.MeasureDto;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.server.computation.ComputationContext;
+import org.sonar.server.computation.issue.RuleCache;
+import org.sonar.server.computation.measure.MetricCache;
+import org.sonar.server.db.DbClient;
+
+import java.util.List;
+
+import static org.sonar.server.computation.measure.BatchReportMeasureUtils.checkMeasure;
+import static org.sonar.server.computation.measure.BatchReportMeasureUtils.valueAsDouble;
+
+public class PersistMeasuresStep implements ComputationStep {
+
+  private final DbClient dbClient;
+  private final RuleCache ruleCache;
+  private final MetricCache metricCache;
+
+  public PersistMeasuresStep(DbClient dbClient, RuleCache ruleCache, MetricCache metricCache) {
+    this.dbClient = dbClient;
+    this.ruleCache = ruleCache;
+    this.metricCache = metricCache;
+  }
+
+  @Override
+  public String[] supportedProjectQualifiers() {
+    return new String[] {Qualifiers.PROJECT, Qualifiers.VIEW};
+  }
+
+  @Override
+  public String getDescription() {
+    return "Persist measures";
+  }
+
+  @Override
+  public void execute(ComputationContext context) {
+    int rootComponentRef = context.getReportMetadata().getRootComponentRef();
+    try (DbSession dbSession = dbClient.openSession(true)) {
+      recursivelyProcessComponent(dbSession, context, rootComponentRef);
+      dbSession.commit();
+    }
+  }
+
+  private void recursivelyProcessComponent(DbSession dbSession, ComputationContext context, int componentRef) {
+    BatchReportReader reportReader = context.getReportReader();
+    BatchReport.Component component = reportReader.readComponent(componentRef);
+    List<BatchReport.Measure> measures = reportReader.readComponentMeasures(componentRef);
+    persistMeasures(dbSession, measures, component);
+    for (Integer childRef : component.getChildRefList()) {
+      recursivelyProcessComponent(dbSession, context, childRef);
+    }
+  }
+
+  private void persistMeasures(DbSession dbSession, List<BatchReport.Measure> batchReportMeasures, final BatchReport.Component component) {
+    List<MeasureDto> measures = Lists.transform(batchReportMeasures, new Function<BatchReport.Measure, MeasureDto>() {
+      @Override
+      public MeasureDto apply(BatchReport.Measure batchMeasure) {
+        return toMeasureDto(batchMeasure, component);
+      }
+    });
+
+    for (MeasureDto measure : measures) {
+      dbClient.measureDao().insert(dbSession, measure);
+    }
+  }
+
+  @VisibleForTesting
+  MeasureDto toMeasureDto(BatchReport.Measure in, BatchReport.Component component) {
+    checkMeasure(in);
+
+    MeasureDto out = new MeasureDto()
+      .setTendency(in.hasTendency() ? in.getTendency() : null)
+      .setVariation(1, in.hasVariationValue1() ? in.getVariationValue1() : null)
+      .setVariation(2, in.hasVariationValue2() ? in.getVariationValue2() : null)
+      .setVariation(3, in.hasVariationValue3() ? in.getVariationValue3() : null)
+      .setVariation(4, in.hasVariationValue4() ? in.getVariationValue4() : null)
+      .setVariation(5, in.hasVariationValue5() ? in.getVariationValue5() : null)
+      .setAlertStatus(in.hasAlertStatus() ? in.getAlertStatus() : null)
+      .setAlertText(in.hasAlertText() ? in.getAlertText() : null)
+      .setDescription(in.hasDescription() ? in.getDescription() : null)
+      .setSeverity(in.hasSeverity() ? in.getSeverity().name() : null)
+      .setComponentId(component.getId())
+      .setSnapshotId(component.getSnapshotId())
+      .setMetricId(metricCache.get(in.getMetricKey()).getId())
+      .setRuleId(ruleCache.get(RuleKey.parse(in.getRuleKey())).getId())
+      .setCharacteristicId(in.hasCharactericId() ? in.getCharactericId() : null);
+    out.setValue(valueAsDouble(in));
+    out.setData(in.hasStringValue() ? in.getStringValue() : null);
+    return out;
+  }
+}
index e3d309a57cc90c6b3c33acbbd443d142d27e6810..5f18d58f81fdc848ff1f37b8e1eedc118254dc8d 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.api.utils.text.JsonWriter;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.component.ComponentDto;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.MyBatis;
 import org.sonar.server.component.db.ComponentDao;
@@ -41,7 +40,6 @@ import org.sonar.server.measure.persistence.MeasureDao;
 import org.sonar.server.user.UserSession;
 
 import javax.annotation.CheckForNull;
-
 import java.util.List;
 
 public class ShowAction implements RequestHandler {
@@ -105,9 +103,9 @@ public class ShowAction implements RequestHandler {
 
   @CheckForNull
   private String findDataFromComponent(String fileKey, String metricKey, DbSession session) {
-    MeasureDto data = measureDao.getNullableByKey(session, MeasureKey.of(fileKey, metricKey));
-    if (data != null) {
-      return data.getData();
+    MeasureDto measure = measureDao.findByComponentKeyAndMetricKey(session, fileKey, metricKey);
+    if (measure != null) {
+      return measure.getData();
     }
     return null;
   }
index 89790d9524c63bec1c29932efa89ddf8f3543c2f..7b1b40db23d3a6850a2d9c8acca9bacc61663c3c 100644 (file)
 
 package org.sonar.server.measure.persistence;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Lists;
+import com.google.common.base.Function;
 import org.sonar.api.ServerComponent;
-import org.sonar.api.utils.System2;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.measure.db.MeasureMapper;
 import org.sonar.core.persistence.DaoComponent;
+import org.sonar.core.persistence.DaoUtils;
 import org.sonar.core.persistence.DbSession;
-import org.sonar.server.db.BaseDao;
 
-import java.util.Collections;
+import javax.annotation.CheckForNull;
 import java.util.List;
 
-import static com.google.common.collect.Lists.newArrayList;
+public class MeasureDao implements ServerComponent, DaoComponent {
 
-public class MeasureDao extends BaseDao<MeasureMapper, MeasureDto, MeasureKey> implements ServerComponent, DaoComponent {
-
-  public MeasureDao() {
-    this(System2.INSTANCE);
-  }
-
-  @VisibleForTesting
-  public MeasureDao(System2 system) {
-    super(MeasureMapper.class, system);
+  public boolean existsByKey(DbSession session, String componentKey, String metricKey) {
+    return mapper(session).countByComponentAndMetric(componentKey, metricKey) > 0;
   }
 
-  @Override
-  protected MeasureDto doGetNullableByKey(DbSession session, MeasureKey key) {
-    return mapper(session).selectByKey(key);
+  @CheckForNull
+  public MeasureDto findByComponentKeyAndMetricKey(DbSession session, String componentKey, String metricKey) {
+    return mapper(session).selectByComponentAndMetric(componentKey, metricKey);
   }
 
-  public boolean existsByKey(MeasureKey key, DbSession session) {
-    return mapper(session).countByKey(key) > 0;
+  public List<MeasureDto> findByComponentKeyAndMetricKeys(final DbSession session, final String componentKey, List<String> metricKeys) {
+    return DaoUtils.executeLargeInputs(metricKeys, new Function<List<String>, List<MeasureDto>>() {
+      @Override
+      public List<MeasureDto> apply(List<String> keys) {
+        return mapper(session).selectByComponentAndMetrics(componentKey, keys);
+      }
+    });
   }
 
-  public List<MeasureDto> findByComponentKeyAndMetricKeys(String componentKey, List<String> metricKeys, DbSession session) {
-    if (metricKeys.isEmpty()) {
-      return Collections.emptyList();
-    }
-    List<MeasureDto> dtos = newArrayList();
-    List<List<String>> partitions = Lists.partition(newArrayList(metricKeys), 1000);
-    for (List<String> partition : partitions) {
-      dtos.addAll(mapper(session).selectByComponentAndMetrics(componentKey, partition));
-    }
-    return dtos;
+  public void insert(DbSession session, MeasureDto measureDto) {
+    mapper(session).insert(measureDto);
   }
 
-  public MeasureDto findByComponentKeyAndMetricKey(String componentKey, String metricKey, DbSession session) {
-    return mapper(session).selectByComponentAndMetric(componentKey, metricKey);
+  private MeasureMapper mapper(DbSession session) {
+    return session.getMapper(MeasureMapper.class);
   }
 }
index 4b4add00ce50268c9dc2ac05575bdc65a2107642..ed80adb8f940745eb8f6dbc67bb25f4c1da80c33 100644 (file)
@@ -26,7 +26,6 @@ import org.sonar.api.ServerComponent;
 import org.sonar.api.measures.CoreMetrics;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.MyBatis;
 import org.sonar.server.db.DbClient;
@@ -36,7 +35,6 @@ import org.sonar.server.user.UserSession;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
-
 import java.util.List;
 
 public class SourceService implements ServerComponent {
@@ -97,7 +95,7 @@ public class SourceService implements ServerComponent {
   private String findDataFromComponent(String fileKey, String metricKey) {
     DbSession session = dbClient.openSession(false);
     try {
-      MeasureDto data = dbClient.measureDao().getNullableByKey(session, MeasureKey.of(fileKey, metricKey));
+      MeasureDto data = dbClient.measureDao().findByComponentKeyAndMetricKey(session, fileKey, metricKey);
       if (data != null) {
         return data.getData();
       }
index 3a72095367c85b52c03af49f934a7932e4a6cfe5..3f34be942f33a9b910dd0e3e4f91b864db6ae755 100644 (file)
@@ -29,7 +29,6 @@ import org.sonar.api.utils.KeyValueFormat;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.component.SnapshotPerspectives;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.MyBatis;
 import org.sonar.server.measure.persistence.MeasureDao;
@@ -109,7 +108,7 @@ public class CoverageService implements ServerComponent {
   private Map<Integer, Integer> findDataFromComponent(String fileKey, String metricKey) {
     DbSession session = myBatis.openSession(false);
     try {
-      MeasureDto data = measureDao.getNullableByKey(session, MeasureKey.of(fileKey, metricKey));
+      MeasureDto data = measureDao.findByComponentKeyAndMetricKey(session, fileKey, metricKey);
       String dataValue = data != null ? data.getData() : null;
       if (dataValue != null) {
         return KeyValueFormat.parseIntInt(dataValue);
index 4213c5553beed43c63a67f606f4eab0ceedf2a7f..2b04e68cf0ae644eb3c0ef433599d4fbb44f3244 100644 (file)
@@ -138,7 +138,7 @@ public class TestsShowAction implements RequestHandler {
   private String findTestData(String fileKey) {
     DbSession session = dbClient.openSession(false);
     try {
-      MeasureDto testData = dbClient.measureDao().findByComponentKeyAndMetricKey(fileKey, CoreMetrics.TEST_DATA_KEY, session);
+      MeasureDto testData = dbClient.measureDao().findByComponentKeyAndMetricKey(session, fileKey, CoreMetrics.TEST_DATA_KEY);
       if (testData != null) {
         return testData.getData();
       }
index 19496fb97ada7e4b6ac0ea29db532202c5146661..b7d0e94921692afe1c52621a2f9fe04712b585d1 100644 (file)
@@ -34,7 +34,6 @@ import org.sonar.api.utils.Durations;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.component.ComponentDto;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.properties.PropertiesDao;
 import org.sonar.core.properties.PropertyDto;
@@ -99,7 +98,7 @@ public class ComponentAppActionTest {
     when(dbClient.propertiesDao()).thenReturn(propertiesDao);
     when(dbClient.measureDao()).thenReturn(measureDao);
 
-    when(measureDao.findByComponentKeyAndMetricKeys(anyString(), anyListOf(String.class), eq(session))).thenReturn(measures);
+    when(measureDao.findByComponentKeyAndMetricKeys(eq(session), anyString(), anyListOf(String.class))).thenReturn(measures);
 
     tester = new WsTester(new ComponentsWs(new ComponentAppAction(dbClient, durations, i18n), mock(SearchAction.class)));
   }
@@ -139,13 +138,13 @@ public class ComponentAppActionTest {
     addMeasure(CoreMetrics.SQALE_RATING_KEY, "C");
     addMeasure(CoreMetrics.SQALE_DEBT_RATIO_KEY, 35d);
 
-    measures.add(MeasureDto.createFor(MeasureKey.of(COMPONENT_KEY, CoreMetrics.TECHNICAL_DEBT_KEY)).setValue(182.0));
+    measures.add(new MeasureDto().setComponentKey(COMPONENT_KEY).setMetricKey(CoreMetrics.TECHNICAL_DEBT_KEY).setValue(182.0));
     when(durations.format(any(Locale.class), any(Duration.class), eq(Durations.DurationFormat.SHORT))).thenReturn("3h 2min");
 
     WsTester.TestRequest request = tester.newGetRequest("api/components", "app").setParam("uuid", COMPONENT_UUID);
     request.execute().assertJson(getClass(), "app_with_measures.json");
 
-    verify(measureDao).findByComponentKeyAndMetricKeys(eq(COMPONENT_KEY), measureKeysCaptor.capture(), eq(session));
+    verify(measureDao).findByComponentKeyAndMetricKeys(eq(session), eq(COMPONENT_KEY), measureKeysCaptor.capture());
     assertThat(measureKeysCaptor.getValue()).contains(CoreMetrics.LINES_KEY, CoreMetrics.COVERAGE_KEY, CoreMetrics.DUPLICATED_LINES_DENSITY_KEY,
       CoreMetrics.TECHNICAL_DEBT_KEY);
   }
@@ -229,17 +228,17 @@ public class ComponentAppActionTest {
   }
 
   private void addMeasure(String metricKey, Integer value) {
-    measures.add(MeasureDto.createFor(MeasureKey.of(COMPONENT_KEY, metricKey)).setValue(value.doubleValue()));
+    measures.add(new MeasureDto().setComponentKey(COMPONENT_KEY).setMetricKey(metricKey).setValue(value.doubleValue()));
     when(i18n.formatInteger(any(Locale.class), eq(value.intValue()))).thenReturn(Integer.toString(value));
   }
 
   private void addMeasure(String metricKey, Double value) {
-    measures.add(MeasureDto.createFor(MeasureKey.of(COMPONENT_KEY, metricKey)).setValue(value));
+    measures.add(new MeasureDto().setComponentKey(COMPONENT_KEY).setMetricKey(metricKey).setValue(value));
     when(i18n.formatDouble(any(Locale.class), eq(value))).thenReturn(Double.toString(value));
   }
 
   private void addMeasure(String metricKey, String value) {
-    measures.add(MeasureDto.createFor(MeasureKey.of(COMPONENT_KEY, metricKey)).setTextValue(value));
+    measures.add(new MeasureDto().setComponentKey(COMPONENT_KEY).setMetricKey(metricKey).setData(value));
   }
 
 }
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/BatchReportMeasureUtilsTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/BatchReportMeasureUtilsTest.java
new file mode 100644 (file)
index 0000000..6d743fa
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.measure;
+
+import org.junit.Test;
+import org.sonar.batch.protocol.Constants;
+import org.sonar.batch.protocol.output.BatchReport;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.sonar.batch.protocol.Constants.MeasureValueType.*;
+import static org.sonar.server.computation.measure.BatchReportMeasureUtils.checkMeasure;
+import static org.sonar.server.computation.measure.BatchReportMeasureUtils.valueAsDouble;
+
+public class BatchReportMeasureUtilsTest {
+
+  @Test(expected = IllegalStateException.class)
+  public void fail_when_no_metric_key() throws Exception {
+    BatchReport.Measure measure = BatchReport.Measure.newBuilder()
+      .setValueType(STRING)
+      .setStringValue("string-value")
+      .build();
+
+    checkMeasure(measure);
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void fail_when_no_value() throws Exception {
+    BatchReport.Measure measure = BatchReport.Measure.newBuilder()
+      .setMetricKey("repo:metric-key")
+      .build();
+
+    checkMeasure(measure);
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void fail_when_no_consistency_between_string_value_and_numerical_value_type() throws Exception {
+    BatchReport.Measure measure = BatchReport.Measure.newBuilder()
+      .setValueType(DOUBLE)
+      .setStringValue("string-value")
+      .build();
+
+    checkMeasure(measure);
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void fail_when_no_consistence_between_numerical_value_types() throws Exception {
+    BatchReport.Measure measure = BatchReport.Measure.newBuilder()
+      .setValueType(DOUBLE)
+      .setIntValue(3)
+      .build();
+
+    checkMeasure(measure);
+  }
+
+  @Test
+  public void validate_all_value_type_without_exception_thrown() throws Exception {
+    checkMeasure(newBuilder().setValueType(STRING).setStringValue("string-value").build());
+    checkMeasure(newBuilder().setValueType(DOUBLE).setDoubleValue(1.0d).build());
+    checkMeasure(newBuilder().setValueType(Constants.MeasureValueType.INT).setIntValue(1).build());
+    checkMeasure(newBuilder().setValueType(Constants.MeasureValueType.LONG).setLongValue(2L).build());
+    checkMeasure(newBuilder().setValueType(BOOLEAN).setBooleanValue(true).build());
+  }
+
+  @Test
+  public void value_type_as_double_correct_for_all_numerical_types() throws Exception {
+    assertThat(valueAsDouble(newBuilder().setBooleanValue(true).setValueType(BOOLEAN).build())).isEqualTo(1.0d);
+    assertThat(valueAsDouble(newBuilder().setIntValue(2).setValueType(INT).build())).isEqualTo(2.0d);
+    assertThat(valueAsDouble(newBuilder().setLongValue(3L).setValueType(LONG).build())).isEqualTo(3.0d);
+    assertThat(valueAsDouble(newBuilder().setDoubleValue(4.4d).setValueType(DOUBLE).build())).isEqualTo(4.4d);
+  }
+
+  private BatchReport.Measure.Builder newBuilder() {
+    return BatchReport.Measure.newBuilder().setMetricKey("repo:metric-key");
+  }
+}
\ No newline at end of file
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MetricCacheTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MetricCacheTest.java
new file mode 100644 (file)
index 0000000..38f61ab
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.measure;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.core.persistence.DbTester;
+import org.sonar.server.db.DbClient;
+import org.sonar.server.exceptions.NotFoundException;
+import org.sonar.server.measure.persistence.MetricDao;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MetricCacheTest {
+
+  @ClassRule
+  public static DbTester db = new DbTester();
+
+  MetricCache sut;
+
+  @Before
+  public void setUp() throws Exception {
+    db.prepareDbUnit(getClass(), "metrics.xml");
+    sut = new MetricCache(new DbClient(db.database(), db.myBatis(), new MetricDao()));
+  }
+
+  @Test
+  public void cache_give_access_to_enabled_metrics() throws Exception {
+    assertThat(sut.get("ncloc").getId()).isEqualTo(1);
+    assertThat(sut.get("coverage").getId()).isEqualTo(2);
+  }
+
+  @Test(expected = NotFoundException.class)
+  public void fail_when_metric_not_found() throws Exception {
+    sut.get("complexity");
+  }
+}
index 696ce5e65554525c810cd18d5555fcf5b2cd0135..06f7580a42c7a2a18bceabc7145d20357a6f8c45 100644 (file)
@@ -44,12 +44,13 @@ public class ComputationStepsTest {
       mock(SendIssueNotificationsStep.class),
       mock(IndexComponentsStep.class),
       mock(PersistComponentLinksStep.class),
+      mock(PersistMeasuresStep.class),
       mock(PersistEventsStep.class)
       );
 
-    assertThat(registry.orderedSteps()).hasSize(13);
+    assertThat(registry.orderedSteps()).hasSize(14);
     assertThat(registry.orderedSteps().get(0)).isInstanceOf(ParseReportStep.class);
-    assertThat(registry.orderedSteps().get(12)).isInstanceOf(SendIssueNotificationsStep.class);
+    assertThat(registry.orderedSteps().get(13)).isInstanceOf(SendIssueNotificationsStep.class);
   }
 
   @Test
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java
new file mode 100644 (file)
index 0000000..0e5aea5
--- /dev/null
@@ -0,0 +1,234 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.step;
+
+import org.assertj.core.data.Offset;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+import org.sonar.api.rule.RuleKey;
+import org.sonar.api.rule.Severity;
+import org.sonar.batch.protocol.Constants;
+import org.sonar.batch.protocol.output.BatchReport;
+import org.sonar.batch.protocol.output.BatchReportReader;
+import org.sonar.batch.protocol.output.BatchReportWriter;
+import org.sonar.core.component.ComponentDto;
+import org.sonar.core.measure.db.MeasureDto;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.server.computation.ComputationContext;
+import org.sonar.server.computation.issue.RuleCache;
+import org.sonar.server.computation.measure.MetricCache;
+import org.sonar.server.db.DbClient;
+import org.sonar.server.measure.persistence.MeasureDao;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Date;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+
+public class PersistMeasuresStepTest extends BaseStepTest {
+
+  @Rule
+  public TemporaryFolder temp = new TemporaryFolder();
+
+  DbClient dbClient;
+  RuleCache ruleCache;
+  MetricCache metricCache;
+  MeasureDao measureDao;
+
+  PersistMeasuresStep sut;
+
+  @Before
+  public void setUp() throws Exception {
+    dbClient = mock(DbClient.class, Mockito.RETURNS_DEEP_STUBS);
+    ruleCache = mock(RuleCache.class, Mockito.RETURNS_DEEP_STUBS);
+    metricCache = mock(MetricCache.class, Mockito.RETURNS_DEEP_STUBS);
+    when(metricCache.get("metric-key").getId()).thenReturn(654);
+    measureDao = mock(MeasureDao.class);
+    when(ruleCache.get(any(RuleKey.class)).getId()).thenReturn(987);
+
+    sut = new PersistMeasuresStep(dbClient, ruleCache, metricCache);
+  }
+
+  @Test
+  public void insert_measures_from_report() throws Exception {
+    File dir = temp.newFolder();
+    BatchReportWriter report = new BatchReportWriter(dir);
+
+    when(dbClient.measureDao()).thenReturn(measureDao);
+
+    report.writeMetadata(BatchReport.Metadata.newBuilder()
+      .setAnalysisDate(new Date().getTime())
+      .setRootComponentRef(1)
+      .setProjectKey("project-key")
+      .setSnapshotId(3)
+      .build());
+
+    report.writeComponent(defaultComponent()
+      .addChildRef(2)
+      .build());
+    report.writeComponent(
+      defaultComponent()
+        .setRef(2)
+        .build());
+
+    report.writeComponentMeasures(1, Arrays.asList(
+      BatchReport.Measure.newBuilder()
+        .setValueType(Constants.MeasureValueType.STRING)
+        .setStringValue("measure-data")
+        .setTendency(2)
+        .setVariationValue1(1.1d)
+        .setVariationValue2(2.2d)
+        .setVariationValue3(3.3d)
+        .setVariationValue4(4.4d)
+        .setVariationValue5(5.5d)
+        .setAlertStatus("measure-alert-status")
+        .setAlertText("measure-alert-text")
+        .setDescription("measure-description")
+        .setSeverity(Constants.Severity.INFO)
+        .setMetricKey("metric-key")
+        .setRuleKey("repo:rule-key")
+        .setCharactericId(123456)
+        .build()));
+
+    report.writeComponentMeasures(2, Arrays.asList(
+      BatchReport.Measure.newBuilder()
+        .setValueType(Constants.MeasureValueType.DOUBLE)
+        .setDoubleValue(123.123d)
+        .setTendency(2)
+        .setVariationValue1(1.1d)
+        .setVariationValue2(2.2d)
+        .setVariationValue3(3.3d)
+        .setVariationValue4(4.4d)
+        .setVariationValue5(5.5d)
+        .setAlertStatus("measure-alert-status")
+        .setAlertText("measure-alert-text")
+        .setDescription("measure-description")
+        .setSeverity(Constants.Severity.BLOCKER)
+        .setMetricKey("metric-key")
+        .setRuleKey("repo:rule-key")
+        .setCharactericId(123456)
+        .build()));
+
+    sut.execute(new ComputationContext(new BatchReportReader(dir), mock(ComponentDto.class)));
+
+    ArgumentCaptor<MeasureDto> argument = ArgumentCaptor.forClass(MeasureDto.class);
+    verify(measureDao, times(2)).insert(any(DbSession.class), argument.capture());
+    assertThat(argument.getValue().getValue()).isEqualTo(123.123d, Offset.offset(0.0001d));
+    assertThat(argument.getValue().getMetricId()).isEqualTo(654);
+    assertThat(argument.getValue().getRuleId()).isEqualTo(987);
+    assertThat(argument.getValue().getSeverity()).isEqualTo(Severity.BLOCKER);
+  }
+
+  private BatchReport.Component.Builder defaultComponent() {
+    return BatchReport.Component.newBuilder()
+      .setRef(1)
+      .setId(2)
+      .setSnapshotId(3);
+  }
+
+  @Test
+  public void map_full_batch_measure() throws Exception {
+    BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder()
+      .setValueType(Constants.MeasureValueType.DOUBLE)
+      .setDoubleValue(123.123d)
+      .setTendency(2)
+      .setVariationValue1(1.1d)
+      .setVariationValue2(2.2d)
+      .setVariationValue3(3.3d)
+      .setVariationValue4(4.4d)
+      .setVariationValue5(5.5d)
+      .setAlertStatus("measure-alert-status")
+      .setAlertText("measure-alert-text")
+      .setDescription("measure-description")
+      .setSeverity(Constants.Severity.CRITICAL)
+      .setMetricKey("metric-key")
+      .setRuleKey("repo:rule-key")
+      .setCharactericId(123456)
+      .build();
+
+    BatchReport.Component component = defaultComponent().build();
+
+    MeasureDto measure = sut.toMeasureDto(batchMeasure, component);
+
+    assertThat(measure).isEqualToComparingFieldByField(expectedFullMeasure());
+  }
+
+  @Test
+  public void map_minimal_batch_measure() throws Exception {
+    BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder()
+      .setValueType(Constants.MeasureValueType.INT)
+      .setIntValue(123)
+      .setSeverity(Constants.Severity.INFO)
+      .setMetricKey("metric-key")
+      .setRuleKey("repo:rule-key")
+      .build();
+
+    BatchReport.Component component = defaultComponent()
+      .build();
+
+    MeasureDto measure = sut.toMeasureDto(batchMeasure, component);
+
+    assertThat(measure).isEqualToComparingFieldByField(expectedMinimalistMeasure());
+  }
+
+  private MeasureDto expectedFullMeasure() {
+    return new MeasureDto()
+      .setComponentId(2L)
+      .setSnapshotId(3L)
+      .setCharacteristicId(123456)
+      .setValue(123.123d)
+      .setTendency(2)
+      .setVariation(1, 1.1d)
+      .setVariation(2, 2.2d)
+      .setVariation(3, 3.3d)
+      .setVariation(4, 4.4d)
+      .setVariation(5, 5.5d)
+      .setAlertStatus("measure-alert-status")
+      .setAlertText("measure-alert-text")
+      .setDescription("measure-description")
+      .setSeverity(Severity.CRITICAL)
+      .setMetricId(654)
+      .setRuleId(987);
+  }
+
+  private MeasureDto expectedMinimalistMeasure() {
+    return new MeasureDto()
+      .setComponentId(2L)
+      .setSnapshotId(3L)
+      .setValue(123d)
+      .setSeverity(Severity.INFO)
+      .setMetricId(654)
+      .setRuleId(987);
+  }
+
+  @Override
+  protected ComputationStep step() throws IOException {
+    return sut;
+  }
+}
index 7fc53c3acc0a6d8001f3901cec604254c291c4b5..db137bb750e929af2cd125974fc0793079897ab2 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.api.utils.text.JsonWriter;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.component.ComponentDto;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.server.component.db.ComponentDao;
 import org.sonar.server.db.DbClient;
@@ -86,10 +85,9 @@ public class ShowActionTest {
     when(componentDao.getNullableByKey(session, componentKey)).thenReturn(componentDto);
 
     String data = "{duplications}";
-    MeasureKey measureKey = MeasureKey.of(componentKey, CoreMetrics.DUPLICATIONS_DATA_KEY);
-    when(measureDao.getNullableByKey(session, measureKey)).thenReturn(
-      MeasureDto.createFor(measureKey).setTextValue("{duplications}")
-    );
+    when(measureDao.findByComponentKeyAndMetricKey(session, componentKey, CoreMetrics.DUPLICATIONS_DATA_KEY)).thenReturn(
+      new MeasureDto().setComponentKey(componentKey).setMetricKey(CoreMetrics.DUPLICATIONS_DATA_KEY).setData("{duplications}")
+      );
 
     List<DuplicationsParser.Block> blocks = newArrayList(new DuplicationsParser.Block(newArrayList(new DuplicationsParser.Duplication(componentDto, 1, 2))));
     when(parser.parse(componentDto, data, session)).thenReturn(blocks);
@@ -112,9 +110,8 @@ public class ShowActionTest {
     when(componentDao.getNullableByKey(session, componentKey)).thenReturn(componentDto);
 
     String data = "{duplications}";
-    MeasureKey measureKey = MeasureKey.of(componentKey, CoreMetrics.DUPLICATIONS_DATA_KEY);
-    when(measureDao.getNullableByKey(session, measureKey)).thenReturn(
-      MeasureDto.createFor(measureKey).setTextValue("{duplications}")
+    when(measureDao.findByComponentKeyAndMetricKey(session, componentKey, CoreMetrics.DUPLICATIONS_DATA_KEY)).thenReturn(
+      new MeasureDto().setComponentKey(componentKey).setMetricKey(CoreMetrics.DUPLICATIONS_DATA_KEY).setData("{duplications}")
       );
 
     List<DuplicationsParser.Block> blocks = newArrayList(new DuplicationsParser.Block(newArrayList(new DuplicationsParser.Duplication(componentDto, 1, 2))));
@@ -134,8 +131,7 @@ public class ShowActionTest {
     ComponentDto componentDto = new ComponentDto().setId(10L);
     when(componentDao.getNullableByKey(session, componentKey)).thenReturn(componentDto);
 
-    MeasureKey measureKey = MeasureKey.of(componentKey, CoreMetrics.DUPLICATIONS_DATA_KEY);
-    when(measureDao.getNullableByKey(session, measureKey)).thenReturn(null);
+    when(measureDao.findByComponentKeyAndMetricKey(session, componentKey, CoreMetrics.DUPLICATIONS_DATA_KEY)).thenReturn(null);
 
     WsTester.TestRequest request = tester.newGetRequest("api/duplications", "show").setParam("key", componentKey);
     request.execute();
index 4f1260a0ad8ea3e17f5aee7353afbf790329f8ba..d37060f1b1a2e86acf334bf30e808d9b6638c34f 100644 (file)
@@ -22,28 +22,33 @@ package org.sonar.server.measure.persistence;
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
-import org.sonar.api.utils.System2;
+import org.junit.experimental.categories.Category;
+import org.sonar.api.rule.Severity;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
-import org.sonar.core.persistence.AbstractDaoTestCase;
 import org.sonar.core.persistence.DbSession;
+import org.sonar.core.persistence.DbTester;
+import org.sonar.test.DbTests;
 
 import java.util.List;
 
 import static com.google.common.collect.Lists.newArrayList;
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class MeasureDaoTest extends AbstractDaoTestCase {
+@Category(DbTests.class)
+public class MeasureDaoTest {
 
-  DbSession session;
+  @Rule
+  public DbTester db = new DbTester();
 
-  MeasureDao dao;
+  DbSession session;
+  MeasureDao sut;
 
   @Before
-  public void createDao() {
-    session = getMyBatis().openSession(false);
-    dao = new MeasureDao(System2.INSTANCE);
+  public void setUp() {
+    session = db.myBatis().openSession(false);
+    sut = new MeasureDao();
   }
 
   @After
@@ -53,46 +58,48 @@ public class MeasureDaoTest extends AbstractDaoTestCase {
 
   @Test
   public void get_value_by_key() throws Exception {
-    setupData("shared");
+    db.prepareDbUnit(getClass(), "shared.xml");
 
-    MeasureDto result = dao.getNullableByKey(session, MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc"));
+    MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc");
     assertThat(result.getId()).isEqualTo(22);
     assertThat(result.getValue()).isEqualTo(10d);
   }
 
   @Test
+  // TODO the string must be longer than 4000 char to be persisted in the data field
   public void get_data_by_key() throws Exception {
-    setupData("shared");
+    db.prepareDbUnit(getClass(), "shared.xml");
 
-    MeasureDto result = dao.getNullableByKey(session, MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "authors_by_line"));
+    MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "authors_by_line");
     assertThat(result.getId()).isEqualTo(20);
     assertThat(result.getData()).isEqualTo("0123456789012345678901234567890123456789");
   }
 
   @Test
   public void get_text_value_by_key() throws Exception {
-    setupData("shared");
+    db.prepareDbUnit(getClass(), "shared.xml");
 
-    MeasureDto result = dao.getNullableByKey(session, MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "coverage_line_hits_data"));
+    MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "coverage_line_hits_data");
     assertThat(result.getId()).isEqualTo(21);
     assertThat(result.getData()).isEqualTo("36=1;37=1;38=1;39=1;43=1;48=1;53=1");
   }
 
   @Test
   public void find_by_component_key_and_metrics() throws Exception {
-    setupData("shared");
+    db.prepareDbUnit(getClass(), "shared.xml");
 
-    List<MeasureDto> results = dao.findByComponentKeyAndMetricKeys("org.struts:struts-core:src/org/struts/RequestContext.java",
-      newArrayList("ncloc", "authors_by_line"), session);
+    List<MeasureDto> results = sut.findByComponentKeyAndMetricKeys(session, "org.struts:struts-core:src/org/struts/RequestContext.java",
+      newArrayList("ncloc", "authors_by_line"));
     assertThat(results).hasSize(2);
 
-    results = dao.findByComponentKeyAndMetricKeys("org.struts:struts-core:src/org/struts/RequestContext.java", newArrayList("ncloc"), session);
+    results = sut.findByComponentKeyAndMetricKeys(session, "org.struts:struts-core:src/org/struts/RequestContext.java", newArrayList("ncloc"));
     assertThat(results).hasSize(1);
 
     MeasureDto result = results.get(0);
     assertThat(result.getId()).isEqualTo(22);
     assertThat(result.getValue()).isEqualTo(10d);
-    assertThat(result.getKey()).isEqualTo(MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc"));
+    assertThat(result.getComponentKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
+    assertThat(result.getMetricKey()).isEqualTo("ncloc");
     assertThat(result.getVariation(1)).isEqualTo(1d);
     assertThat(result.getVariation(2)).isEqualTo(2d);
     assertThat(result.getVariation(3)).isEqualTo(3d);
@@ -102,31 +109,55 @@ public class MeasureDaoTest extends AbstractDaoTestCase {
 
   @Test
   public void find_by_component_key_and_metric() throws Exception {
-    setupData("shared");
+    db.prepareDbUnit(getClass(), "shared.xml");
 
-    MeasureDto result = dao.findByComponentKeyAndMetricKey("org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc", session);
+    MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc");
     assertThat(result.getId()).isEqualTo(22);
     assertThat(result.getValue()).isEqualTo(10d);
-    assertThat(result.getKey()).isEqualTo(MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc"));
+    assertThat(result.getMetricKey()).isEqualTo("ncloc");
+    assertThat(result.getComponentKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(result.getVariation(1)).isEqualTo(1d);
     assertThat(result.getVariation(2)).isEqualTo(2d);
     assertThat(result.getVariation(3)).isEqualTo(3d);
     assertThat(result.getVariation(4)).isEqualTo(4d);
     assertThat(result.getVariation(5)).isEqualTo(-5d);
 
-    assertThat(dao.findByComponentKeyAndMetricKey("org.struts:struts-core:src/org/struts/RequestContext.java", "unknown", session)).isNull();
+    assertThat(sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "unknown")).isNull();
   }
 
   @Test
   public void exists_by_key() throws Exception {
-    setupData("shared");
+    db.prepareDbUnit(getClass(), "shared.xml");
 
-    assertThat(dao.existsByKey(MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc"), session)).isTrue();
-    assertThat(dao.existsByKey(MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "unknown"), session)).isFalse();
+    assertThat(sut.existsByKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc")).isTrue();
+    assertThat(sut.existsByKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "unknown")).isFalse();
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void insert() throws Exception {
-    dao.insert(session, MeasureDto.createFor(MeasureKey.of("org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc")));
+    db.prepareDbUnit(getClass(), "empty.xml");
+
+    sut.insert(session, new MeasureDto()
+      .setSnapshotId(2L)
+      .setMetricId(3)
+      .setCharacteristicId(4)
+      .setRuleId(5)
+      .setComponentId(6L)
+      .setValue(2.0d)
+      .setData("measure-value")
+      .setTendency(42)
+      .setSeverity(Severity.INFO)
+      .setVariation(1, 1.0d)
+      .setVariation(2, 2.0d)
+      .setVariation(3, 3.0d)
+      .setVariation(4, 4.0d)
+      .setVariation(5, 5.0d)
+      .setAlertStatus("alert")
+      .setAlertText("alert-text")
+      .setDescription("measure-description")
+      );
+    session.commit();
+
+    db.assertDbUnit(getClass(), "insert-result.xml", "project_measures");
   }
 }
index 77c359e228c33b476fccedf52a272a3f37aebb5e..468f6cdd89b7abebe0ababac63de99728887d48c 100644 (file)
@@ -27,7 +27,6 @@ import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.sonar.api.measures.CoreMetrics;
 import org.sonar.api.web.UserRole;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.server.db.DbClient;
 import org.sonar.server.exceptions.ForbiddenException;
@@ -41,31 +40,23 @@ import java.util.List;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
 import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.*;
 
 @RunWith(MockitoJUnitRunner.class)
 public class SourceServiceTest {
 
+  static final String PROJECT_KEY = "org.sonar.sample";
+  static final String COMPONENT_UUID = "abc123";
   @Mock
   DbSession session;
-
   @Mock
   HtmlSourceDecorator sourceDecorator;
-
   @Mock
   MeasureDao measureDao;
-
   @Mock
   SourceLineIndex sourceLineIndex;
-
-  static final String PROJECT_KEY = "org.sonar.sample";
-  static final String COMPONENT_UUID = "abc123";
-
   SourceService service;
 
   @Before
@@ -104,7 +95,7 @@ public class SourceServiceTest {
   @Test
   public void get_scm_author_data() throws Exception {
     service.getScmAuthorData(COMPONENT_UUID);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_UUID, CoreMetrics.SCM_AUTHORS_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_UUID, CoreMetrics.SCM_AUTHORS_BY_LINE_KEY);
   }
 
   @Test
@@ -122,7 +113,7 @@ public class SourceServiceTest {
   @Test
   public void not_get_scm_author_data_if_no_data() throws Exception {
     MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, PROJECT_KEY, COMPONENT_UUID);
-    when(measureDao.getNullableByKey(eq(session), any(MeasureKey.class))).thenReturn(null);
+    when(measureDao.findByComponentKeyAndMetricKey(eq(session), anyString(), anyString())).thenReturn(null);
     assertThat(service.getScmAuthorData(COMPONENT_UUID)).isNull();
   }
 
@@ -130,13 +121,13 @@ public class SourceServiceTest {
   public void get_scm_date_data() throws Exception {
     MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, PROJECT_KEY, COMPONENT_UUID);
     service.getScmDateData(COMPONENT_UUID);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_UUID, CoreMetrics.SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_UUID, CoreMetrics.SCM_LAST_COMMIT_DATETIMES_BY_LINE_KEY);
   }
 
   @Test
   public void not_get_scm_date_data_if_no_data() throws Exception {
     MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, PROJECT_KEY, COMPONENT_UUID);
-    when(measureDao.getNullableByKey(eq(session), any(MeasureKey.class))).thenReturn(null);
+    when(measureDao.findByComponentKeyAndMetricKey(eq(session), anyString(), anyString())).thenReturn(null);
     assertThat(service.getScmDateData(COMPONENT_UUID)).isNull();
   }
 
index 7bf569fe196d1c863993557d6755464e6bdb6f1b..e514c411f6bf326f68c83d0f90354133aef0b2d1 100644 (file)
@@ -30,7 +30,6 @@ import org.sonar.api.measures.CoreMetrics;
 import org.sonar.api.test.MutableTestable;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.component.SnapshotPerspectives;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.MyBatis;
 import org.sonar.server.measure.persistence.MeasureDao;
@@ -45,20 +44,15 @@ import static org.mockito.Mockito.*;
 @RunWith(MockitoJUnitRunner.class)
 public class CoverageServiceTest {
 
+  static final String COMPONENT_KEY = "org.sonar.sample:Sample";
   @org.junit.Rule
   public ExpectedException thrown = ExpectedException.none();
-
   @Mock
   DbSession session;
-
   @Mock
   MeasureDao measureDao;
-
   @Mock
   SnapshotPerspectives snapshotPerspectives;
-
-  static final String COMPONENT_KEY = "org.sonar.sample:Sample";
-
   CoverageService service;
 
   @Before
@@ -79,43 +73,43 @@ public class CoverageServiceTest {
   @Test
   public void get_hits_data() throws Exception {
     service.getHits(COMPONENT_KEY, CoverageService.TYPE.UT);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY);
 
     service.getHits(COMPONENT_KEY, CoverageService.TYPE.IT);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.IT_COVERAGE_LINE_HITS_DATA_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.IT_COVERAGE_LINE_HITS_DATA_KEY);
 
     service.getHits(COMPONENT_KEY, CoverageService.TYPE.OVERALL);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.OVERALL_COVERAGE_LINE_HITS_DATA_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.OVERALL_COVERAGE_LINE_HITS_DATA_KEY);
   }
 
   @Test
   public void not_get_hits_data_if_no_data() throws Exception {
-    when(measureDao.getNullableByKey(eq(session), any(MeasureKey.class))).thenReturn(null);
+    when(measureDao.findByComponentKeyAndMetricKey(eq(session), anyString(), anyString())).thenReturn(null);
     assertThat(service.getHits(COMPONENT_KEY, CoverageService.TYPE.UT)).isEqualTo(Collections.emptyMap());
   }
 
   @Test
   public void get_conditions_data() throws Exception {
     service.getConditions(COMPONENT_KEY, CoverageService.TYPE.UT);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.CONDITIONS_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.CONDITIONS_BY_LINE_KEY);
 
     service.getConditions(COMPONENT_KEY, CoverageService.TYPE.IT);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.IT_CONDITIONS_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.IT_CONDITIONS_BY_LINE_KEY);
 
     service.getConditions(COMPONENT_KEY, CoverageService.TYPE.OVERALL);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.OVERALL_CONDITIONS_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.OVERALL_CONDITIONS_BY_LINE_KEY);
   }
 
   @Test
   public void get_covered_conditions_data() throws Exception {
     service.getCoveredConditions(COMPONENT_KEY, CoverageService.TYPE.UT);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.COVERED_CONDITIONS_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.COVERED_CONDITIONS_BY_LINE_KEY);
 
     service.getCoveredConditions(COMPONENT_KEY, CoverageService.TYPE.IT);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE_KEY);
 
     service.getCoveredConditions(COMPONENT_KEY, CoverageService.TYPE.OVERALL);
-    verify(measureDao).getNullableByKey(session, MeasureKey.of(COMPONENT_KEY, CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE_KEY));
+    verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE_KEY);
   }
 
   @Test
index 9f7648e975a66afc61fe6588dac40305785d6f18..0c1117c3fef95951f9e13fba6c5b8f928d75cdac 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.api.test.TestCase;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.component.SnapshotPerspectives;
 import org.sonar.core.measure.db.MeasureDto;
-import org.sonar.core.measure.db.MeasureKey;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.server.db.DbClient;
 import org.sonar.server.measure.persistence.MeasureDao;
@@ -96,8 +95,10 @@ public class TestsShowActionTest {
   public void show_from_test_data() throws Exception {
     MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, "SonarQube", TEST_PLAN_KEY);
 
-    when(measureDao.findByComponentKeyAndMetricKey(TEST_PLAN_KEY, "test_data", session)).thenReturn(MeasureDto.createFor(MeasureKey.of(TEST_PLAN_KEY, "test_data"))
-      .setTextValue("<tests-details>" +
+    when(measureDao.findByComponentKeyAndMetricKey(session, TEST_PLAN_KEY, "test_data")).thenReturn(new MeasureDto()
+      .setComponentKey(TEST_PLAN_KEY)
+      .setMetricKey("test_data")
+      .setData("<tests-details>" +
         "<testcase status=\"ok\" time=\"10\" name=\"test1\"/>" +
         "<testcase status=\"error\" time=\"97\" name=\"test2\">" +
         "<error message=\"expected:&lt;true&gt; but was:&lt;false&gt;\">" +
@@ -121,10 +122,13 @@ public class TestsShowActionTest {
   public void show_from_test_data_with_a_time_in_float() throws Exception {
     MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, "SonarQube", TEST_PLAN_KEY);
 
-    when(measureDao.findByComponentKeyAndMetricKey(TEST_PLAN_KEY, "test_data", session)).thenReturn(MeasureDto.createFor(MeasureKey.of(TEST_PLAN_KEY, "test_data"))
-      .setTextValue("<tests-details>" +
-        "<testcase status=\"ok\" time=\"12.5\" name=\"test1\"/>" +
-        "</tests-details>"));
+    when(measureDao.findByComponentKeyAndMetricKey(session, TEST_PLAN_KEY, "test_data")).thenReturn(
+      new MeasureDto()
+        .setComponentKey(TEST_PLAN_KEY)
+        .setMetricKey("test_data")
+        .setData("<tests-details>" +
+          "<testcase status=\"ok\" time=\"12.5\" name=\"test1\"/>" +
+          "</tests-details>"));
 
     WsTester.TestRequest request = tester.newGetRequest("api/tests", "show").setParam("key", TEST_PLAN_KEY);
 
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/measure/MetricCacheTest/metrics.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/measure/MetricCacheTest/metrics.xml
new file mode 100644 (file)
index 0000000..dcfc885
--- /dev/null
@@ -0,0 +1,13 @@
+<dataset>
+  <!-- enabled metrics -->
+  <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]"
+           short_name="" enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]"
+           direction="0" delete_historical_data="[null]" hidden="false"/>
+  <metrics id="2" name="coverage" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]"
+           short_name="" enabled="true" worst_value="0" optimized_best_value="true" best_value="100" direction="1"
+           delete_historical_data="[null]" hidden="false"/>
+  <!-- disabled metric -->
+  <metrics id="3" name="complexity" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]"
+           short_name="" enabled="false" worst_value="0" optimized_best_value="true" best_value="100" direction="1"
+           delete_historical_data="[null]" hidden="false"/>
+</dataset>
\ No newline at end of file
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/PersistMeasuresStepTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/PersistMeasuresStepTest/shared.xml
new file mode 100644 (file)
index 0000000..e9cb468
--- /dev/null
@@ -0,0 +1,5 @@
+<dataset>
+  <rules id="987" tags="[null]" system_tags="[null]" name="[null]" plugin_rule_key="AvoidCycles" plugin_config_key="[null]" plugin_name="[null]"/>
+  <metrics id="654" delete_historical_data="[null]" name="coverage" VAL_TYPE="INT" DESCRIPTION="[null]"  domain="[null]" short_name=""
+           enabled="true" worst_value="0" optimized_best_value="true" best_value="100" direction="1" hidden="false"/>
+</dataset>
\ No newline at end of file
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/empty.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/empty.xml
new file mode 100644 (file)
index 0000000..dda1882
--- /dev/null
@@ -0,0 +1,3 @@
+<dataset>
+  <project_measures/>
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/insert-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/insert-result.xml
new file mode 100644 (file)
index 0000000..6714a2a
--- /dev/null
@@ -0,0 +1,27 @@
+<dataset>
+  <project_measures
+      id="1"
+      snapshot_id="2"
+      metric_id="3"
+      characteristic_id="4"
+      rule_id="5"
+      project_id="6"
+      person_id="[null]"
+      value="2.0"
+      text_value="measure-value"
+      tendency="42"
+      rule_priority="0"
+      measure_date="[null]"
+      measure_data="[null]"
+      variation_value_1="1.0"
+      variation_value_2="2.0"
+      variation_value_3="3.0"
+      variation_value_4="4.0"
+      variation_value_5="5.0"
+      alert_status="alert"
+      alert_text="alert-text"
+      url="[null]"
+      description="measure-description"
+      rules_category_id="[null]"
+      />
+</dataset>
index 041ca607f351e8e47675f4dfe3907631dd852bc7..a82f76dd770780e2500023315f897cb45718efa1 100644 (file)
@@ -8,7 +8,7 @@
 
   <snapshots id="5" project_id="1" islast="[true]" />
 
-  <project_measures id="20" snapshot_id="5" metric_id="10" value="[null]" text_value="[null]" measure_data="MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OQ=="
+  <project_measures id="20" snapshot_id="5" metric_id="10" value="[null]" text_value="0123456789012345678901234567890123456789" measure_data="[null]"
                     variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" />
   <project_measures id="21" snapshot_id="5" metric_id="11" value="[null]" text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" measure_data="[null]"
                     variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" />
index 0c5b8965216146d39fcb1894755afba4001b8568..fe5456aaf32cae9e3d6fd98d4313c156957a2c31 100644 (file)
@@ -235,6 +235,115 @@ public final class Constants {
     // @@protoc_insertion_point(enum_scope:ComponentType)
   }
 
+  /**
+   * Protobuf enum {@code MeasureValueType}
+   */
+  public enum MeasureValueType
+      implements com.google.protobuf.ProtocolMessageEnum {
+    /**
+     * <code>INT = 0;</code>
+     */
+    INT(0, 0),
+    /**
+     * <code>LONG = 1;</code>
+     */
+    LONG(1, 1),
+    /**
+     * <code>DOUBLE = 2;</code>
+     */
+    DOUBLE(2, 2),
+    /**
+     * <code>BOOLEAN = 3;</code>
+     */
+    BOOLEAN(3, 3),
+    /**
+     * <code>STRING = 4;</code>
+     */
+    STRING(4, 4),
+    ;
+
+    /**
+     * <code>INT = 0;</code>
+     */
+    public static final int INT_VALUE = 0;
+    /**
+     * <code>LONG = 1;</code>
+     */
+    public static final int LONG_VALUE = 1;
+    /**
+     * <code>DOUBLE = 2;</code>
+     */
+    public static final int DOUBLE_VALUE = 2;
+    /**
+     * <code>BOOLEAN = 3;</code>
+     */
+    public static final int BOOLEAN_VALUE = 3;
+    /**
+     * <code>STRING = 4;</code>
+     */
+    public static final int STRING_VALUE = 4;
+
+
+    public final int getNumber() { return value; }
+
+    public static MeasureValueType valueOf(int value) {
+      switch (value) {
+        case 0: return INT;
+        case 1: return LONG;
+        case 2: return DOUBLE;
+        case 3: return BOOLEAN;
+        case 4: return STRING;
+        default: return null;
+      }
+    }
+
+    public static com.google.protobuf.Internal.EnumLiteMap<MeasureValueType>
+        internalGetValueMap() {
+      return internalValueMap;
+    }
+    private static com.google.protobuf.Internal.EnumLiteMap<MeasureValueType>
+        internalValueMap =
+          new com.google.protobuf.Internal.EnumLiteMap<MeasureValueType>() {
+            public MeasureValueType findValueByNumber(int number) {
+              return MeasureValueType.valueOf(number);
+            }
+          };
+
+    public final com.google.protobuf.Descriptors.EnumValueDescriptor
+        getValueDescriptor() {
+      return getDescriptor().getValues().get(index);
+    }
+    public final com.google.protobuf.Descriptors.EnumDescriptor
+        getDescriptorForType() {
+      return getDescriptor();
+    }
+    public static final com.google.protobuf.Descriptors.EnumDescriptor
+        getDescriptor() {
+      return org.sonar.batch.protocol.Constants.getDescriptor().getEnumTypes().get(2);
+    }
+
+    private static final MeasureValueType[] VALUES = values();
+
+    public static MeasureValueType valueOf(
+        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+      if (desc.getType() != getDescriptor()) {
+        throw new java.lang.IllegalArgumentException(
+          "EnumValueDescriptor is not for this type.");
+      }
+      return VALUES[desc.getIndex()];
+    }
+
+    private final int index;
+    private final int value;
+
+    private MeasureValueType(int index, int value) {
+      this.index = index;
+      this.value = value;
+    }
+
+    // @@protoc_insertion_point(enum_scope:MeasureValueType)
+  }
+
   /**
    * Protobuf enum {@code EventCategory}
    *
@@ -296,7 +405,7 @@ public final class Constants {
     }
     public static final com.google.protobuf.Descriptors.EnumDescriptor
         getDescriptor() {
-      return org.sonar.batch.protocol.Constants.getDescriptor().getEnumTypes().get(2);
+      return org.sonar.batch.protocol.Constants.getDescriptor().getEnumTypes().get(3);
     }
 
     private static final EventCategory[] VALUES = values();
@@ -405,7 +514,7 @@ public final class Constants {
     }
     public static final com.google.protobuf.Descriptors.EnumDescriptor
         getDescriptor() {
-      return org.sonar.batch.protocol.Constants.getDescriptor().getEnumTypes().get(3);
+      return org.sonar.batch.protocol.Constants.getDescriptor().getEnumTypes().get(4);
     }
 
     private static final ComponentLinkType[] VALUES = values();
@@ -443,20 +552,21 @@ public final class Constants {
       "\t\n\005MINOR\020\001\022\t\n\005MAJOR\020\002\022\014\n\010CRITICAL\020\003\022\013\n\007B" +
       "LOCKER\020\004*X\n\rComponentType\022\013\n\007PROJECT\020\000\022\n" +
       "\n\006MODULE\020\001\022\r\n\tDIRECTORY\020\002\022\010\n\004FILE\020\003\022\010\n\004V" +
-      "IEW\020\004\022\013\n\007SUBVIEW\020\005*\'\n\rEventCategory\022\t\n\005A" +
-      "LERT\020\000\022\013\n\007PROFILE\020\001*F\n\021ComponentLinkType" +
-      "\022\010\n\004HOME\020\000\022\007\n\003SCM\020\001\022\013\n\007SCM_DEV\020\002\022\t\n\005ISSU" +
-      "E\020\003\022\006\n\002CI\020\004B\034\n\030org.sonar.batch.protocolH" +
-      "\001"
+      "IEW\020\004\022\013\n\007SUBVIEW\020\005*J\n\020MeasureValueType\022\007" +
+      "\n\003INT\020\000\022\010\n\004LONG\020\001\022\n\n\006DOUBLE\020\002\022\013\n\007BOOLEAN" +
+      "\020\003\022\n\n\006STRING\020\004*\'\n\rEventCategory\022\t\n\005ALERT" +
+      "\020\000\022\013\n\007PROFILE\020\001*F\n\021ComponentLinkType\022\010\n\004" +
+      "HOME\020\000\022\007\n\003SCM\020\001\022\013\n\007SCM_DEV\020\002\022\t\n\005ISSUE\020\003\022" +
+      "\006\n\002CI\020\004B\034\n\030org.sonar.batch.protocolH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
-      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
-        public com.google.protobuf.ExtensionRegistry assignDescriptors(
-            com.google.protobuf.Descriptors.FileDescriptor root) {
-          descriptor = root;
-          return null;
-        }
-      };
+        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
+          public com.google.protobuf.ExtensionRegistry assignDescriptors(
+              com.google.protobuf.Descriptors.FileDescriptor root) {
+            descriptor = root;
+            return null;
+          }
+        };
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
index 6ecbcc83d312c5e7df763b982cde1cfea4e7e11f..464e4d9bb03ae66fc316470a2faf6dcc562a6e74 100644 (file)
@@ -8,10 +8,10 @@ public final class BatchInput {
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
   }
-  public interface ServerIssueOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface ServerIssueOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:ServerIssue)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional string key = 1;
     /**
      * <code>optional string key = 1;</code>
      */
@@ -26,7 +26,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getKeyBytes();
 
-    // optional string module_key = 2;
     /**
      * <code>optional string module_key = 2;</code>
      */
@@ -41,7 +40,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getModuleKeyBytes();
 
-    // optional string path = 3;
     /**
      * <code>optional string path = 3;</code>
      */
@@ -56,7 +54,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getPathBytes();
 
-    // optional string rule_repository = 4;
     /**
      * <code>optional string rule_repository = 4;</code>
      */
@@ -71,7 +68,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getRuleRepositoryBytes();
 
-    // optional string rule_key = 5;
     /**
      * <code>optional string rule_key = 5;</code>
      */
@@ -86,7 +82,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getRuleKeyBytes();
 
-    // optional int32 line = 6;
     /**
      * <code>optional int32 line = 6;</code>
      */
@@ -96,7 +91,6 @@ public final class BatchInput {
      */
     int getLine();
 
-    // optional string msg = 7;
     /**
      * <code>optional string msg = 7;</code>
      */
@@ -111,7 +105,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getMsgBytes();
 
-    // optional .Severity severity = 8;
     /**
      * <code>optional .Severity severity = 8;</code>
      */
@@ -121,7 +114,6 @@ public final class BatchInput {
      */
     org.sonar.batch.protocol.Constants.Severity getSeverity();
 
-    // optional bool manual_severity = 9;
     /**
      * <code>optional bool manual_severity = 9;</code>
      */
@@ -131,7 +123,6 @@ public final class BatchInput {
      */
     boolean getManualSeverity();
 
-    // optional string resolution = 10;
     /**
      * <code>optional string resolution = 10;</code>
      */
@@ -146,7 +137,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getResolutionBytes();
 
-    // optional string status = 11;
     /**
      * <code>optional string status = 11;</code>
      */
@@ -161,7 +151,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getStatusBytes();
 
-    // optional string checksum = 12;
     /**
      * <code>optional string checksum = 12;</code>
      */
@@ -176,7 +165,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getChecksumBytes();
 
-    // optional string assignee_login = 13;
     /**
      * <code>optional string assignee_login = 13;</code>
      */
@@ -191,7 +179,6 @@ public final class BatchInput {
     com.google.protobuf.ByteString
         getAssigneeLoginBytes();
 
-    // optional int64 creation_date = 14;
     /**
      * <code>optional int64 creation_date = 14;</code>
      */
@@ -205,8 +192,9 @@ public final class BatchInput {
    * Protobuf type {@code ServerIssue}
    */
   public static final class ServerIssue extends
-      com.google.protobuf.GeneratedMessage
-      implements ServerIssueOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:ServerIssue)
+      ServerIssueOrBuilder {
     // Use ServerIssue.newBuilder() to construct.
     private ServerIssue(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -253,28 +241,33 @@ public final class BatchInput {
               break;
             }
             case 10: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000001;
-              key_ = input.readBytes();
+              key_ = bs;
               break;
             }
             case 18: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              moduleKey_ = input.readBytes();
+              moduleKey_ = bs;
               break;
             }
             case 26: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000004;
-              path_ = input.readBytes();
+              path_ = bs;
               break;
             }
             case 34: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000008;
-              ruleRepository_ = input.readBytes();
+              ruleRepository_ = bs;
               break;
             }
             case 42: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000010;
-              ruleKey_ = input.readBytes();
+              ruleKey_ = bs;
               break;
             }
             case 48: {
@@ -283,8 +276,9 @@ public final class BatchInput {
               break;
             }
             case 58: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000040;
-              msg_ = input.readBytes();
+              msg_ = bs;
               break;
             }
             case 64: {
@@ -304,23 +298,27 @@ public final class BatchInput {
               break;
             }
             case 82: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000200;
-              resolution_ = input.readBytes();
+              resolution_ = bs;
               break;
             }
             case 90: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000400;
-              status_ = input.readBytes();
+              status_ = bs;
               break;
             }
             case 98: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000800;
-              checksum_ = input.readBytes();
+              checksum_ = bs;
               break;
             }
             case 106: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00001000;
-              assigneeLogin_ = input.readBytes();
+              assigneeLogin_ = bs;
               break;
             }
             case 112: {
@@ -368,7 +366,6 @@ public final class BatchInput {
     }
 
     private int bitField0_;
-    // optional string key = 1;
     public static final int KEY_FIELD_NUMBER = 1;
     private java.lang.Object key_;
     /**
@@ -411,7 +408,6 @@ public final class BatchInput {
       }
     }
 
-    // optional string module_key = 2;
     public static final int MODULE_KEY_FIELD_NUMBER = 2;
     private java.lang.Object moduleKey_;
     /**
@@ -454,7 +450,6 @@ public final class BatchInput {
       }
     }
 
-    // optional string path = 3;
     public static final int PATH_FIELD_NUMBER = 3;
     private java.lang.Object path_;
     /**
@@ -497,7 +492,6 @@ public final class BatchInput {
       }
     }
 
-    // optional string rule_repository = 4;
     public static final int RULE_REPOSITORY_FIELD_NUMBER = 4;
     private java.lang.Object ruleRepository_;
     /**
@@ -540,7 +534,6 @@ public final class BatchInput {
       }
     }
 
-    // optional string rule_key = 5;
     public static final int RULE_KEY_FIELD_NUMBER = 5;
     private java.lang.Object ruleKey_;
     /**
@@ -583,7 +576,6 @@ public final class BatchInput {
       }
     }
 
-    // optional int32 line = 6;
     public static final int LINE_FIELD_NUMBER = 6;
     private int line_;
     /**
@@ -599,7 +591,6 @@ public final class BatchInput {
       return line_;
     }
 
-    // optional string msg = 7;
     public static final int MSG_FIELD_NUMBER = 7;
     private java.lang.Object msg_;
     /**
@@ -642,7 +633,6 @@ public final class BatchInput {
       }
     }
 
-    // optional .Severity severity = 8;
     public static final int SEVERITY_FIELD_NUMBER = 8;
     private org.sonar.batch.protocol.Constants.Severity severity_;
     /**
@@ -658,7 +648,6 @@ public final class BatchInput {
       return severity_;
     }
 
-    // optional bool manual_severity = 9;
     public static final int MANUAL_SEVERITY_FIELD_NUMBER = 9;
     private boolean manualSeverity_;
     /**
@@ -674,7 +663,6 @@ public final class BatchInput {
       return manualSeverity_;
     }
 
-    // optional string resolution = 10;
     public static final int RESOLUTION_FIELD_NUMBER = 10;
     private java.lang.Object resolution_;
     /**
@@ -717,7 +705,6 @@ public final class BatchInput {
       }
     }
 
-    // optional string status = 11;
     public static final int STATUS_FIELD_NUMBER = 11;
     private java.lang.Object status_;
     /**
@@ -760,7 +747,6 @@ public final class BatchInput {
       }
     }
 
-    // optional string checksum = 12;
     public static final int CHECKSUM_FIELD_NUMBER = 12;
     private java.lang.Object checksum_;
     /**
@@ -803,7 +789,6 @@ public final class BatchInput {
       }
     }
 
-    // optional string assignee_login = 13;
     public static final int ASSIGNEE_LOGIN_FIELD_NUMBER = 13;
     private java.lang.Object assigneeLogin_;
     /**
@@ -846,7 +831,6 @@ public final class BatchInput {
       }
     }
 
-    // optional int64 creation_date = 14;
     public static final int CREATION_DATE_FIELD_NUMBER = 14;
     private long creationDate_;
     /**
@@ -881,7 +865,8 @@ public final class BatchInput {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -1079,8 +1064,9 @@ public final class BatchInput {
      * Protobuf type {@code ServerIssue}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.batch.protocol.input.BatchInput.ServerIssueOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:ServerIssue)
+        org.sonar.batch.protocol.input.BatchInput.ServerIssueOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.batch.protocol.input.BatchInput.internal_static_ServerIssue_descriptor;
@@ -1330,7 +1316,6 @@ public final class BatchInput {
       }
       private int bitField0_;
 
-      // optional string key = 1;
       private java.lang.Object key_ = "";
       /**
        * <code>optional string key = 1;</code>
@@ -1344,9 +1329,12 @@ public final class BatchInput {
       public java.lang.String getKey() {
         java.lang.Object ref = key_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          key_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            key_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1404,7 +1392,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string module_key = 2;
       private java.lang.Object moduleKey_ = "";
       /**
        * <code>optional string module_key = 2;</code>
@@ -1418,9 +1405,12 @@ public final class BatchInput {
       public java.lang.String getModuleKey() {
         java.lang.Object ref = moduleKey_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          moduleKey_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            moduleKey_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1478,7 +1468,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string path = 3;
       private java.lang.Object path_ = "";
       /**
        * <code>optional string path = 3;</code>
@@ -1492,9 +1481,12 @@ public final class BatchInput {
       public java.lang.String getPath() {
         java.lang.Object ref = path_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          path_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            path_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1552,7 +1544,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string rule_repository = 4;
       private java.lang.Object ruleRepository_ = "";
       /**
        * <code>optional string rule_repository = 4;</code>
@@ -1566,9 +1557,12 @@ public final class BatchInput {
       public java.lang.String getRuleRepository() {
         java.lang.Object ref = ruleRepository_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          ruleRepository_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            ruleRepository_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1626,7 +1620,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string rule_key = 5;
       private java.lang.Object ruleKey_ = "";
       /**
        * <code>optional string rule_key = 5;</code>
@@ -1640,9 +1633,12 @@ public final class BatchInput {
       public java.lang.String getRuleKey() {
         java.lang.Object ref = ruleKey_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          ruleKey_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            ruleKey_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1700,7 +1696,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional int32 line = 6;
       private int line_ ;
       /**
        * <code>optional int32 line = 6;</code>
@@ -1733,7 +1728,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string msg = 7;
       private java.lang.Object msg_ = "";
       /**
        * <code>optional string msg = 7;</code>
@@ -1747,9 +1741,12 @@ public final class BatchInput {
       public java.lang.String getMsg() {
         java.lang.Object ref = msg_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          msg_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            msg_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1807,7 +1804,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional .Severity severity = 8;
       private org.sonar.batch.protocol.Constants.Severity severity_ = org.sonar.batch.protocol.Constants.Severity.INFO;
       /**
        * <code>optional .Severity severity = 8;</code>
@@ -1843,7 +1839,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional bool manual_severity = 9;
       private boolean manualSeverity_ ;
       /**
        * <code>optional bool manual_severity = 9;</code>
@@ -1876,7 +1871,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string resolution = 10;
       private java.lang.Object resolution_ = "";
       /**
        * <code>optional string resolution = 10;</code>
@@ -1890,9 +1884,12 @@ public final class BatchInput {
       public java.lang.String getResolution() {
         java.lang.Object ref = resolution_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          resolution_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            resolution_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1950,7 +1947,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string status = 11;
       private java.lang.Object status_ = "";
       /**
        * <code>optional string status = 11;</code>
@@ -1964,9 +1960,12 @@ public final class BatchInput {
       public java.lang.String getStatus() {
         java.lang.Object ref = status_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          status_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            status_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2024,7 +2023,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string checksum = 12;
       private java.lang.Object checksum_ = "";
       /**
        * <code>optional string checksum = 12;</code>
@@ -2038,9 +2036,12 @@ public final class BatchInput {
       public java.lang.String getChecksum() {
         java.lang.Object ref = checksum_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          checksum_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            checksum_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2098,7 +2099,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional string assignee_login = 13;
       private java.lang.Object assigneeLogin_ = "";
       /**
        * <code>optional string assignee_login = 13;</code>
@@ -2112,9 +2112,12 @@ public final class BatchInput {
       public java.lang.String getAssigneeLogin() {
         java.lang.Object ref = assigneeLogin_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          assigneeLogin_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            assigneeLogin_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2172,7 +2175,6 @@ public final class BatchInput {
         return this;
       }
 
-      // optional int64 creation_date = 14;
       private long creationDate_ ;
       /**
        * <code>optional int64 creation_date = 14;</code>
@@ -2216,7 +2218,7 @@ public final class BatchInput {
     // @@protoc_insertion_point(class_scope:ServerIssue)
   }
 
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_ServerIssue_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
@@ -2241,24 +2243,25 @@ public final class BatchInput {
       " \001(\003B\"\n\036org.sonar.batch.protocol.inputH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
-      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
-        public com.google.protobuf.ExtensionRegistry assignDescriptors(
-            com.google.protobuf.Descriptors.FileDescriptor root) {
-          descriptor = root;
-          internal_static_ServerIssue_descriptor =
-            getDescriptor().getMessageTypes().get(0);
-          internal_static_ServerIssue_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_ServerIssue_descriptor,
-              new java.lang.String[] { "Key", "ModuleKey", "Path", "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "ManualSeverity", "Resolution", "Status", "Checksum", "AssigneeLogin", "CreationDate", });
-          return null;
-        }
-      };
+        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
+          public com.google.protobuf.ExtensionRegistry assignDescriptors(
+              com.google.protobuf.Descriptors.FileDescriptor root) {
+            descriptor = root;
+            return null;
+          }
+        };
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
           org.sonar.batch.protocol.Constants.getDescriptor(),
         }, assigner);
+    internal_static_ServerIssue_descriptor =
+      getDescriptor().getMessageTypes().get(0);
+    internal_static_ServerIssue_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_ServerIssue_descriptor,
+        new java.lang.String[] { "Key", "ModuleKey", "Path", "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "ManualSeverity", "Resolution", "Status", "Checksum", "AssigneeLogin", "CreationDate", });
+    org.sonar.batch.protocol.Constants.getDescriptor();
   }
 
   // @@protoc_insertion_point(outer_class_scope)
index 194512a355f1720f104255307970e252151e75e9..3cb6acd48be42fbe0f9268bb934342b6d4888720 100644 (file)
@@ -8,10 +8,10 @@ public final class BatchReport {
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
   }
-  public interface MetadataOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface MetadataOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:Metadata)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional int64 analysis_date = 1;
     /**
      * <code>optional int64 analysis_date = 1;</code>
      */
@@ -21,7 +21,6 @@ public final class BatchReport {
      */
     long getAnalysisDate();
 
-    // optional string project_key = 2;
     /**
      * <code>optional string project_key = 2;</code>
      */
@@ -36,7 +35,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getProjectKeyBytes();
 
-    // optional int32 root_component_ref = 3;
     /**
      * <code>optional int32 root_component_ref = 3;</code>
      */
@@ -46,7 +44,6 @@ public final class BatchReport {
      */
     int getRootComponentRef();
 
-    // optional int64 snapshot_id = 4;
     /**
      * <code>optional int64 snapshot_id = 4;</code>
      *
@@ -64,7 +61,6 @@ public final class BatchReport {
      */
     long getSnapshotId();
 
-    // optional int32 deleted_components_count = 5;
     /**
      * <code>optional int32 deleted_components_count = 5;</code>
      */
@@ -78,8 +74,9 @@ public final class BatchReport {
    * Protobuf type {@code Metadata}
    */
   public static final class Metadata extends
-      com.google.protobuf.GeneratedMessage
-      implements MetadataOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:Metadata)
+      MetadataOrBuilder {
     // Use Metadata.newBuilder() to construct.
     private Metadata(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -131,8 +128,9 @@ public final class BatchReport {
               break;
             }
             case 18: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              projectKey_ = input.readBytes();
+              projectKey_ = bs;
               break;
             }
             case 24: {
@@ -190,7 +188,6 @@ public final class BatchReport {
     }
 
     private int bitField0_;
-    // optional int64 analysis_date = 1;
     public static final int ANALYSIS_DATE_FIELD_NUMBER = 1;
     private long analysisDate_;
     /**
@@ -206,7 +203,6 @@ public final class BatchReport {
       return analysisDate_;
     }
 
-    // optional string project_key = 2;
     public static final int PROJECT_KEY_FIELD_NUMBER = 2;
     private java.lang.Object projectKey_;
     /**
@@ -249,7 +245,6 @@ public final class BatchReport {
       }
     }
 
-    // optional int32 root_component_ref = 3;
     public static final int ROOT_COMPONENT_REF_FIELD_NUMBER = 3;
     private int rootComponentRef_;
     /**
@@ -265,7 +260,6 @@ public final class BatchReport {
       return rootComponentRef_;
     }
 
-    // optional int64 snapshot_id = 4;
     public static final int SNAPSHOT_ID_FIELD_NUMBER = 4;
     private long snapshotId_;
     /**
@@ -289,7 +283,6 @@ public final class BatchReport {
       return snapshotId_;
     }
 
-    // optional int32 deleted_components_count = 5;
     public static final int DELETED_COMPONENTS_COUNT_FIELD_NUMBER = 5;
     private int deletedComponentsCount_;
     /**
@@ -315,7 +308,8 @@ public final class BatchReport {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -450,8 +444,9 @@ public final class BatchReport {
      * Protobuf type {@code Metadata}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.batch.protocol.output.BatchReport.MetadataOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:Metadata)
+        org.sonar.batch.protocol.output.BatchReport.MetadataOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.batch.protocol.output.BatchReport.internal_static_Metadata_descriptor;
@@ -602,7 +597,6 @@ public final class BatchReport {
       }
       private int bitField0_;
 
-      // optional int64 analysis_date = 1;
       private long analysisDate_ ;
       /**
        * <code>optional int64 analysis_date = 1;</code>
@@ -635,7 +629,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string project_key = 2;
       private java.lang.Object projectKey_ = "";
       /**
        * <code>optional string project_key = 2;</code>
@@ -649,9 +642,12 @@ public final class BatchReport {
       public java.lang.String getProjectKey() {
         java.lang.Object ref = projectKey_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          projectKey_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            projectKey_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -709,7 +705,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int32 root_component_ref = 3;
       private int rootComponentRef_ ;
       /**
        * <code>optional int32 root_component_ref = 3;</code>
@@ -742,7 +737,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int64 snapshot_id = 4;
       private long snapshotId_ ;
       /**
        * <code>optional int64 snapshot_id = 4;</code>
@@ -791,7 +785,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int32 deleted_components_count = 5;
       private int deletedComponentsCount_ ;
       /**
        * <code>optional int32 deleted_components_count = 5;</code>
@@ -835,10 +828,10 @@ public final class BatchReport {
     // @@protoc_insertion_point(class_scope:Metadata)
   }
 
-  public interface ComponentLinkOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface ComponentLinkOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:ComponentLink)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional .ComponentLinkType type = 1;
     /**
      * <code>optional .ComponentLinkType type = 1;</code>
      */
@@ -848,7 +841,6 @@ public final class BatchReport {
      */
     org.sonar.batch.protocol.Constants.ComponentLinkType getType();
 
-    // optional string href = 2;
     /**
      * <code>optional string href = 2;</code>
      */
@@ -867,8 +859,9 @@ public final class BatchReport {
    * Protobuf type {@code ComponentLink}
    */
   public static final class ComponentLink extends
-      com.google.protobuf.GeneratedMessage
-      implements ComponentLinkOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:ComponentLink)
+      ComponentLinkOrBuilder {
     // Use ComponentLink.newBuilder() to construct.
     private ComponentLink(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -926,8 +919,9 @@ public final class BatchReport {
               break;
             }
             case 18: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              href_ = input.readBytes();
+              href_ = bs;
               break;
             }
           }
@@ -970,7 +964,6 @@ public final class BatchReport {
     }
 
     private int bitField0_;
-    // optional .ComponentLinkType type = 1;
     public static final int TYPE_FIELD_NUMBER = 1;
     private org.sonar.batch.protocol.Constants.ComponentLinkType type_;
     /**
@@ -986,7 +979,6 @@ public final class BatchReport {
       return type_;
     }
 
-    // optional string href = 2;
     public static final int HREF_FIELD_NUMBER = 2;
     private java.lang.Object href_;
     /**
@@ -1036,7 +1028,8 @@ public final class BatchReport {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -1150,8 +1143,9 @@ public final class BatchReport {
      * Protobuf type {@code ComponentLink}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.batch.protocol.output.BatchReport.ComponentLinkOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:ComponentLink)
+        org.sonar.batch.protocol.output.BatchReport.ComponentLinkOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.batch.protocol.output.BatchReport.internal_static_ComponentLink_descriptor;
@@ -1275,7 +1269,6 @@ public final class BatchReport {
       }
       private int bitField0_;
 
-      // optional .ComponentLinkType type = 1;
       private org.sonar.batch.protocol.Constants.ComponentLinkType type_ = org.sonar.batch.protocol.Constants.ComponentLinkType.HOME;
       /**
        * <code>optional .ComponentLinkType type = 1;</code>
@@ -1311,7 +1304,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string href = 2;
       private java.lang.Object href_ = "";
       /**
        * <code>optional string href = 2;</code>
@@ -1325,9 +1317,12 @@ public final class BatchReport {
       public java.lang.String getHref() {
         java.lang.Object ref = href_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          href_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            href_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1396,10 +1391,10 @@ public final class BatchReport {
     // @@protoc_insertion_point(class_scope:ComponentLink)
   }
 
-  public interface EventOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface EventOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:Event)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional int32 component_ref = 1;
     /**
      * <code>optional int32 component_ref = 1;</code>
      */
@@ -1409,7 +1404,6 @@ public final class BatchReport {
      */
     int getComponentRef();
 
-    // optional string name = 2;
     /**
      * <code>optional string name = 2;</code>
      */
@@ -1424,7 +1418,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getNameBytes();
 
-    // optional string description = 3;
     /**
      * <code>optional string description = 3;</code>
      */
@@ -1439,7 +1432,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getDescriptionBytes();
 
-    // optional .EventCategory category = 4;
     /**
      * <code>optional .EventCategory category = 4;</code>
      */
@@ -1449,7 +1441,6 @@ public final class BatchReport {
      */
     org.sonar.batch.protocol.Constants.EventCategory getCategory();
 
-    // optional string event_data = 5;
     /**
      * <code>optional string event_data = 5;</code>
      */
@@ -1472,8 +1463,9 @@ public final class BatchReport {
    * </pre>
    */
   public static final class Event extends
-      com.google.protobuf.GeneratedMessage
-      implements EventOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:Event)
+      EventOrBuilder {
     // Use Event.newBuilder() to construct.
     private Event(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -1525,13 +1517,15 @@ public final class BatchReport {
               break;
             }
             case 18: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              name_ = input.readBytes();
+              name_ = bs;
               break;
             }
             case 26: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000004;
-              description_ = input.readBytes();
+              description_ = bs;
               break;
             }
             case 32: {
@@ -1546,8 +1540,9 @@ public final class BatchReport {
               break;
             }
             case 42: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000010;
-              eventData_ = input.readBytes();
+              eventData_ = bs;
               break;
             }
           }
@@ -1590,7 +1585,6 @@ public final class BatchReport {
     }
 
     private int bitField0_;
-    // optional int32 component_ref = 1;
     public static final int COMPONENT_REF_FIELD_NUMBER = 1;
     private int componentRef_;
     /**
@@ -1606,7 +1600,6 @@ public final class BatchReport {
       return componentRef_;
     }
 
-    // optional string name = 2;
     public static final int NAME_FIELD_NUMBER = 2;
     private java.lang.Object name_;
     /**
@@ -1649,7 +1642,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string description = 3;
     public static final int DESCRIPTION_FIELD_NUMBER = 3;
     private java.lang.Object description_;
     /**
@@ -1692,7 +1684,6 @@ public final class BatchReport {
       }
     }
 
-    // optional .EventCategory category = 4;
     public static final int CATEGORY_FIELD_NUMBER = 4;
     private org.sonar.batch.protocol.Constants.EventCategory category_;
     /**
@@ -1708,7 +1699,6 @@ public final class BatchReport {
       return category_;
     }
 
-    // optional string event_data = 5;
     public static final int EVENT_DATA_FIELD_NUMBER = 5;
     private java.lang.Object eventData_;
     /**
@@ -1761,7 +1751,8 @@ public final class BatchReport {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -1900,8 +1891,9 @@ public final class BatchReport {
      * </pre>
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.batch.protocol.output.BatchReport.EventOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:Event)
+        org.sonar.batch.protocol.output.BatchReport.EventOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.batch.protocol.output.BatchReport.internal_static_Event_descriptor;
@@ -2056,7 +2048,6 @@ public final class BatchReport {
       }
       private int bitField0_;
 
-      // optional int32 component_ref = 1;
       private int componentRef_ ;
       /**
        * <code>optional int32 component_ref = 1;</code>
@@ -2089,7 +2080,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string name = 2;
       private java.lang.Object name_ = "";
       /**
        * <code>optional string name = 2;</code>
@@ -2103,9 +2093,12 @@ public final class BatchReport {
       public java.lang.String getName() {
         java.lang.Object ref = name_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          name_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            name_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2163,7 +2156,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string description = 3;
       private java.lang.Object description_ = "";
       /**
        * <code>optional string description = 3;</code>
@@ -2177,9 +2169,12 @@ public final class BatchReport {
       public java.lang.String getDescription() {
         java.lang.Object ref = description_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          description_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            description_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2237,7 +2232,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional .EventCategory category = 4;
       private org.sonar.batch.protocol.Constants.EventCategory category_ = org.sonar.batch.protocol.Constants.EventCategory.ALERT;
       /**
        * <code>optional .EventCategory category = 4;</code>
@@ -2273,7 +2267,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string event_data = 5;
       private java.lang.Object eventData_ = "";
       /**
        * <code>optional string event_data = 5;</code>
@@ -2287,9 +2280,12 @@ public final class BatchReport {
       public java.lang.String getEventData() {
         java.lang.Object ref = eventData_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          eventData_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            eventData_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2358,10 +2354,10 @@ public final class BatchReport {
     // @@protoc_insertion_point(class_scope:Event)
   }
 
-  public interface ComponentOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface ComponentOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:Component)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional int32 ref = 1;
     /**
      * <code>optional int32 ref = 1;</code>
      */
@@ -2371,7 +2367,6 @@ public final class BatchReport {
      */
     int getRef();
 
-    // optional string path = 2;
     /**
      * <code>optional string path = 2;</code>
      */
@@ -2386,7 +2381,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getPathBytes();
 
-    // optional string name = 3;
     /**
      * <code>optional string name = 3;</code>
      */
@@ -2401,7 +2395,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getNameBytes();
 
-    // optional .ComponentType type = 4;
     /**
      * <code>optional .ComponentType type = 4;</code>
      */
@@ -2411,7 +2404,6 @@ public final class BatchReport {
      */
     org.sonar.batch.protocol.Constants.ComponentType getType();
 
-    // optional bool is_test = 5;
     /**
      * <code>optional bool is_test = 5;</code>
      */
@@ -2421,7 +2413,6 @@ public final class BatchReport {
      */
     boolean getIsTest();
 
-    // optional string language = 6;
     /**
      * <code>optional string language = 6;</code>
      */
@@ -2436,7 +2427,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getLanguageBytes();
 
-    // repeated int32 child_ref = 7 [packed = true];
     /**
      * <code>repeated int32 child_ref = 7 [packed = true];</code>
      */
@@ -2450,7 +2440,6 @@ public final class BatchReport {
      */
     int getChildRef(int index);
 
-    // repeated .ComponentLink link = 10;
     /**
      * <code>repeated .ComponentLink link = 10;</code>
      */
@@ -2475,7 +2464,6 @@ public final class BatchReport {
     org.sonar.batch.protocol.output.BatchReport.ComponentLinkOrBuilder getLinkOrBuilder(
         int index);
 
-    // optional string version = 12;
     /**
      * <code>optional string version = 12;</code>
      *
@@ -2502,25 +2490,32 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getVersionBytes();
 
-    // optional int64 snapshot_id = 8;
     /**
-     * <code>optional int64 snapshot_id = 8;</code>
+     * <code>optional int64 id = 13;</code>
      *
      * <pre>
      * temporary fields during development of computation stack
      * </pre>
      */
-    boolean hasSnapshotId();
+    boolean hasId();
     /**
-     * <code>optional int64 snapshot_id = 8;</code>
+     * <code>optional int64 id = 13;</code>
      *
      * <pre>
      * temporary fields during development of computation stack
      * </pre>
      */
+    long getId();
+
+    /**
+     * <code>optional int64 snapshot_id = 8;</code>
+     */
+    boolean hasSnapshotId();
+    /**
+     * <code>optional int64 snapshot_id = 8;</code>
+     */
     long getSnapshotId();
 
-    // optional string uuid = 9;
     /**
      * <code>optional string uuid = 9;</code>
      */
@@ -2535,7 +2530,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getUuidBytes();
 
-    // repeated .Event event = 11;
     /**
      * <code>repeated .Event event = 11;</code>
      */
@@ -2564,8 +2558,9 @@ public final class BatchReport {
    * Protobuf type {@code Component}
    */
   public static final class Component extends
-      com.google.protobuf.GeneratedMessage
-      implements ComponentOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:Component)
+      ComponentOrBuilder {
     // Use Component.newBuilder() to construct.
     private Component(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -2617,13 +2612,15 @@ public final class BatchReport {
               break;
             }
             case 18: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              path_ = input.readBytes();
+              path_ = bs;
               break;
             }
             case 26: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000004;
-              name_ = input.readBytes();
+              name_ = bs;
               break;
             }
             case 32: {
@@ -2643,8 +2640,9 @@ public final class BatchReport {
               break;
             }
             case 50: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000020;
-              language_ = input.readBytes();
+              language_ = bs;
               break;
             }
             case 56: {
@@ -2669,13 +2667,14 @@ public final class BatchReport {
               break;
             }
             case 64: {
-              bitField0_ |= 0x00000080;
+              bitField0_ |= 0x00000100;
               snapshotId_ = input.readInt64();
               break;
             }
             case 74: {
-              bitField0_ |= 0x00000100;
-              uuid_ = input.readBytes();
+              com.google.protobuf.ByteString bs = input.readBytes();
+              bitField0_ |= 0x00000200;
+              uuid_ = bs;
               break;
             }
             case 82: {
@@ -2687,16 +2686,22 @@ public final class BatchReport {
               break;
             }
             case 90: {
-              if (!((mutable_bitField0_ & 0x00000800) == 0x00000800)) {
+              if (!((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
                 event_ = new java.util.ArrayList<org.sonar.batch.protocol.output.BatchReport.Event>();
-                mutable_bitField0_ |= 0x00000800;
+                mutable_bitField0_ |= 0x00001000;
               }
               event_.add(input.readMessage(org.sonar.batch.protocol.output.BatchReport.Event.PARSER, extensionRegistry));
               break;
             }
             case 98: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000040;
-              version_ = input.readBytes();
+              version_ = bs;
+              break;
+            }
+            case 104: {
+              bitField0_ |= 0x00000080;
+              id_ = input.readInt64();
               break;
             }
           }
@@ -2713,7 +2718,7 @@ public final class BatchReport {
         if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
           link_ = java.util.Collections.unmodifiableList(link_);
         }
-        if (((mutable_bitField0_ & 0x00000800) == 0x00000800)) {
+        if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
           event_ = java.util.Collections.unmodifiableList(event_);
         }
         this.unknownFields = unknownFields.build();
@@ -2748,7 +2753,6 @@ public final class BatchReport {
     }
 
     private int bitField0_;
-    // optional int32 ref = 1;
     public static final int REF_FIELD_NUMBER = 1;
     private int ref_;
     /**
@@ -2764,7 +2768,6 @@ public final class BatchReport {
       return ref_;
     }
 
-    // optional string path = 2;
     public static final int PATH_FIELD_NUMBER = 2;
     private java.lang.Object path_;
     /**
@@ -2807,7 +2810,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string name = 3;
     public static final int NAME_FIELD_NUMBER = 3;
     private java.lang.Object name_;
     /**
@@ -2850,7 +2852,6 @@ public final class BatchReport {
       }
     }
 
-    // optional .ComponentType type = 4;
     public static final int TYPE_FIELD_NUMBER = 4;
     private org.sonar.batch.protocol.Constants.ComponentType type_;
     /**
@@ -2866,7 +2867,6 @@ public final class BatchReport {
       return type_;
     }
 
-    // optional bool is_test = 5;
     public static final int IS_TEST_FIELD_NUMBER = 5;
     private boolean isTest_;
     /**
@@ -2882,7 +2882,6 @@ public final class BatchReport {
       return isTest_;
     }
 
-    // optional string language = 6;
     public static final int LANGUAGE_FIELD_NUMBER = 6;
     private java.lang.Object language_;
     /**
@@ -2925,7 +2924,6 @@ public final class BatchReport {
       }
     }
 
-    // repeated int32 child_ref = 7 [packed = true];
     public static final int CHILD_REF_FIELD_NUMBER = 7;
     private java.util.List<java.lang.Integer> childRef_;
     /**
@@ -2949,7 +2947,6 @@ public final class BatchReport {
     }
     private int childRefMemoizedSerializedSize = -1;
 
-    // repeated .ComponentLink link = 10;
     public static final int LINK_FIELD_NUMBER = 10;
     private java.util.List<org.sonar.batch.protocol.output.BatchReport.ComponentLink> link_;
     /**
@@ -2985,7 +2982,6 @@ public final class BatchReport {
       return link_.get(index);
     }
 
-    // optional string version = 12;
     public static final int VERSION_FIELD_NUMBER = 12;
     private java.lang.Object version_;
     /**
@@ -3040,38 +3036,51 @@ public final class BatchReport {
       }
     }
 
-    // optional int64 snapshot_id = 8;
-    public static final int SNAPSHOT_ID_FIELD_NUMBER = 8;
-    private long snapshotId_;
+    public static final int ID_FIELD_NUMBER = 13;
+    private long id_;
     /**
-     * <code>optional int64 snapshot_id = 8;</code>
+     * <code>optional int64 id = 13;</code>
      *
      * <pre>
      * temporary fields during development of computation stack
      * </pre>
      */
-    public boolean hasSnapshotId() {
+    public boolean hasId() {
       return ((bitField0_ & 0x00000080) == 0x00000080);
     }
     /**
-     * <code>optional int64 snapshot_id = 8;</code>
+     * <code>optional int64 id = 13;</code>
      *
      * <pre>
      * temporary fields during development of computation stack
      * </pre>
      */
+    public long getId() {
+      return id_;
+    }
+
+    public static final int SNAPSHOT_ID_FIELD_NUMBER = 8;
+    private long snapshotId_;
+    /**
+     * <code>optional int64 snapshot_id = 8;</code>
+     */
+    public boolean hasSnapshotId() {
+      return ((bitField0_ & 0x00000100) == 0x00000100);
+    }
+    /**
+     * <code>optional int64 snapshot_id = 8;</code>
+     */
     public long getSnapshotId() {
       return snapshotId_;
     }
 
-    // optional string uuid = 9;
     public static final int UUID_FIELD_NUMBER = 9;
     private java.lang.Object uuid_;
     /**
      * <code>optional string uuid = 9;</code>
      */
     public boolean hasUuid() {
-      return ((bitField0_ & 0x00000100) == 0x00000100);
+      return ((bitField0_ & 0x00000200) == 0x00000200);
     }
     /**
      * <code>optional string uuid = 9;</code>
@@ -3107,7 +3116,6 @@ public final class BatchReport {
       }
     }
 
-    // repeated .Event event = 11;
     public static final int EVENT_FIELD_NUMBER = 11;
     private java.util.List<org.sonar.batch.protocol.output.BatchReport.Event> event_;
     /**
@@ -3153,6 +3161,7 @@ public final class BatchReport {
       childRef_ = java.util.Collections.emptyList();
       link_ = java.util.Collections.emptyList();
       version_ = "";
+      id_ = 0L;
       snapshotId_ = 0L;
       uuid_ = "";
       event_ = java.util.Collections.emptyList();
@@ -3160,7 +3169,8 @@ public final class BatchReport {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -3194,10 +3204,10 @@ public final class BatchReport {
       for (int i = 0; i < childRef_.size(); i++) {
         output.writeInt32NoTag(childRef_.get(i));
       }
-      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+      if (((bitField0_ & 0x00000100) == 0x00000100)) {
         output.writeInt64(8, snapshotId_);
       }
-      if (((bitField0_ & 0x00000100) == 0x00000100)) {
+      if (((bitField0_ & 0x00000200) == 0x00000200)) {
         output.writeBytes(9, getUuidBytes());
       }
       for (int i = 0; i < link_.size(); i++) {
@@ -3209,6 +3219,9 @@ public final class BatchReport {
       if (((bitField0_ & 0x00000040) == 0x00000040)) {
         output.writeBytes(12, getVersionBytes());
       }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        output.writeInt64(13, id_);
+      }
       getUnknownFields().writeTo(output);
     }
 
@@ -3256,11 +3269,11 @@ public final class BatchReport {
         }
         childRefMemoizedSerializedSize = dataSize;
       }
-      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+      if (((bitField0_ & 0x00000100) == 0x00000100)) {
         size += com.google.protobuf.CodedOutputStream
           .computeInt64Size(8, snapshotId_);
       }
-      if (((bitField0_ & 0x00000100) == 0x00000100)) {
+      if (((bitField0_ & 0x00000200) == 0x00000200)) {
         size += com.google.protobuf.CodedOutputStream
           .computeBytesSize(9, getUuidBytes());
       }
@@ -3276,6 +3289,10 @@ public final class BatchReport {
         size += com.google.protobuf.CodedOutputStream
           .computeBytesSize(12, getVersionBytes());
       }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(13, id_);
+      }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
       return size;
@@ -3358,8 +3375,9 @@ public final class BatchReport {
      * Protobuf type {@code Component}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.batch.protocol.output.BatchReport.ComponentOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:Component)
+        org.sonar.batch.protocol.output.BatchReport.ComponentOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.batch.protocol.output.BatchReport.internal_static_Component_descriptor;
@@ -3416,13 +3434,15 @@ public final class BatchReport {
         }
         version_ = "";
         bitField0_ = (bitField0_ & ~0x00000100);
-        snapshotId_ = 0L;
+        id_ = 0L;
         bitField0_ = (bitField0_ & ~0x00000200);
-        uuid_ = "";
+        snapshotId_ = 0L;
         bitField0_ = (bitField0_ & ~0x00000400);
+        uuid_ = "";
+        bitField0_ = (bitField0_ & ~0x00000800);
         if (eventBuilder_ == null) {
           event_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000800);
+          bitField0_ = (bitField0_ & ~0x00001000);
         } else {
           eventBuilder_.clear();
         }
@@ -3499,15 +3519,19 @@ public final class BatchReport {
         if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
           to_bitField0_ |= 0x00000080;
         }
-        result.snapshotId_ = snapshotId_;
+        result.id_ = id_;
         if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
           to_bitField0_ |= 0x00000100;
         }
+        result.snapshotId_ = snapshotId_;
+        if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
+          to_bitField0_ |= 0x00000200;
+        }
         result.uuid_ = uuid_;
         if (eventBuilder_ == null) {
-          if (((bitField0_ & 0x00000800) == 0x00000800)) {
+          if (((bitField0_ & 0x00001000) == 0x00001000)) {
             event_ = java.util.Collections.unmodifiableList(event_);
-            bitField0_ = (bitField0_ & ~0x00000800);
+            bitField0_ = (bitField0_ & ~0x00001000);
           }
           result.event_ = event_;
         } else {
@@ -3594,11 +3618,14 @@ public final class BatchReport {
           version_ = other.version_;
           onChanged();
         }
+        if (other.hasId()) {
+          setId(other.getId());
+        }
         if (other.hasSnapshotId()) {
           setSnapshotId(other.getSnapshotId());
         }
         if (other.hasUuid()) {
-          bitField0_ |= 0x00000400;
+          bitField0_ |= 0x00000800;
           uuid_ = other.uuid_;
           onChanged();
         }
@@ -3606,7 +3633,7 @@ public final class BatchReport {
           if (!other.event_.isEmpty()) {
             if (event_.isEmpty()) {
               event_ = other.event_;
-              bitField0_ = (bitField0_ & ~0x00000800);
+              bitField0_ = (bitField0_ & ~0x00001000);
             } else {
               ensureEventIsMutable();
               event_.addAll(other.event_);
@@ -3619,7 +3646,7 @@ public final class BatchReport {
               eventBuilder_.dispose();
               eventBuilder_ = null;
               event_ = other.event_;
-              bitField0_ = (bitField0_ & ~0x00000800);
+              bitField0_ = (bitField0_ & ~0x00001000);
               eventBuilder_ = 
                 com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                    getEventFieldBuilder() : null;
@@ -3655,7 +3682,6 @@ public final class BatchReport {
       }
       private int bitField0_;
 
-      // optional int32 ref = 1;
       private int ref_ ;
       /**
        * <code>optional int32 ref = 1;</code>
@@ -3688,7 +3714,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string path = 2;
       private java.lang.Object path_ = "";
       /**
        * <code>optional string path = 2;</code>
@@ -3702,9 +3727,12 @@ public final class BatchReport {
       public java.lang.String getPath() {
         java.lang.Object ref = path_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          path_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            path_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -3762,7 +3790,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string name = 3;
       private java.lang.Object name_ = "";
       /**
        * <code>optional string name = 3;</code>
@@ -3776,9 +3803,12 @@ public final class BatchReport {
       public java.lang.String getName() {
         java.lang.Object ref = name_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          name_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            name_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -3836,7 +3866,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional .ComponentType type = 4;
       private org.sonar.batch.protocol.Constants.ComponentType type_ = org.sonar.batch.protocol.Constants.ComponentType.PROJECT;
       /**
        * <code>optional .ComponentType type = 4;</code>
@@ -3872,7 +3901,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional bool is_test = 5;
       private boolean isTest_ ;
       /**
        * <code>optional bool is_test = 5;</code>
@@ -3905,7 +3933,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string language = 6;
       private java.lang.Object language_ = "";
       /**
        * <code>optional string language = 6;</code>
@@ -3919,9 +3946,12 @@ public final class BatchReport {
       public java.lang.String getLanguage() {
         java.lang.Object ref = language_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          language_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            language_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -3979,7 +4009,6 @@ public final class BatchReport {
         return this;
       }
 
-      // repeated int32 child_ref = 7 [packed = true];
       private java.util.List<java.lang.Integer> childRef_ = java.util.Collections.emptyList();
       private void ensureChildRefIsMutable() {
         if (!((bitField0_ & 0x00000040) == 0x00000040)) {
@@ -4031,7 +4060,8 @@ public final class BatchReport {
       public Builder addAllChildRef(
           java.lang.Iterable<? extends java.lang.Integer> values) {
         ensureChildRefIsMutable();
-        super.addAll(values, childRef_);
+        com.google.protobuf.AbstractMessageLite.Builder.addAll(
+            values, childRef_);
         onChanged();
         return this;
       }
@@ -4045,7 +4075,6 @@ public final class BatchReport {
         return this;
       }
 
-      // repeated .ComponentLink link = 10;
       private java.util.List<org.sonar.batch.protocol.output.BatchReport.ComponentLink> link_ =
         java.util.Collections.emptyList();
       private void ensureLinkIsMutable() {
@@ -4187,7 +4216,8 @@ public final class BatchReport {
           java.lang.Iterable<? extends org.sonar.batch.protocol.output.BatchReport.ComponentLink> values) {
         if (linkBuilder_ == null) {
           ensureLinkIsMutable();
-          super.addAll(values, link_);
+          com.google.protobuf.AbstractMessageLite.Builder.addAll(
+              values, link_);
           onChanged();
         } else {
           linkBuilder_.addAllMessages(values);
@@ -4285,7 +4315,6 @@ public final class BatchReport {
         return linkBuilder_;
       }
 
-      // optional string version = 12;
       private java.lang.Object version_ = "";
       /**
        * <code>optional string version = 12;</code>
@@ -4307,9 +4336,12 @@ public final class BatchReport {
       public java.lang.String getVersion() {
         java.lang.Object ref = version_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          version_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            version_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -4383,384 +4415,3515 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int64 snapshot_id = 8;
-      private long snapshotId_ ;
+      private long id_ ;
       /**
-       * <code>optional int64 snapshot_id = 8;</code>
+       * <code>optional int64 id = 13;</code>
        *
        * <pre>
        * temporary fields during development of computation stack
        * </pre>
        */
-      public boolean hasSnapshotId() {
+      public boolean hasId() {
         return ((bitField0_ & 0x00000200) == 0x00000200);
       }
       /**
-       * <code>optional int64 snapshot_id = 8;</code>
+       * <code>optional int64 id = 13;</code>
        *
        * <pre>
        * temporary fields during development of computation stack
        * </pre>
        */
-      public long getSnapshotId() {
-        return snapshotId_;
+      public long getId() {
+        return id_;
       }
       /**
-       * <code>optional int64 snapshot_id = 8;</code>
+       * <code>optional int64 id = 13;</code>
        *
        * <pre>
        * temporary fields during development of computation stack
        * </pre>
        */
-      public Builder setSnapshotId(long value) {
+      public Builder setId(long value) {
         bitField0_ |= 0x00000200;
-        snapshotId_ = value;
+        id_ = value;
         onChanged();
         return this;
       }
       /**
-       * <code>optional int64 snapshot_id = 8;</code>
+       * <code>optional int64 id = 13;</code>
        *
        * <pre>
        * temporary fields during development of computation stack
        * </pre>
        */
-      public Builder clearSnapshotId() {
+      public Builder clearId() {
         bitField0_ = (bitField0_ & ~0x00000200);
+        id_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      private long snapshotId_ ;
+      /**
+       * <code>optional int64 snapshot_id = 8;</code>
+       */
+      public boolean hasSnapshotId() {
+        return ((bitField0_ & 0x00000400) == 0x00000400);
+      }
+      /**
+       * <code>optional int64 snapshot_id = 8;</code>
+       */
+      public long getSnapshotId() {
+        return snapshotId_;
+      }
+      /**
+       * <code>optional int64 snapshot_id = 8;</code>
+       */
+      public Builder setSnapshotId(long value) {
+        bitField0_ |= 0x00000400;
+        snapshotId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 snapshot_id = 8;</code>
+       */
+      public Builder clearSnapshotId() {
+        bitField0_ = (bitField0_ & ~0x00000400);
         snapshotId_ = 0L;
         onChanged();
         return this;
       }
 
-      // optional string uuid = 9;
-      private java.lang.Object uuid_ = "";
-      /**
-       * <code>optional string uuid = 9;</code>
-       */
-      public boolean hasUuid() {
-        return ((bitField0_ & 0x00000400) == 0x00000400);
+      private java.lang.Object uuid_ = "";
+      /**
+       * <code>optional string uuid = 9;</code>
+       */
+      public boolean hasUuid() {
+        return ((bitField0_ & 0x00000800) == 0x00000800);
+      }
+      /**
+       * <code>optional string uuid = 9;</code>
+       */
+      public java.lang.String getUuid() {
+        java.lang.Object ref = uuid_;
+        if (!(ref instanceof java.lang.String)) {
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            uuid_ = s;
+          }
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string uuid = 9;</code>
+       */
+      public com.google.protobuf.ByteString
+          getUuidBytes() {
+        java.lang.Object ref = uuid_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          uuid_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string uuid = 9;</code>
+       */
+      public Builder setUuid(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000800;
+        uuid_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string uuid = 9;</code>
+       */
+      public Builder clearUuid() {
+        bitField0_ = (bitField0_ & ~0x00000800);
+        uuid_ = getDefaultInstance().getUuid();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string uuid = 9;</code>
+       */
+      public Builder setUuidBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000800;
+        uuid_ = value;
+        onChanged();
+        return this;
+      }
+
+      private java.util.List<org.sonar.batch.protocol.output.BatchReport.Event> event_ =
+        java.util.Collections.emptyList();
+      private void ensureEventIsMutable() {
+        if (!((bitField0_ & 0x00001000) == 0x00001000)) {
+          event_ = new java.util.ArrayList<org.sonar.batch.protocol.output.BatchReport.Event>(event_);
+          bitField0_ |= 0x00001000;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.sonar.batch.protocol.output.BatchReport.Event, org.sonar.batch.protocol.output.BatchReport.Event.Builder, org.sonar.batch.protocol.output.BatchReport.EventOrBuilder> eventBuilder_;
+
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public java.util.List<org.sonar.batch.protocol.output.BatchReport.Event> getEventList() {
+        if (eventBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(event_);
+        } else {
+          return eventBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public int getEventCount() {
+        if (eventBuilder_ == null) {
+          return event_.size();
+        } else {
+          return eventBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public org.sonar.batch.protocol.output.BatchReport.Event getEvent(int index) {
+        if (eventBuilder_ == null) {
+          return event_.get(index);
+        } else {
+          return eventBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder setEvent(
+          int index, org.sonar.batch.protocol.output.BatchReport.Event value) {
+        if (eventBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureEventIsMutable();
+          event_.set(index, value);
+          onChanged();
+        } else {
+          eventBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder setEvent(
+          int index, org.sonar.batch.protocol.output.BatchReport.Event.Builder builderForValue) {
+        if (eventBuilder_ == null) {
+          ensureEventIsMutable();
+          event_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          eventBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder addEvent(org.sonar.batch.protocol.output.BatchReport.Event value) {
+        if (eventBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureEventIsMutable();
+          event_.add(value);
+          onChanged();
+        } else {
+          eventBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder addEvent(
+          int index, org.sonar.batch.protocol.output.BatchReport.Event value) {
+        if (eventBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureEventIsMutable();
+          event_.add(index, value);
+          onChanged();
+        } else {
+          eventBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder addEvent(
+          org.sonar.batch.protocol.output.BatchReport.Event.Builder builderForValue) {
+        if (eventBuilder_ == null) {
+          ensureEventIsMutable();
+          event_.add(builderForValue.build());
+          onChanged();
+        } else {
+          eventBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder addEvent(
+          int index, org.sonar.batch.protocol.output.BatchReport.Event.Builder builderForValue) {
+        if (eventBuilder_ == null) {
+          ensureEventIsMutable();
+          event_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          eventBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder addAllEvent(
+          java.lang.Iterable<? extends org.sonar.batch.protocol.output.BatchReport.Event> values) {
+        if (eventBuilder_ == null) {
+          ensureEventIsMutable();
+          com.google.protobuf.AbstractMessageLite.Builder.addAll(
+              values, event_);
+          onChanged();
+        } else {
+          eventBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder clearEvent() {
+        if (eventBuilder_ == null) {
+          event_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00001000);
+          onChanged();
+        } else {
+          eventBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public Builder removeEvent(int index) {
+        if (eventBuilder_ == null) {
+          ensureEventIsMutable();
+          event_.remove(index);
+          onChanged();
+        } else {
+          eventBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public org.sonar.batch.protocol.output.BatchReport.Event.Builder getEventBuilder(
+          int index) {
+        return getEventFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public org.sonar.batch.protocol.output.BatchReport.EventOrBuilder getEventOrBuilder(
+          int index) {
+        if (eventBuilder_ == null) {
+          return event_.get(index);  } else {
+          return eventBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public java.util.List<? extends org.sonar.batch.protocol.output.BatchReport.EventOrBuilder> 
+           getEventOrBuilderList() {
+        if (eventBuilder_ != null) {
+          return eventBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(event_);
+        }
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public org.sonar.batch.protocol.output.BatchReport.Event.Builder addEventBuilder() {
+        return getEventFieldBuilder().addBuilder(
+            org.sonar.batch.protocol.output.BatchReport.Event.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public org.sonar.batch.protocol.output.BatchReport.Event.Builder addEventBuilder(
+          int index) {
+        return getEventFieldBuilder().addBuilder(
+            index, org.sonar.batch.protocol.output.BatchReport.Event.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .Event event = 11;</code>
+       */
+      public java.util.List<org.sonar.batch.protocol.output.BatchReport.Event.Builder> 
+           getEventBuilderList() {
+        return getEventFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.sonar.batch.protocol.output.BatchReport.Event, org.sonar.batch.protocol.output.BatchReport.Event.Builder, org.sonar.batch.protocol.output.BatchReport.EventOrBuilder> 
+          getEventFieldBuilder() {
+        if (eventBuilder_ == null) {
+          eventBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.sonar.batch.protocol.output.BatchReport.Event, org.sonar.batch.protocol.output.BatchReport.Event.Builder, org.sonar.batch.protocol.output.BatchReport.EventOrBuilder>(
+                  event_,
+                  ((bitField0_ & 0x00001000) == 0x00001000),
+                  getParentForChildren(),
+                  isClean());
+          event_ = null;
+        }
+        return eventBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:Component)
+    }
+
+    static {
+      defaultInstance = new Component(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:Component)
+  }
+
+  public interface MeasureOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:Measure)
+      com.google.protobuf.MessageOrBuilder {
+
+    /**
+     * <code>optional .MeasureValueType value_type = 1;</code>
+     */
+    boolean hasValueType();
+    /**
+     * <code>optional .MeasureValueType value_type = 1;</code>
+     */
+    org.sonar.batch.protocol.Constants.MeasureValueType getValueType();
+
+    /**
+     * <code>optional bool boolean_value = 2;</code>
+     */
+    boolean hasBooleanValue();
+    /**
+     * <code>optional bool boolean_value = 2;</code>
+     */
+    boolean getBooleanValue();
+
+    /**
+     * <code>optional int32 int_value = 3;</code>
+     */
+    boolean hasIntValue();
+    /**
+     * <code>optional int32 int_value = 3;</code>
+     */
+    int getIntValue();
+
+    /**
+     * <code>optional int64 long_value = 4;</code>
+     */
+    boolean hasLongValue();
+    /**
+     * <code>optional int64 long_value = 4;</code>
+     */
+    long getLongValue();
+
+    /**
+     * <code>optional double double_value = 5;</code>
+     */
+    boolean hasDoubleValue();
+    /**
+     * <code>optional double double_value = 5;</code>
+     */
+    double getDoubleValue();
+
+    /**
+     * <code>optional string string_value = 6;</code>
+     */
+    boolean hasStringValue();
+    /**
+     * <code>optional string string_value = 6;</code>
+     */
+    java.lang.String getStringValue();
+    /**
+     * <code>optional string string_value = 6;</code>
+     */
+    com.google.protobuf.ByteString
+        getStringValueBytes();
+
+    /**
+     * <code>optional string metric_key = 7;</code>
+     */
+    boolean hasMetricKey();
+    /**
+     * <code>optional string metric_key = 7;</code>
+     */
+    java.lang.String getMetricKey();
+    /**
+     * <code>optional string metric_key = 7;</code>
+     */
+    com.google.protobuf.ByteString
+        getMetricKeyBytes();
+
+    /**
+     * <code>optional string description = 9;</code>
+     *
+     * <pre>
+     * temporary fields during development of computation stack
+     * </pre>
+     */
+    boolean hasDescription();
+    /**
+     * <code>optional string description = 9;</code>
+     *
+     * <pre>
+     * temporary fields during development of computation stack
+     * </pre>
+     */
+    java.lang.String getDescription();
+    /**
+     * <code>optional string description = 9;</code>
+     *
+     * <pre>
+     * temporary fields during development of computation stack
+     * </pre>
+     */
+    com.google.protobuf.ByteString
+        getDescriptionBytes();
+
+    /**
+     * <code>optional string rule_key = 10;</code>
+     */
+    boolean hasRuleKey();
+    /**
+     * <code>optional string rule_key = 10;</code>
+     */
+    java.lang.String getRuleKey();
+    /**
+     * <code>optional string rule_key = 10;</code>
+     */
+    com.google.protobuf.ByteString
+        getRuleKeyBytes();
+
+    /**
+     * <code>optional .Severity severity = 11;</code>
+     */
+    boolean hasSeverity();
+    /**
+     * <code>optional .Severity severity = 11;</code>
+     */
+    org.sonar.batch.protocol.Constants.Severity getSeverity();
+
+    /**
+     * <code>optional string alert_status = 12;</code>
+     */
+    boolean hasAlertStatus();
+    /**
+     * <code>optional string alert_status = 12;</code>
+     */
+    java.lang.String getAlertStatus();
+    /**
+     * <code>optional string alert_status = 12;</code>
+     */
+    com.google.protobuf.ByteString
+        getAlertStatusBytes();
+
+    /**
+     * <code>optional string alert_text = 13;</code>
+     */
+    boolean hasAlertText();
+    /**
+     * <code>optional string alert_text = 13;</code>
+     */
+    java.lang.String getAlertText();
+    /**
+     * <code>optional string alert_text = 13;</code>
+     */
+    com.google.protobuf.ByteString
+        getAlertTextBytes();
+
+    /**
+     * <code>optional double variation_value_1 = 14;</code>
+     */
+    boolean hasVariationValue1();
+    /**
+     * <code>optional double variation_value_1 = 14;</code>
+     */
+    double getVariationValue1();
+
+    /**
+     * <code>optional double variation_value_2 = 15;</code>
+     */
+    boolean hasVariationValue2();
+    /**
+     * <code>optional double variation_value_2 = 15;</code>
+     */
+    double getVariationValue2();
+
+    /**
+     * <code>optional double variation_value_3 = 16;</code>
+     */
+    boolean hasVariationValue3();
+    /**
+     * <code>optional double variation_value_3 = 16;</code>
+     */
+    double getVariationValue3();
+
+    /**
+     * <code>optional double variation_value_4 = 17;</code>
+     */
+    boolean hasVariationValue4();
+    /**
+     * <code>optional double variation_value_4 = 17;</code>
+     */
+    double getVariationValue4();
+
+    /**
+     * <code>optional double variation_value_5 = 18;</code>
+     */
+    boolean hasVariationValue5();
+    /**
+     * <code>optional double variation_value_5 = 18;</code>
+     */
+    double getVariationValue5();
+
+    /**
+     * <code>optional int32 tendency = 19;</code>
+     */
+    boolean hasTendency();
+    /**
+     * <code>optional int32 tendency = 19;</code>
+     */
+    int getTendency();
+
+    /**
+     * <code>optional int32 characteric_id = 20;</code>
+     */
+    boolean hasCharactericId();
+    /**
+     * <code>optional int32 characteric_id = 20;</code>
+     */
+    int getCharactericId();
+  }
+  /**
+   * Protobuf type {@code Measure}
+   */
+  public static final class Measure extends
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:Measure)
+      MeasureOrBuilder {
+    // Use Measure.newBuilder() to construct.
+    private Measure(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Measure(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Measure defaultInstance;
+    public static Measure getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Measure getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Measure(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              int rawValue = input.readEnum();
+              org.sonar.batch.protocol.Constants.MeasureValueType value = org.sonar.batch.protocol.Constants.MeasureValueType.valueOf(rawValue);
+              if (value == null) {
+                unknownFields.mergeVarintField(1, rawValue);
+              } else {
+                bitField0_ |= 0x00000001;
+                valueType_ = value;
+              }
+              break;
+            }
+            case 16: {
+              bitField0_ |= 0x00000002;
+              booleanValue_ = input.readBool();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              intValue_ = input.readInt32();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              longValue_ = input.readInt64();
+              break;
+            }
+            case 41: {
+              bitField0_ |= 0x00000010;
+              doubleValue_ = input.readDouble();
+              break;
+            }
+            case 50: {
+              com.google.protobuf.ByteString bs = input.readBytes();
+              bitField0_ |= 0x00000020;
+              stringValue_ = bs;
+              break;
+            }
+            case 58: {
+              com.google.protobuf.ByteString bs = input.readBytes();
+              bitField0_ |= 0x00000040;
+              metricKey_ = bs;
+              break;
+            }
+            case 74: {
+              com.google.protobuf.ByteString bs = input.readBytes();
+              bitField0_ |= 0x00000080;
+              description_ = bs;
+              break;
+            }
+            case 82: {
+              com.google.protobuf.ByteString bs = input.readBytes();
+              bitField0_ |= 0x00000100;
+              ruleKey_ = bs;
+              break;
+            }
+            case 88: {
+              int rawValue = input.readEnum();
+              org.sonar.batch.protocol.Constants.Severity value = org.sonar.batch.protocol.Constants.Severity.valueOf(rawValue);
+              if (value == null) {
+                unknownFields.mergeVarintField(11, rawValue);
+              } else {
+                bitField0_ |= 0x00000200;
+                severity_ = value;
+              }
+              break;
+            }
+            case 98: {
+              com.google.protobuf.ByteString bs = input.readBytes();
+              bitField0_ |= 0x00000400;
+              alertStatus_ = bs;
+              break;
+            }
+            case 106: {
+              com.google.protobuf.ByteString bs = input.readBytes();
+              bitField0_ |= 0x00000800;
+              alertText_ = bs;
+              break;
+            }
+            case 113: {
+              bitField0_ |= 0x00001000;
+              variationValue1_ = input.readDouble();
+              break;
+            }
+            case 121: {
+              bitField0_ |= 0x00002000;
+              variationValue2_ = input.readDouble();
+              break;
+            }
+            case 129: {
+              bitField0_ |= 0x00004000;
+              variationValue3_ = input.readDouble();
+              break;
+            }
+            case 137: {
+              bitField0_ |= 0x00008000;
+              variationValue4_ = input.readDouble();
+              break;
+            }
+            case 145: {
+              bitField0_ |= 0x00010000;
+              variationValue5_ = input.readDouble();
+              break;
+            }
+            case 152: {
+              bitField0_ |= 0x00020000;
+              tendency_ = input.readInt32();
+              break;
+            }
+            case 160: {
+              bitField0_ |= 0x00040000;
+              charactericId_ = input.readInt32();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.sonar.batch.protocol.output.BatchReport.internal_static_Measure_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.sonar.batch.protocol.output.BatchReport.internal_static_Measure_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.sonar.batch.protocol.output.BatchReport.Measure.class, org.sonar.batch.protocol.output.BatchReport.Measure.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Measure> PARSER =
+        new com.google.protobuf.AbstractParser<Measure>() {
+      public Measure parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Measure(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Measure> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    public static final int VALUE_TYPE_FIELD_NUMBER = 1;
+    private org.sonar.batch.protocol.Constants.MeasureValueType valueType_;
+    /**
+     * <code>optional .MeasureValueType value_type = 1;</code>
+     */
+    public boolean hasValueType() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional .MeasureValueType value_type = 1;</code>
+     */
+    public org.sonar.batch.protocol.Constants.MeasureValueType getValueType() {
+      return valueType_;
+    }
+
+    public static final int BOOLEAN_VALUE_FIELD_NUMBER = 2;
+    private boolean booleanValue_;
+    /**
+     * <code>optional bool boolean_value = 2;</code>
+     */
+    public boolean hasBooleanValue() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional bool boolean_value = 2;</code>
+     */
+    public boolean getBooleanValue() {
+      return booleanValue_;
+    }
+
+    public static final int INT_VALUE_FIELD_NUMBER = 3;
+    private int intValue_;
+    /**
+     * <code>optional int32 int_value = 3;</code>
+     */
+    public boolean hasIntValue() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int32 int_value = 3;</code>
+     */
+    public int getIntValue() {
+      return intValue_;
+    }
+
+    public static final int LONG_VALUE_FIELD_NUMBER = 4;
+    private long longValue_;
+    /**
+     * <code>optional int64 long_value = 4;</code>
+     */
+    public boolean hasLongValue() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int64 long_value = 4;</code>
+     */
+    public long getLongValue() {
+      return longValue_;
+    }
+
+    public static final int DOUBLE_VALUE_FIELD_NUMBER = 5;
+    private double doubleValue_;
+    /**
+     * <code>optional double double_value = 5;</code>
+     */
+    public boolean hasDoubleValue() {
+      return ((bitField0_ & 0x00000010) == 0x00000010);
+    }
+    /**
+     * <code>optional double double_value = 5;</code>
+     */
+    public double getDoubleValue() {
+      return doubleValue_;
+    }
+
+    public static final int STRING_VALUE_FIELD_NUMBER = 6;
+    private java.lang.Object stringValue_;
+    /**
+     * <code>optional string string_value = 6;</code>
+     */
+    public boolean hasStringValue() {
+      return ((bitField0_ & 0x00000020) == 0x00000020);
+    }
+    /**
+     * <code>optional string string_value = 6;</code>
+     */
+    public java.lang.String getStringValue() {
+      java.lang.Object ref = stringValue_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          stringValue_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string string_value = 6;</code>
+     */
+    public com.google.protobuf.ByteString
+        getStringValueBytes() {
+      java.lang.Object ref = stringValue_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        stringValue_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    public static final int METRIC_KEY_FIELD_NUMBER = 7;
+    private java.lang.Object metricKey_;
+    /**
+     * <code>optional string metric_key = 7;</code>
+     */
+    public boolean hasMetricKey() {
+      return ((bitField0_ & 0x00000040) == 0x00000040);
+    }
+    /**
+     * <code>optional string metric_key = 7;</code>
+     */
+    public java.lang.String getMetricKey() {
+      java.lang.Object ref = metricKey_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          metricKey_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string metric_key = 7;</code>
+     */
+    public com.google.protobuf.ByteString
+        getMetricKeyBytes() {
+      java.lang.Object ref = metricKey_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        metricKey_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    public static final int DESCRIPTION_FIELD_NUMBER = 9;
+    private java.lang.Object description_;
+    /**
+     * <code>optional string description = 9;</code>
+     *
+     * <pre>
+     * temporary fields during development of computation stack
+     * </pre>
+     */
+    public boolean hasDescription() {
+      return ((bitField0_ & 0x00000080) == 0x00000080);
+    }
+    /**
+     * <code>optional string description = 9;</code>
+     *
+     * <pre>
+     * temporary fields during development of computation stack
+     * </pre>
+     */
+    public java.lang.String getDescription() {
+      java.lang.Object ref = description_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          description_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string description = 9;</code>
+     *
+     * <pre>
+     * temporary fields during development of computation stack
+     * </pre>
+     */
+    public com.google.protobuf.ByteString
+        getDescriptionBytes() {
+      java.lang.Object ref = description_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        description_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    public static final int RULE_KEY_FIELD_NUMBER = 10;
+    private java.lang.Object ruleKey_;
+    /**
+     * <code>optional string rule_key = 10;</code>
+     */
+    public boolean hasRuleKey() {
+      return ((bitField0_ & 0x00000100) == 0x00000100);
+    }
+    /**
+     * <code>optional string rule_key = 10;</code>
+     */
+    public java.lang.String getRuleKey() {
+      java.lang.Object ref = ruleKey_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          ruleKey_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string rule_key = 10;</code>
+     */
+    public com.google.protobuf.ByteString
+        getRuleKeyBytes() {
+      java.lang.Object ref = ruleKey_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        ruleKey_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    public static final int SEVERITY_FIELD_NUMBER = 11;
+    private org.sonar.batch.protocol.Constants.Severity severity_;
+    /**
+     * <code>optional .Severity severity = 11;</code>
+     */
+    public boolean hasSeverity() {
+      return ((bitField0_ & 0x00000200) == 0x00000200);
+    }
+    /**
+     * <code>optional .Severity severity = 11;</code>
+     */
+    public org.sonar.batch.protocol.Constants.Severity getSeverity() {
+      return severity_;
+    }
+
+    public static final int ALERT_STATUS_FIELD_NUMBER = 12;
+    private java.lang.Object alertStatus_;
+    /**
+     * <code>optional string alert_status = 12;</code>
+     */
+    public boolean hasAlertStatus() {
+      return ((bitField0_ & 0x00000400) == 0x00000400);
+    }
+    /**
+     * <code>optional string alert_status = 12;</code>
+     */
+    public java.lang.String getAlertStatus() {
+      java.lang.Object ref = alertStatus_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          alertStatus_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string alert_status = 12;</code>
+     */
+    public com.google.protobuf.ByteString
+        getAlertStatusBytes() {
+      java.lang.Object ref = alertStatus_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        alertStatus_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    public static final int ALERT_TEXT_FIELD_NUMBER = 13;
+    private java.lang.Object alertText_;
+    /**
+     * <code>optional string alert_text = 13;</code>
+     */
+    public boolean hasAlertText() {
+      return ((bitField0_ & 0x00000800) == 0x00000800);
+    }
+    /**
+     * <code>optional string alert_text = 13;</code>
+     */
+    public java.lang.String getAlertText() {
+      java.lang.Object ref = alertText_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          alertText_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string alert_text = 13;</code>
+     */
+    public com.google.protobuf.ByteString
+        getAlertTextBytes() {
+      java.lang.Object ref = alertText_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        alertText_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    public static final int VARIATION_VALUE_1_FIELD_NUMBER = 14;
+    private double variationValue1_;
+    /**
+     * <code>optional double variation_value_1 = 14;</code>
+     */
+    public boolean hasVariationValue1() {
+      return ((bitField0_ & 0x00001000) == 0x00001000);
+    }
+    /**
+     * <code>optional double variation_value_1 = 14;</code>
+     */
+    public double getVariationValue1() {
+      return variationValue1_;
+    }
+
+    public static final int VARIATION_VALUE_2_FIELD_NUMBER = 15;
+    private double variationValue2_;
+    /**
+     * <code>optional double variation_value_2 = 15;</code>
+     */
+    public boolean hasVariationValue2() {
+      return ((bitField0_ & 0x00002000) == 0x00002000);
+    }
+    /**
+     * <code>optional double variation_value_2 = 15;</code>
+     */
+    public double getVariationValue2() {
+      return variationValue2_;
+    }
+
+    public static final int VARIATION_VALUE_3_FIELD_NUMBER = 16;
+    private double variationValue3_;
+    /**
+     * <code>optional double variation_value_3 = 16;</code>
+     */
+    public boolean hasVariationValue3() {
+      return ((bitField0_ & 0x00004000) == 0x00004000);
+    }
+    /**
+     * <code>optional double variation_value_3 = 16;</code>
+     */
+    public double getVariationValue3() {
+      return variationValue3_;
+    }
+
+    public static final int VARIATION_VALUE_4_FIELD_NUMBER = 17;
+    private double variationValue4_;
+    /**
+     * <code>optional double variation_value_4 = 17;</code>
+     */
+    public boolean hasVariationValue4() {
+      return ((bitField0_ & 0x00008000) == 0x00008000);
+    }
+    /**
+     * <code>optional double variation_value_4 = 17;</code>
+     */
+    public double getVariationValue4() {
+      return variationValue4_;
+    }
+
+    public static final int VARIATION_VALUE_5_FIELD_NUMBER = 18;
+    private double variationValue5_;
+    /**
+     * <code>optional double variation_value_5 = 18;</code>
+     */
+    public boolean hasVariationValue5() {
+      return ((bitField0_ & 0x00010000) == 0x00010000);
+    }
+    /**
+     * <code>optional double variation_value_5 = 18;</code>
+     */
+    public double getVariationValue5() {
+      return variationValue5_;
+    }
+
+    public static final int TENDENCY_FIELD_NUMBER = 19;
+    private int tendency_;
+    /**
+     * <code>optional int32 tendency = 19;</code>
+     */
+    public boolean hasTendency() {
+      return ((bitField0_ & 0x00020000) == 0x00020000);
+    }
+    /**
+     * <code>optional int32 tendency = 19;</code>
+     */
+    public int getTendency() {
+      return tendency_;
+    }
+
+    public static final int CHARACTERIC_ID_FIELD_NUMBER = 20;
+    private int charactericId_;
+    /**
+     * <code>optional int32 characteric_id = 20;</code>
+     */
+    public boolean hasCharactericId() {
+      return ((bitField0_ & 0x00040000) == 0x00040000);
+    }
+    /**
+     * <code>optional int32 characteric_id = 20;</code>
+     */
+    public int getCharactericId() {
+      return charactericId_;
+    }
+
+    private void initFields() {
+      valueType_ = org.sonar.batch.protocol.Constants.MeasureValueType.INT;
+      booleanValue_ = false;
+      intValue_ = 0;
+      longValue_ = 0L;
+      doubleValue_ = 0D;
+      stringValue_ = "";
+      metricKey_ = "";
+      description_ = "";
+      ruleKey_ = "";
+      severity_ = org.sonar.batch.protocol.Constants.Severity.INFO;
+      alertStatus_ = "";
+      alertText_ = "";
+      variationValue1_ = 0D;
+      variationValue2_ = 0D;
+      variationValue3_ = 0D;
+      variationValue4_ = 0D;
+      variationValue5_ = 0D;
+      tendency_ = 0;
+      charactericId_ = 0;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeEnum(1, valueType_.getNumber());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBool(2, booleanValue_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt32(3, intValue_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt64(4, longValue_);
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        output.writeDouble(5, doubleValue_);
+      }
+      if (((bitField0_ & 0x00000020) == 0x00000020)) {
+        output.writeBytes(6, getStringValueBytes());
+      }
+      if (((bitField0_ & 0x00000040) == 0x00000040)) {
+        output.writeBytes(7, getMetricKeyBytes());
+      }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        output.writeBytes(9, getDescriptionBytes());
+      }
+      if (((bitField0_ & 0x00000100) == 0x00000100)) {
+        output.writeBytes(10, getRuleKeyBytes());
+      }
+      if (((bitField0_ & 0x00000200) == 0x00000200)) {
+        output.writeEnum(11, severity_.getNumber());
+      }
+      if (((bitField0_ & 0x00000400) == 0x00000400)) {
+        output.writeBytes(12, getAlertStatusBytes());
+      }
+      if (((bitField0_ & 0x00000800) == 0x00000800)) {
+        output.writeBytes(13, getAlertTextBytes());
+      }
+      if (((bitField0_ & 0x00001000) == 0x00001000)) {
+        output.writeDouble(14, variationValue1_);
+      }
+      if (((bitField0_ & 0x00002000) == 0x00002000)) {
+        output.writeDouble(15, variationValue2_);
+      }
+      if (((bitField0_ & 0x00004000) == 0x00004000)) {
+        output.writeDouble(16, variationValue3_);
+      }
+      if (((bitField0_ & 0x00008000) == 0x00008000)) {
+        output.writeDouble(17, variationValue4_);
+      }
+      if (((bitField0_ & 0x00010000) == 0x00010000)) {
+        output.writeDouble(18, variationValue5_);
+      }
+      if (((bitField0_ & 0x00020000) == 0x00020000)) {
+        output.writeInt32(19, tendency_);
+      }
+      if (((bitField0_ & 0x00040000) == 0x00040000)) {
+        output.writeInt32(20, charactericId_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeEnumSize(1, valueType_.getNumber());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBoolSize(2, booleanValue_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(3, intValue_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(4, longValue_);
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(5, doubleValue_);
+      }
+      if (((bitField0_ & 0x00000020) == 0x00000020)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(6, getStringValueBytes());
+      }
+      if (((bitField0_ & 0x00000040) == 0x00000040)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(7, getMetricKeyBytes());
+      }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(9, getDescriptionBytes());
+      }
+      if (((bitField0_ & 0x00000100) == 0x00000100)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(10, getRuleKeyBytes());
+      }
+      if (((bitField0_ & 0x00000200) == 0x00000200)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeEnumSize(11, severity_.getNumber());
+      }
+      if (((bitField0_ & 0x00000400) == 0x00000400)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(12, getAlertStatusBytes());
+      }
+      if (((bitField0_ & 0x00000800) == 0x00000800)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(13, getAlertTextBytes());
+      }
+      if (((bitField0_ & 0x00001000) == 0x00001000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(14, variationValue1_);
+      }
+      if (((bitField0_ & 0x00002000) == 0x00002000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(15, variationValue2_);
+      }
+      if (((bitField0_ & 0x00004000) == 0x00004000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(16, variationValue3_);
+      }
+      if (((bitField0_ & 0x00008000) == 0x00008000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(17, variationValue4_);
+      }
+      if (((bitField0_ & 0x00010000) == 0x00010000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(18, variationValue5_);
+      }
+      if (((bitField0_ & 0x00020000) == 0x00020000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(19, tendency_);
+      }
+      if (((bitField0_ & 0x00040000) == 0x00040000)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(20, charactericId_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measure parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.sonar.batch.protocol.output.BatchReport.Measure prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code Measure}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:Measure)
+        org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.sonar.batch.protocol.output.BatchReport.internal_static_Measure_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.sonar.batch.protocol.output.BatchReport.internal_static_Measure_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.sonar.batch.protocol.output.BatchReport.Measure.class, org.sonar.batch.protocol.output.BatchReport.Measure.Builder.class);
+      }
+
+      // Construct using org.sonar.batch.protocol.output.BatchReport.Measure.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        valueType_ = org.sonar.batch.protocol.Constants.MeasureValueType.INT;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        booleanValue_ = false;
+        bitField0_ = (bitField0_ & ~0x00000002);
+        intValue_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        longValue_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000008);
+        doubleValue_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00000010);
+        stringValue_ = "";
+        bitField0_ = (bitField0_ & ~0x00000020);
+        metricKey_ = "";
+        bitField0_ = (bitField0_ & ~0x00000040);
+        description_ = "";
+        bitField0_ = (bitField0_ & ~0x00000080);
+        ruleKey_ = "";
+        bitField0_ = (bitField0_ & ~0x00000100);
+        severity_ = org.sonar.batch.protocol.Constants.Severity.INFO;
+        bitField0_ = (bitField0_ & ~0x00000200);
+        alertStatus_ = "";
+        bitField0_ = (bitField0_ & ~0x00000400);
+        alertText_ = "";
+        bitField0_ = (bitField0_ & ~0x00000800);
+        variationValue1_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00001000);
+        variationValue2_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00002000);
+        variationValue3_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00004000);
+        variationValue4_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00008000);
+        variationValue5_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00010000);
+        tendency_ = 0;
+        bitField0_ = (bitField0_ & ~0x00020000);
+        charactericId_ = 0;
+        bitField0_ = (bitField0_ & ~0x00040000);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.sonar.batch.protocol.output.BatchReport.internal_static_Measure_descriptor;
+      }
+
+      public org.sonar.batch.protocol.output.BatchReport.Measure getDefaultInstanceForType() {
+        return org.sonar.batch.protocol.output.BatchReport.Measure.getDefaultInstance();
+      }
+
+      public org.sonar.batch.protocol.output.BatchReport.Measure build() {
+        org.sonar.batch.protocol.output.BatchReport.Measure result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.sonar.batch.protocol.output.BatchReport.Measure buildPartial() {
+        org.sonar.batch.protocol.output.BatchReport.Measure result = new org.sonar.batch.protocol.output.BatchReport.Measure(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.valueType_ = valueType_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.booleanValue_ = booleanValue_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.intValue_ = intValue_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.longValue_ = longValue_;
+        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+          to_bitField0_ |= 0x00000010;
+        }
+        result.doubleValue_ = doubleValue_;
+        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+          to_bitField0_ |= 0x00000020;
+        }
+        result.stringValue_ = stringValue_;
+        if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
+          to_bitField0_ |= 0x00000040;
+        }
+        result.metricKey_ = metricKey_;
+        if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
+          to_bitField0_ |= 0x00000080;
+        }
+        result.description_ = description_;
+        if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
+          to_bitField0_ |= 0x00000100;
+        }
+        result.ruleKey_ = ruleKey_;
+        if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
+          to_bitField0_ |= 0x00000200;
+        }
+        result.severity_ = severity_;
+        if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
+          to_bitField0_ |= 0x00000400;
+        }
+        result.alertStatus_ = alertStatus_;
+        if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
+          to_bitField0_ |= 0x00000800;
+        }
+        result.alertText_ = alertText_;
+        if (((from_bitField0_ & 0x00001000) == 0x00001000)) {
+          to_bitField0_ |= 0x00001000;
+        }
+        result.variationValue1_ = variationValue1_;
+        if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
+          to_bitField0_ |= 0x00002000;
+        }
+        result.variationValue2_ = variationValue2_;
+        if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
+          to_bitField0_ |= 0x00004000;
+        }
+        result.variationValue3_ = variationValue3_;
+        if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
+          to_bitField0_ |= 0x00008000;
+        }
+        result.variationValue4_ = variationValue4_;
+        if (((from_bitField0_ & 0x00010000) == 0x00010000)) {
+          to_bitField0_ |= 0x00010000;
+        }
+        result.variationValue5_ = variationValue5_;
+        if (((from_bitField0_ & 0x00020000) == 0x00020000)) {
+          to_bitField0_ |= 0x00020000;
+        }
+        result.tendency_ = tendency_;
+        if (((from_bitField0_ & 0x00040000) == 0x00040000)) {
+          to_bitField0_ |= 0x00040000;
+        }
+        result.charactericId_ = charactericId_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.sonar.batch.protocol.output.BatchReport.Measure) {
+          return mergeFrom((org.sonar.batch.protocol.output.BatchReport.Measure)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.sonar.batch.protocol.output.BatchReport.Measure other) {
+        if (other == org.sonar.batch.protocol.output.BatchReport.Measure.getDefaultInstance()) return this;
+        if (other.hasValueType()) {
+          setValueType(other.getValueType());
+        }
+        if (other.hasBooleanValue()) {
+          setBooleanValue(other.getBooleanValue());
+        }
+        if (other.hasIntValue()) {
+          setIntValue(other.getIntValue());
+        }
+        if (other.hasLongValue()) {
+          setLongValue(other.getLongValue());
+        }
+        if (other.hasDoubleValue()) {
+          setDoubleValue(other.getDoubleValue());
+        }
+        if (other.hasStringValue()) {
+          bitField0_ |= 0x00000020;
+          stringValue_ = other.stringValue_;
+          onChanged();
+        }
+        if (other.hasMetricKey()) {
+          bitField0_ |= 0x00000040;
+          metricKey_ = other.metricKey_;
+          onChanged();
+        }
+        if (other.hasDescription()) {
+          bitField0_ |= 0x00000080;
+          description_ = other.description_;
+          onChanged();
+        }
+        if (other.hasRuleKey()) {
+          bitField0_ |= 0x00000100;
+          ruleKey_ = other.ruleKey_;
+          onChanged();
+        }
+        if (other.hasSeverity()) {
+          setSeverity(other.getSeverity());
+        }
+        if (other.hasAlertStatus()) {
+          bitField0_ |= 0x00000400;
+          alertStatus_ = other.alertStatus_;
+          onChanged();
+        }
+        if (other.hasAlertText()) {
+          bitField0_ |= 0x00000800;
+          alertText_ = other.alertText_;
+          onChanged();
+        }
+        if (other.hasVariationValue1()) {
+          setVariationValue1(other.getVariationValue1());
+        }
+        if (other.hasVariationValue2()) {
+          setVariationValue2(other.getVariationValue2());
+        }
+        if (other.hasVariationValue3()) {
+          setVariationValue3(other.getVariationValue3());
+        }
+        if (other.hasVariationValue4()) {
+          setVariationValue4(other.getVariationValue4());
+        }
+        if (other.hasVariationValue5()) {
+          setVariationValue5(other.getVariationValue5());
+        }
+        if (other.hasTendency()) {
+          setTendency(other.getTendency());
+        }
+        if (other.hasCharactericId()) {
+          setCharactericId(other.getCharactericId());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.sonar.batch.protocol.output.BatchReport.Measure parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.sonar.batch.protocol.output.BatchReport.Measure) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      private org.sonar.batch.protocol.Constants.MeasureValueType valueType_ = org.sonar.batch.protocol.Constants.MeasureValueType.INT;
+      /**
+       * <code>optional .MeasureValueType value_type = 1;</code>
+       */
+      public boolean hasValueType() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional .MeasureValueType value_type = 1;</code>
+       */
+      public org.sonar.batch.protocol.Constants.MeasureValueType getValueType() {
+        return valueType_;
+      }
+      /**
+       * <code>optional .MeasureValueType value_type = 1;</code>
+       */
+      public Builder setValueType(org.sonar.batch.protocol.Constants.MeasureValueType value) {
+        if (value == null) {
+          throw new NullPointerException();
+        }
+        bitField0_ |= 0x00000001;
+        valueType_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional .MeasureValueType value_type = 1;</code>
+       */
+      public Builder clearValueType() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        valueType_ = org.sonar.batch.protocol.Constants.MeasureValueType.INT;
+        onChanged();
+        return this;
+      }
+
+      private boolean booleanValue_ ;
+      /**
+       * <code>optional bool boolean_value = 2;</code>
+       */
+      public boolean hasBooleanValue() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional bool boolean_value = 2;</code>
+       */
+      public boolean getBooleanValue() {
+        return booleanValue_;
+      }
+      /**
+       * <code>optional bool boolean_value = 2;</code>
+       */
+      public Builder setBooleanValue(boolean value) {
+        bitField0_ |= 0x00000002;
+        booleanValue_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional bool boolean_value = 2;</code>
+       */
+      public Builder clearBooleanValue() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        booleanValue_ = false;
+        onChanged();
+        return this;
+      }
+
+      private int intValue_ ;
+      /**
+       * <code>optional int32 int_value = 3;</code>
+       */
+      public boolean hasIntValue() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int32 int_value = 3;</code>
+       */
+      public int getIntValue() {
+        return intValue_;
+      }
+      /**
+       * <code>optional int32 int_value = 3;</code>
+       */
+      public Builder setIntValue(int value) {
+        bitField0_ |= 0x00000004;
+        intValue_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 int_value = 3;</code>
+       */
+      public Builder clearIntValue() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        intValue_ = 0;
+        onChanged();
+        return this;
+      }
+
+      private long longValue_ ;
+      /**
+       * <code>optional int64 long_value = 4;</code>
+       */
+      public boolean hasLongValue() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int64 long_value = 4;</code>
+       */
+      public long getLongValue() {
+        return longValue_;
+      }
+      /**
+       * <code>optional int64 long_value = 4;</code>
+       */
+      public Builder setLongValue(long value) {
+        bitField0_ |= 0x00000008;
+        longValue_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 long_value = 4;</code>
+       */
+      public Builder clearLongValue() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        longValue_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      private double doubleValue_ ;
+      /**
+       * <code>optional double double_value = 5;</code>
+       */
+      public boolean hasDoubleValue() {
+        return ((bitField0_ & 0x00000010) == 0x00000010);
+      }
+      /**
+       * <code>optional double double_value = 5;</code>
+       */
+      public double getDoubleValue() {
+        return doubleValue_;
+      }
+      /**
+       * <code>optional double double_value = 5;</code>
+       */
+      public Builder setDoubleValue(double value) {
+        bitField0_ |= 0x00000010;
+        doubleValue_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional double double_value = 5;</code>
+       */
+      public Builder clearDoubleValue() {
+        bitField0_ = (bitField0_ & ~0x00000010);
+        doubleValue_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      private java.lang.Object stringValue_ = "";
+      /**
+       * <code>optional string string_value = 6;</code>
+       */
+      public boolean hasStringValue() {
+        return ((bitField0_ & 0x00000020) == 0x00000020);
+      }
+      /**
+       * <code>optional string string_value = 6;</code>
+       */
+      public java.lang.String getStringValue() {
+        java.lang.Object ref = stringValue_;
+        if (!(ref instanceof java.lang.String)) {
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            stringValue_ = s;
+          }
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string string_value = 6;</code>
+       */
+      public com.google.protobuf.ByteString
+          getStringValueBytes() {
+        java.lang.Object ref = stringValue_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          stringValue_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string string_value = 6;</code>
+       */
+      public Builder setStringValue(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000020;
+        stringValue_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string string_value = 6;</code>
+       */
+      public Builder clearStringValue() {
+        bitField0_ = (bitField0_ & ~0x00000020);
+        stringValue_ = getDefaultInstance().getStringValue();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string string_value = 6;</code>
+       */
+      public Builder setStringValueBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000020;
+        stringValue_ = value;
+        onChanged();
+        return this;
+      }
+
+      private java.lang.Object metricKey_ = "";
+      /**
+       * <code>optional string metric_key = 7;</code>
+       */
+      public boolean hasMetricKey() {
+        return ((bitField0_ & 0x00000040) == 0x00000040);
+      }
+      /**
+       * <code>optional string metric_key = 7;</code>
+       */
+      public java.lang.String getMetricKey() {
+        java.lang.Object ref = metricKey_;
+        if (!(ref instanceof java.lang.String)) {
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            metricKey_ = s;
+          }
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string metric_key = 7;</code>
+       */
+      public com.google.protobuf.ByteString
+          getMetricKeyBytes() {
+        java.lang.Object ref = metricKey_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          metricKey_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string metric_key = 7;</code>
+       */
+      public Builder setMetricKey(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000040;
+        metricKey_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string metric_key = 7;</code>
+       */
+      public Builder clearMetricKey() {
+        bitField0_ = (bitField0_ & ~0x00000040);
+        metricKey_ = getDefaultInstance().getMetricKey();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string metric_key = 7;</code>
+       */
+      public Builder setMetricKeyBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000040;
+        metricKey_ = value;
+        onChanged();
+        return this;
+      }
+
+      private java.lang.Object description_ = "";
+      /**
+       * <code>optional string description = 9;</code>
+       *
+       * <pre>
+       * temporary fields during development of computation stack
+       * </pre>
+       */
+      public boolean hasDescription() {
+        return ((bitField0_ & 0x00000080) == 0x00000080);
+      }
+      /**
+       * <code>optional string description = 9;</code>
+       *
+       * <pre>
+       * temporary fields during development of computation stack
+       * </pre>
+       */
+      public java.lang.String getDescription() {
+        java.lang.Object ref = description_;
+        if (!(ref instanceof java.lang.String)) {
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            description_ = s;
+          }
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string description = 9;</code>
+       *
+       * <pre>
+       * temporary fields during development of computation stack
+       * </pre>
+       */
+      public com.google.protobuf.ByteString
+          getDescriptionBytes() {
+        java.lang.Object ref = description_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          description_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string description = 9;</code>
+       *
+       * <pre>
+       * temporary fields during development of computation stack
+       * </pre>
+       */
+      public Builder setDescription(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000080;
+        description_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string description = 9;</code>
+       *
+       * <pre>
+       * temporary fields during development of computation stack
+       * </pre>
+       */
+      public Builder clearDescription() {
+        bitField0_ = (bitField0_ & ~0x00000080);
+        description_ = getDefaultInstance().getDescription();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string description = 9;</code>
+       *
+       * <pre>
+       * temporary fields during development of computation stack
+       * </pre>
+       */
+      public Builder setDescriptionBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000080;
+        description_ = value;
+        onChanged();
+        return this;
+      }
+
+      private java.lang.Object ruleKey_ = "";
+      /**
+       * <code>optional string rule_key = 10;</code>
+       */
+      public boolean hasRuleKey() {
+        return ((bitField0_ & 0x00000100) == 0x00000100);
+      }
+      /**
+       * <code>optional string rule_key = 10;</code>
+       */
+      public java.lang.String getRuleKey() {
+        java.lang.Object ref = ruleKey_;
+        if (!(ref instanceof java.lang.String)) {
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            ruleKey_ = s;
+          }
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string rule_key = 10;</code>
+       */
+      public com.google.protobuf.ByteString
+          getRuleKeyBytes() {
+        java.lang.Object ref = ruleKey_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          ruleKey_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string rule_key = 10;</code>
+       */
+      public Builder setRuleKey(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000100;
+        ruleKey_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string rule_key = 10;</code>
+       */
+      public Builder clearRuleKey() {
+        bitField0_ = (bitField0_ & ~0x00000100);
+        ruleKey_ = getDefaultInstance().getRuleKey();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string rule_key = 10;</code>
+       */
+      public Builder setRuleKeyBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000100;
+        ruleKey_ = value;
+        onChanged();
+        return this;
+      }
+
+      private org.sonar.batch.protocol.Constants.Severity severity_ = org.sonar.batch.protocol.Constants.Severity.INFO;
+      /**
+       * <code>optional .Severity severity = 11;</code>
+       */
+      public boolean hasSeverity() {
+        return ((bitField0_ & 0x00000200) == 0x00000200);
+      }
+      /**
+       * <code>optional .Severity severity = 11;</code>
+       */
+      public org.sonar.batch.protocol.Constants.Severity getSeverity() {
+        return severity_;
+      }
+      /**
+       * <code>optional .Severity severity = 11;</code>
+       */
+      public Builder setSeverity(org.sonar.batch.protocol.Constants.Severity value) {
+        if (value == null) {
+          throw new NullPointerException();
+        }
+        bitField0_ |= 0x00000200;
+        severity_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional .Severity severity = 11;</code>
+       */
+      public Builder clearSeverity() {
+        bitField0_ = (bitField0_ & ~0x00000200);
+        severity_ = org.sonar.batch.protocol.Constants.Severity.INFO;
+        onChanged();
+        return this;
+      }
+
+      private java.lang.Object alertStatus_ = "";
+      /**
+       * <code>optional string alert_status = 12;</code>
+       */
+      public boolean hasAlertStatus() {
+        return ((bitField0_ & 0x00000400) == 0x00000400);
+      }
+      /**
+       * <code>optional string alert_status = 12;</code>
+       */
+      public java.lang.String getAlertStatus() {
+        java.lang.Object ref = alertStatus_;
+        if (!(ref instanceof java.lang.String)) {
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            alertStatus_ = s;
+          }
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string alert_status = 12;</code>
+       */
+      public com.google.protobuf.ByteString
+          getAlertStatusBytes() {
+        java.lang.Object ref = alertStatus_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          alertStatus_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string alert_status = 12;</code>
+       */
+      public Builder setAlertStatus(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000400;
+        alertStatus_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string alert_status = 12;</code>
+       */
+      public Builder clearAlertStatus() {
+        bitField0_ = (bitField0_ & ~0x00000400);
+        alertStatus_ = getDefaultInstance().getAlertStatus();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string alert_status = 12;</code>
+       */
+      public Builder setAlertStatusBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000400;
+        alertStatus_ = value;
+        onChanged();
+        return this;
+      }
+
+      private java.lang.Object alertText_ = "";
+      /**
+       * <code>optional string alert_text = 13;</code>
+       */
+      public boolean hasAlertText() {
+        return ((bitField0_ & 0x00000800) == 0x00000800);
+      }
+      /**
+       * <code>optional string alert_text = 13;</code>
+       */
+      public java.lang.String getAlertText() {
+        java.lang.Object ref = alertText_;
+        if (!(ref instanceof java.lang.String)) {
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            alertText_ = s;
+          }
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string alert_text = 13;</code>
+       */
+      public com.google.protobuf.ByteString
+          getAlertTextBytes() {
+        java.lang.Object ref = alertText_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          alertText_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string alert_text = 13;</code>
+       */
+      public Builder setAlertText(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000800;
+        alertText_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string alert_text = 13;</code>
+       */
+      public Builder clearAlertText() {
+        bitField0_ = (bitField0_ & ~0x00000800);
+        alertText_ = getDefaultInstance().getAlertText();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string alert_text = 13;</code>
+       */
+      public Builder setAlertTextBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000800;
+        alertText_ = value;
+        onChanged();
+        return this;
+      }
+
+      private double variationValue1_ ;
+      /**
+       * <code>optional double variation_value_1 = 14;</code>
+       */
+      public boolean hasVariationValue1() {
+        return ((bitField0_ & 0x00001000) == 0x00001000);
+      }
+      /**
+       * <code>optional double variation_value_1 = 14;</code>
+       */
+      public double getVariationValue1() {
+        return variationValue1_;
+      }
+      /**
+       * <code>optional double variation_value_1 = 14;</code>
+       */
+      public Builder setVariationValue1(double value) {
+        bitField0_ |= 0x00001000;
+        variationValue1_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional double variation_value_1 = 14;</code>
+       */
+      public Builder clearVariationValue1() {
+        bitField0_ = (bitField0_ & ~0x00001000);
+        variationValue1_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      private double variationValue2_ ;
+      /**
+       * <code>optional double variation_value_2 = 15;</code>
+       */
+      public boolean hasVariationValue2() {
+        return ((bitField0_ & 0x00002000) == 0x00002000);
+      }
+      /**
+       * <code>optional double variation_value_2 = 15;</code>
+       */
+      public double getVariationValue2() {
+        return variationValue2_;
+      }
+      /**
+       * <code>optional double variation_value_2 = 15;</code>
+       */
+      public Builder setVariationValue2(double value) {
+        bitField0_ |= 0x00002000;
+        variationValue2_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional double variation_value_2 = 15;</code>
+       */
+      public Builder clearVariationValue2() {
+        bitField0_ = (bitField0_ & ~0x00002000);
+        variationValue2_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      private double variationValue3_ ;
+      /**
+       * <code>optional double variation_value_3 = 16;</code>
+       */
+      public boolean hasVariationValue3() {
+        return ((bitField0_ & 0x00004000) == 0x00004000);
+      }
+      /**
+       * <code>optional double variation_value_3 = 16;</code>
+       */
+      public double getVariationValue3() {
+        return variationValue3_;
+      }
+      /**
+       * <code>optional double variation_value_3 = 16;</code>
+       */
+      public Builder setVariationValue3(double value) {
+        bitField0_ |= 0x00004000;
+        variationValue3_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional double variation_value_3 = 16;</code>
+       */
+      public Builder clearVariationValue3() {
+        bitField0_ = (bitField0_ & ~0x00004000);
+        variationValue3_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      private double variationValue4_ ;
+      /**
+       * <code>optional double variation_value_4 = 17;</code>
+       */
+      public boolean hasVariationValue4() {
+        return ((bitField0_ & 0x00008000) == 0x00008000);
+      }
+      /**
+       * <code>optional double variation_value_4 = 17;</code>
+       */
+      public double getVariationValue4() {
+        return variationValue4_;
+      }
+      /**
+       * <code>optional double variation_value_4 = 17;</code>
+       */
+      public Builder setVariationValue4(double value) {
+        bitField0_ |= 0x00008000;
+        variationValue4_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional double variation_value_4 = 17;</code>
+       */
+      public Builder clearVariationValue4() {
+        bitField0_ = (bitField0_ & ~0x00008000);
+        variationValue4_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      private double variationValue5_ ;
+      /**
+       * <code>optional double variation_value_5 = 18;</code>
+       */
+      public boolean hasVariationValue5() {
+        return ((bitField0_ & 0x00010000) == 0x00010000);
+      }
+      /**
+       * <code>optional double variation_value_5 = 18;</code>
+       */
+      public double getVariationValue5() {
+        return variationValue5_;
+      }
+      /**
+       * <code>optional double variation_value_5 = 18;</code>
+       */
+      public Builder setVariationValue5(double value) {
+        bitField0_ |= 0x00010000;
+        variationValue5_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional double variation_value_5 = 18;</code>
+       */
+      public Builder clearVariationValue5() {
+        bitField0_ = (bitField0_ & ~0x00010000);
+        variationValue5_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      private int tendency_ ;
+      /**
+       * <code>optional int32 tendency = 19;</code>
+       */
+      public boolean hasTendency() {
+        return ((bitField0_ & 0x00020000) == 0x00020000);
+      }
+      /**
+       * <code>optional int32 tendency = 19;</code>
+       */
+      public int getTendency() {
+        return tendency_;
+      }
+      /**
+       * <code>optional int32 tendency = 19;</code>
+       */
+      public Builder setTendency(int value) {
+        bitField0_ |= 0x00020000;
+        tendency_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 tendency = 19;</code>
+       */
+      public Builder clearTendency() {
+        bitField0_ = (bitField0_ & ~0x00020000);
+        tendency_ = 0;
+        onChanged();
+        return this;
+      }
+
+      private int charactericId_ ;
+      /**
+       * <code>optional int32 characteric_id = 20;</code>
+       */
+      public boolean hasCharactericId() {
+        return ((bitField0_ & 0x00040000) == 0x00040000);
+      }
+      /**
+       * <code>optional int32 characteric_id = 20;</code>
+       */
+      public int getCharactericId() {
+        return charactericId_;
+      }
+      /**
+       * <code>optional int32 characteric_id = 20;</code>
+       */
+      public Builder setCharactericId(int value) {
+        bitField0_ |= 0x00040000;
+        charactericId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 characteric_id = 20;</code>
+       */
+      public Builder clearCharactericId() {
+        bitField0_ = (bitField0_ & ~0x00040000);
+        charactericId_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:Measure)
+    }
+
+    static {
+      defaultInstance = new Measure(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:Measure)
+  }
+
+  public interface MeasuresOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:Measures)
+      com.google.protobuf.MessageOrBuilder {
+
+    /**
+     * <code>optional int32 component_ref = 1;</code>
+     */
+    boolean hasComponentRef();
+    /**
+     * <code>optional int32 component_ref = 1;</code>
+     */
+    int getComponentRef();
+
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    java.util.List<org.sonar.batch.protocol.output.BatchReport.Measure> 
+        getMeasureList();
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    org.sonar.batch.protocol.output.BatchReport.Measure getMeasure(int index);
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    int getMeasureCount();
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    java.util.List<? extends org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder> 
+        getMeasureOrBuilderList();
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder getMeasureOrBuilder(
+        int index);
+  }
+  /**
+   * Protobuf type {@code Measures}
+   */
+  public static final class Measures extends
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:Measures)
+      MeasuresOrBuilder {
+    // Use Measures.newBuilder() to construct.
+    private Measures(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Measures(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Measures defaultInstance;
+    public static Measures getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Measures getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Measures(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              componentRef_ = input.readInt32();
+              break;
+            }
+            case 18: {
+              if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
+                measure_ = new java.util.ArrayList<org.sonar.batch.protocol.output.BatchReport.Measure>();
+                mutable_bitField0_ |= 0x00000002;
+              }
+              measure_.add(input.readMessage(org.sonar.batch.protocol.output.BatchReport.Measure.PARSER, extensionRegistry));
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
+          measure_ = java.util.Collections.unmodifiableList(measure_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.sonar.batch.protocol.output.BatchReport.internal_static_Measures_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.sonar.batch.protocol.output.BatchReport.internal_static_Measures_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.sonar.batch.protocol.output.BatchReport.Measures.class, org.sonar.batch.protocol.output.BatchReport.Measures.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Measures> PARSER =
+        new com.google.protobuf.AbstractParser<Measures>() {
+      public Measures parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Measures(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Measures> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    public static final int COMPONENT_REF_FIELD_NUMBER = 1;
+    private int componentRef_;
+    /**
+     * <code>optional int32 component_ref = 1;</code>
+     */
+    public boolean hasComponentRef() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional int32 component_ref = 1;</code>
+     */
+    public int getComponentRef() {
+      return componentRef_;
+    }
+
+    public static final int MEASURE_FIELD_NUMBER = 2;
+    private java.util.List<org.sonar.batch.protocol.output.BatchReport.Measure> measure_;
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    public java.util.List<org.sonar.batch.protocol.output.BatchReport.Measure> getMeasureList() {
+      return measure_;
+    }
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    public java.util.List<? extends org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder> 
+        getMeasureOrBuilderList() {
+      return measure_;
+    }
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    public int getMeasureCount() {
+      return measure_.size();
+    }
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    public org.sonar.batch.protocol.output.BatchReport.Measure getMeasure(int index) {
+      return measure_.get(index);
+    }
+    /**
+     * <code>repeated .Measure measure = 2;</code>
+     */
+    public org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder getMeasureOrBuilder(
+        int index) {
+      return measure_.get(index);
+    }
+
+    private void initFields() {
+      componentRef_ = 0;
+      measure_ = java.util.Collections.emptyList();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt32(1, componentRef_);
+      }
+      for (int i = 0; i < measure_.size(); i++) {
+        output.writeMessage(2, measure_.get(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(1, componentRef_);
+      }
+      for (int i = 0; i < measure_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(2, measure_.get(i));
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.sonar.batch.protocol.output.BatchReport.Measures parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.sonar.batch.protocol.output.BatchReport.Measures prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code Measures}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:Measures)
+        org.sonar.batch.protocol.output.BatchReport.MeasuresOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.sonar.batch.protocol.output.BatchReport.internal_static_Measures_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.sonar.batch.protocol.output.BatchReport.internal_static_Measures_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.sonar.batch.protocol.output.BatchReport.Measures.class, org.sonar.batch.protocol.output.BatchReport.Measures.Builder.class);
+      }
+
+      // Construct using org.sonar.batch.protocol.output.BatchReport.Measures.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getMeasureFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        componentRef_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        if (measureBuilder_ == null) {
+          measure_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000002);
+        } else {
+          measureBuilder_.clear();
+        }
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.sonar.batch.protocol.output.BatchReport.internal_static_Measures_descriptor;
+      }
+
+      public org.sonar.batch.protocol.output.BatchReport.Measures getDefaultInstanceForType() {
+        return org.sonar.batch.protocol.output.BatchReport.Measures.getDefaultInstance();
+      }
+
+      public org.sonar.batch.protocol.output.BatchReport.Measures build() {
+        org.sonar.batch.protocol.output.BatchReport.Measures result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.sonar.batch.protocol.output.BatchReport.Measures buildPartial() {
+        org.sonar.batch.protocol.output.BatchReport.Measures result = new org.sonar.batch.protocol.output.BatchReport.Measures(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.componentRef_ = componentRef_;
+        if (measureBuilder_ == null) {
+          if (((bitField0_ & 0x00000002) == 0x00000002)) {
+            measure_ = java.util.Collections.unmodifiableList(measure_);
+            bitField0_ = (bitField0_ & ~0x00000002);
+          }
+          result.measure_ = measure_;
+        } else {
+          result.measure_ = measureBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.sonar.batch.protocol.output.BatchReport.Measures) {
+          return mergeFrom((org.sonar.batch.protocol.output.BatchReport.Measures)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.sonar.batch.protocol.output.BatchReport.Measures other) {
+        if (other == org.sonar.batch.protocol.output.BatchReport.Measures.getDefaultInstance()) return this;
+        if (other.hasComponentRef()) {
+          setComponentRef(other.getComponentRef());
+        }
+        if (measureBuilder_ == null) {
+          if (!other.measure_.isEmpty()) {
+            if (measure_.isEmpty()) {
+              measure_ = other.measure_;
+              bitField0_ = (bitField0_ & ~0x00000002);
+            } else {
+              ensureMeasureIsMutable();
+              measure_.addAll(other.measure_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.measure_.isEmpty()) {
+            if (measureBuilder_.isEmpty()) {
+              measureBuilder_.dispose();
+              measureBuilder_ = null;
+              measure_ = other.measure_;
+              bitField0_ = (bitField0_ & ~0x00000002);
+              measureBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getMeasureFieldBuilder() : null;
+            } else {
+              measureBuilder_.addAllMessages(other.measure_);
+            }
+          }
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
       }
-      /**
-       * <code>optional string uuid = 9;</code>
-       */
-      public java.lang.String getUuid() {
-        java.lang.Object ref = uuid_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          uuid_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.sonar.batch.protocol.output.BatchReport.Measures parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.sonar.batch.protocol.output.BatchReport.Measures) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
         }
+        return this;
       }
+      private int bitField0_;
+
+      private int componentRef_ ;
       /**
-       * <code>optional string uuid = 9;</code>
+       * <code>optional int32 component_ref = 1;</code>
        */
-      public com.google.protobuf.ByteString
-          getUuidBytes() {
-        java.lang.Object ref = uuid_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          uuid_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
+      public boolean hasComponentRef() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>optional string uuid = 9;</code>
+       * <code>optional int32 component_ref = 1;</code>
        */
-      public Builder setUuid(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000400;
-        uuid_ = value;
-        onChanged();
-        return this;
+      public int getComponentRef() {
+        return componentRef_;
       }
       /**
-       * <code>optional string uuid = 9;</code>
+       * <code>optional int32 component_ref = 1;</code>
        */
-      public Builder clearUuid() {
-        bitField0_ = (bitField0_ & ~0x00000400);
-        uuid_ = getDefaultInstance().getUuid();
+      public Builder setComponentRef(int value) {
+        bitField0_ |= 0x00000001;
+        componentRef_ = value;
         onChanged();
         return this;
       }
       /**
-       * <code>optional string uuid = 9;</code>
+       * <code>optional int32 component_ref = 1;</code>
        */
-      public Builder setUuidBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000400;
-        uuid_ = value;
+      public Builder clearComponentRef() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        componentRef_ = 0;
         onChanged();
         return this;
       }
 
-      // repeated .Event event = 11;
-      private java.util.List<org.sonar.batch.protocol.output.BatchReport.Event> event_ =
+      private java.util.List<org.sonar.batch.protocol.output.BatchReport.Measure> measure_ =
         java.util.Collections.emptyList();
-      private void ensureEventIsMutable() {
-        if (!((bitField0_ & 0x00000800) == 0x00000800)) {
-          event_ = new java.util.ArrayList<org.sonar.batch.protocol.output.BatchReport.Event>(event_);
-          bitField0_ |= 0x00000800;
+      private void ensureMeasureIsMutable() {
+        if (!((bitField0_ & 0x00000002) == 0x00000002)) {
+          measure_ = new java.util.ArrayList<org.sonar.batch.protocol.output.BatchReport.Measure>(measure_);
+          bitField0_ |= 0x00000002;
          }
       }
 
       private com.google.protobuf.RepeatedFieldBuilder<
-          org.sonar.batch.protocol.output.BatchReport.Event, org.sonar.batch.protocol.output.BatchReport.Event.Builder, org.sonar.batch.protocol.output.BatchReport.EventOrBuilder> eventBuilder_;
+          org.sonar.batch.protocol.output.BatchReport.Measure, org.sonar.batch.protocol.output.BatchReport.Measure.Builder, org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder> measureBuilder_;
 
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public java.util.List<org.sonar.batch.protocol.output.BatchReport.Event> getEventList() {
-        if (eventBuilder_ == null) {
-          return java.util.Collections.unmodifiableList(event_);
+      public java.util.List<org.sonar.batch.protocol.output.BatchReport.Measure> getMeasureList() {
+        if (measureBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(measure_);
         } else {
-          return eventBuilder_.getMessageList();
+          return measureBuilder_.getMessageList();
         }
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public int getEventCount() {
-        if (eventBuilder_ == null) {
-          return event_.size();
+      public int getMeasureCount() {
+        if (measureBuilder_ == null) {
+          return measure_.size();
         } else {
-          return eventBuilder_.getCount();
+          return measureBuilder_.getCount();
         }
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public org.sonar.batch.protocol.output.BatchReport.Event getEvent(int index) {
-        if (eventBuilder_ == null) {
-          return event_.get(index);
+      public org.sonar.batch.protocol.output.BatchReport.Measure getMeasure(int index) {
+        if (measureBuilder_ == null) {
+          return measure_.get(index);
         } else {
-          return eventBuilder_.getMessage(index);
+          return measureBuilder_.getMessage(index);
         }
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder setEvent(
-          int index, org.sonar.batch.protocol.output.BatchReport.Event value) {
-        if (eventBuilder_ == null) {
+      public Builder setMeasure(
+          int index, org.sonar.batch.protocol.output.BatchReport.Measure value) {
+        if (measureBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
           }
-          ensureEventIsMutable();
-          event_.set(index, value);
+          ensureMeasureIsMutable();
+          measure_.set(index, value);
           onChanged();
         } else {
-          eventBuilder_.setMessage(index, value);
+          measureBuilder_.setMessage(index, value);
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder setEvent(
-          int index, org.sonar.batch.protocol.output.BatchReport.Event.Builder builderForValue) {
-        if (eventBuilder_ == null) {
-          ensureEventIsMutable();
-          event_.set(index, builderForValue.build());
+      public Builder setMeasure(
+          int index, org.sonar.batch.protocol.output.BatchReport.Measure.Builder builderForValue) {
+        if (measureBuilder_ == null) {
+          ensureMeasureIsMutable();
+          measure_.set(index, builderForValue.build());
           onChanged();
         } else {
-          eventBuilder_.setMessage(index, builderForValue.build());
+          measureBuilder_.setMessage(index, builderForValue.build());
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder addEvent(org.sonar.batch.protocol.output.BatchReport.Event value) {
-        if (eventBuilder_ == null) {
+      public Builder addMeasure(org.sonar.batch.protocol.output.BatchReport.Measure value) {
+        if (measureBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
           }
-          ensureEventIsMutable();
-          event_.add(value);
+          ensureMeasureIsMutable();
+          measure_.add(value);
           onChanged();
         } else {
-          eventBuilder_.addMessage(value);
+          measureBuilder_.addMessage(value);
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder addEvent(
-          int index, org.sonar.batch.protocol.output.BatchReport.Event value) {
-        if (eventBuilder_ == null) {
+      public Builder addMeasure(
+          int index, org.sonar.batch.protocol.output.BatchReport.Measure value) {
+        if (measureBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
           }
-          ensureEventIsMutable();
-          event_.add(index, value);
+          ensureMeasureIsMutable();
+          measure_.add(index, value);
           onChanged();
         } else {
-          eventBuilder_.addMessage(index, value);
+          measureBuilder_.addMessage(index, value);
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder addEvent(
-          org.sonar.batch.protocol.output.BatchReport.Event.Builder builderForValue) {
-        if (eventBuilder_ == null) {
-          ensureEventIsMutable();
-          event_.add(builderForValue.build());
+      public Builder addMeasure(
+          org.sonar.batch.protocol.output.BatchReport.Measure.Builder builderForValue) {
+        if (measureBuilder_ == null) {
+          ensureMeasureIsMutable();
+          measure_.add(builderForValue.build());
           onChanged();
         } else {
-          eventBuilder_.addMessage(builderForValue.build());
+          measureBuilder_.addMessage(builderForValue.build());
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder addEvent(
-          int index, org.sonar.batch.protocol.output.BatchReport.Event.Builder builderForValue) {
-        if (eventBuilder_ == null) {
-          ensureEventIsMutable();
-          event_.add(index, builderForValue.build());
+      public Builder addMeasure(
+          int index, org.sonar.batch.protocol.output.BatchReport.Measure.Builder builderForValue) {
+        if (measureBuilder_ == null) {
+          ensureMeasureIsMutable();
+          measure_.add(index, builderForValue.build());
           onChanged();
         } else {
-          eventBuilder_.addMessage(index, builderForValue.build());
+          measureBuilder_.addMessage(index, builderForValue.build());
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder addAllEvent(
-          java.lang.Iterable<? extends org.sonar.batch.protocol.output.BatchReport.Event> values) {
-        if (eventBuilder_ == null) {
-          ensureEventIsMutable();
-          super.addAll(values, event_);
+      public Builder addAllMeasure(
+          java.lang.Iterable<? extends org.sonar.batch.protocol.output.BatchReport.Measure> values) {
+        if (measureBuilder_ == null) {
+          ensureMeasureIsMutable();
+          com.google.protobuf.AbstractMessageLite.Builder.addAll(
+              values, measure_);
           onChanged();
         } else {
-          eventBuilder_.addAllMessages(values);
+          measureBuilder_.addAllMessages(values);
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder clearEvent() {
-        if (eventBuilder_ == null) {
-          event_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000800);
+      public Builder clearMeasure() {
+        if (measureBuilder_ == null) {
+          measure_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000002);
           onChanged();
         } else {
-          eventBuilder_.clear();
+          measureBuilder_.clear();
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public Builder removeEvent(int index) {
-        if (eventBuilder_ == null) {
-          ensureEventIsMutable();
-          event_.remove(index);
+      public Builder removeMeasure(int index) {
+        if (measureBuilder_ == null) {
+          ensureMeasureIsMutable();
+          measure_.remove(index);
           onChanged();
         } else {
-          eventBuilder_.remove(index);
+          measureBuilder_.remove(index);
         }
         return this;
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public org.sonar.batch.protocol.output.BatchReport.Event.Builder getEventBuilder(
+      public org.sonar.batch.protocol.output.BatchReport.Measure.Builder getMeasureBuilder(
           int index) {
-        return getEventFieldBuilder().getBuilder(index);
+        return getMeasureFieldBuilder().getBuilder(index);
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public org.sonar.batch.protocol.output.BatchReport.EventOrBuilder getEventOrBuilder(
+      public org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder getMeasureOrBuilder(
           int index) {
-        if (eventBuilder_ == null) {
-          return event_.get(index);  } else {
-          return eventBuilder_.getMessageOrBuilder(index);
+        if (measureBuilder_ == null) {
+          return measure_.get(index);  } else {
+          return measureBuilder_.getMessageOrBuilder(index);
         }
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public java.util.List<? extends org.sonar.batch.protocol.output.BatchReport.EventOrBuilder> 
-           getEventOrBuilderList() {
-        if (eventBuilder_ != null) {
-          return eventBuilder_.getMessageOrBuilderList();
+      public java.util.List<? extends org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder> 
+           getMeasureOrBuilderList() {
+        if (measureBuilder_ != null) {
+          return measureBuilder_.getMessageOrBuilderList();
         } else {
-          return java.util.Collections.unmodifiableList(event_);
+          return java.util.Collections.unmodifiableList(measure_);
         }
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public org.sonar.batch.protocol.output.BatchReport.Event.Builder addEventBuilder() {
-        return getEventFieldBuilder().addBuilder(
-            org.sonar.batch.protocol.output.BatchReport.Event.getDefaultInstance());
+      public org.sonar.batch.protocol.output.BatchReport.Measure.Builder addMeasureBuilder() {
+        return getMeasureFieldBuilder().addBuilder(
+            org.sonar.batch.protocol.output.BatchReport.Measure.getDefaultInstance());
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public org.sonar.batch.protocol.output.BatchReport.Event.Builder addEventBuilder(
+      public org.sonar.batch.protocol.output.BatchReport.Measure.Builder addMeasureBuilder(
           int index) {
-        return getEventFieldBuilder().addBuilder(
-            index, org.sonar.batch.protocol.output.BatchReport.Event.getDefaultInstance());
+        return getMeasureFieldBuilder().addBuilder(
+            index, org.sonar.batch.protocol.output.BatchReport.Measure.getDefaultInstance());
       }
       /**
-       * <code>repeated .Event event = 11;</code>
+       * <code>repeated .Measure measure = 2;</code>
        */
-      public java.util.List<org.sonar.batch.protocol.output.BatchReport.Event.Builder> 
-           getEventBuilderList() {
-        return getEventFieldBuilder().getBuilderList();
+      public java.util.List<org.sonar.batch.protocol.output.BatchReport.Measure.Builder> 
+           getMeasureBuilderList() {
+        return getMeasureFieldBuilder().getBuilderList();
       }
       private com.google.protobuf.RepeatedFieldBuilder<
-          org.sonar.batch.protocol.output.BatchReport.Event, org.sonar.batch.protocol.output.BatchReport.Event.Builder, org.sonar.batch.protocol.output.BatchReport.EventOrBuilder> 
-          getEventFieldBuilder() {
-        if (eventBuilder_ == null) {
-          eventBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
-              org.sonar.batch.protocol.output.BatchReport.Event, org.sonar.batch.protocol.output.BatchReport.Event.Builder, org.sonar.batch.protocol.output.BatchReport.EventOrBuilder>(
-                  event_,
-                  ((bitField0_ & 0x00000800) == 0x00000800),
+          org.sonar.batch.protocol.output.BatchReport.Measure, org.sonar.batch.protocol.output.BatchReport.Measure.Builder, org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder> 
+          getMeasureFieldBuilder() {
+        if (measureBuilder_ == null) {
+          measureBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.sonar.batch.protocol.output.BatchReport.Measure, org.sonar.batch.protocol.output.BatchReport.Measure.Builder, org.sonar.batch.protocol.output.BatchReport.MeasureOrBuilder>(
+                  measure_,
+                  ((bitField0_ & 0x00000002) == 0x00000002),
                   getParentForChildren(),
                   isClean());
-          event_ = null;
+          measure_ = null;
         }
-        return eventBuilder_;
+        return measureBuilder_;
       }
 
-      // @@protoc_insertion_point(builder_scope:Component)
+      // @@protoc_insertion_point(builder_scope:Measures)
     }
 
     static {
-      defaultInstance = new Component(true);
+      defaultInstance = new Measures(true);
       defaultInstance.initFields();
     }
 
-    // @@protoc_insertion_point(class_scope:Component)
+    // @@protoc_insertion_point(class_scope:Measures)
   }
 
-  public interface IssueOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface IssueOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:Issue)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional string rule_repository = 1;
     /**
      * <code>optional string rule_repository = 1;</code>
      */
@@ -4775,7 +7938,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getRuleRepositoryBytes();
 
-    // optional string rule_key = 2;
     /**
      * <code>optional string rule_key = 2;</code>
      */
@@ -4790,7 +7952,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getRuleKeyBytes();
 
-    // optional int32 line = 3;
     /**
      * <code>optional int32 line = 3;</code>
      */
@@ -4800,7 +7961,6 @@ public final class BatchReport {
      */
     int getLine();
 
-    // optional string msg = 4;
     /**
      * <code>optional string msg = 4;</code>
      */
@@ -4815,7 +7975,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getMsgBytes();
 
-    // optional .Severity severity = 5;
     /**
      * <code>optional .Severity severity = 5;</code>
      */
@@ -4825,12 +7984,11 @@ public final class BatchReport {
      */
     org.sonar.batch.protocol.Constants.Severity getSeverity();
 
-    // repeated string tag = 6;
     /**
      * <code>repeated string tag = 6;</code>
      */
-    java.util.List<java.lang.String>
-    getTagList();
+    com.google.protobuf.ProtocolStringList
+        getTagList();
     /**
      * <code>repeated string tag = 6;</code>
      */
@@ -4845,7 +8003,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getTagBytes(int index);
 
-    // optional double effort_to_fix = 7;
     /**
      * <code>optional double effort_to_fix = 7;</code>
      *
@@ -4863,7 +8020,6 @@ public final class BatchReport {
      */
     double getEffortToFix();
 
-    // optional bool is_new = 8;
     /**
      * <code>optional bool is_new = 8;</code>
      */
@@ -4873,7 +8029,6 @@ public final class BatchReport {
      */
     boolean getIsNew();
 
-    // optional string uuid = 9;
     /**
      * <code>optional string uuid = 9;</code>
      */
@@ -4888,7 +8043,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getUuidBytes();
 
-    // optional int64 debt_in_minutes = 10;
     /**
      * <code>optional int64 debt_in_minutes = 10;</code>
      */
@@ -4898,7 +8052,6 @@ public final class BatchReport {
      */
     long getDebtInMinutes();
 
-    // optional string resolution = 11;
     /**
      * <code>optional string resolution = 11;</code>
      */
@@ -4913,7 +8066,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getResolutionBytes();
 
-    // optional string status = 12;
     /**
      * <code>optional string status = 12;</code>
      */
@@ -4928,7 +8080,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getStatusBytes();
 
-    // optional string checksum = 13;
     /**
      * <code>optional string checksum = 13;</code>
      */
@@ -4943,7 +8094,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getChecksumBytes();
 
-    // optional bool manual_severity = 14;
     /**
      * <code>optional bool manual_severity = 14;</code>
      */
@@ -4953,7 +8103,6 @@ public final class BatchReport {
      */
     boolean getManualSeverity();
 
-    // optional string reporter = 15;
     /**
      * <code>optional string reporter = 15;</code>
      */
@@ -4968,7 +8117,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getReporterBytes();
 
-    // optional string assignee = 16;
     /**
      * <code>optional string assignee = 16;</code>
      */
@@ -4983,7 +8131,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getAssigneeBytes();
 
-    // optional string action_plan_key = 17;
     /**
      * <code>optional string action_plan_key = 17;</code>
      */
@@ -4998,7 +8145,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getActionPlanKeyBytes();
 
-    // optional string attributes = 18;
     /**
      * <code>optional string attributes = 18;</code>
      */
@@ -5013,7 +8159,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getAttributesBytes();
 
-    // optional string author_login = 19;
     /**
      * <code>optional string author_login = 19;</code>
      */
@@ -5028,7 +8173,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getAuthorLoginBytes();
 
-    // optional int64 creation_date = 20;
     /**
      * <code>optional int64 creation_date = 20;</code>
      */
@@ -5038,7 +8182,6 @@ public final class BatchReport {
      */
     long getCreationDate();
 
-    // optional int64 close_date = 21;
     /**
      * <code>optional int64 close_date = 21;</code>
      */
@@ -5048,7 +8191,6 @@ public final class BatchReport {
      */
     long getCloseDate();
 
-    // optional int64 update_date = 22;
     /**
      * <code>optional int64 update_date = 22;</code>
      */
@@ -5058,7 +8200,6 @@ public final class BatchReport {
      */
     long getUpdateDate();
 
-    // optional int64 selected_at = 23;
     /**
      * <code>optional int64 selected_at = 23;</code>
      */
@@ -5068,7 +8209,6 @@ public final class BatchReport {
      */
     long getSelectedAt();
 
-    // optional string diff_fields = 24;
     /**
      * <code>optional string diff_fields = 24;</code>
      */
@@ -5083,7 +8223,6 @@ public final class BatchReport {
     com.google.protobuf.ByteString
         getDiffFieldsBytes();
 
-    // optional bool is_changed = 25;
     /**
      * <code>optional bool is_changed = 25;</code>
      */
@@ -5093,7 +8232,6 @@ public final class BatchReport {
      */
     boolean getIsChanged();
 
-    // optional bool must_send_notification = 26;
     /**
      * <code>optional bool must_send_notification = 26;</code>
      */
@@ -5107,8 +8245,9 @@ public final class BatchReport {
    * Protobuf type {@code Issue}
    */
   public static final class Issue extends
-      com.google.protobuf.GeneratedMessage
-      implements IssueOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:Issue)
+      IssueOrBuilder {
     // Use Issue.newBuilder() to construct.
     private Issue(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -5155,13 +8294,15 @@ public final class BatchReport {
               break;
             }
             case 10: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000001;
-              ruleRepository_ = input.readBytes();
+              ruleRepository_ = bs;
               break;
             }
             case 18: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              ruleKey_ = input.readBytes();
+              ruleKey_ = bs;
               break;
             }
             case 24: {
@@ -5170,8 +8311,9 @@ public final class BatchReport {
               break;
             }
             case 34: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000008;
-              msg_ = input.readBytes();
+              msg_ = bs;
               break;
             }
             case 40: {
@@ -5186,11 +8328,12 @@ public final class BatchReport {
               break;
             }
             case 50: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
                 tag_ = new com.google.protobuf.LazyStringArrayList();
                 mutable_bitField0_ |= 0x00000020;
               }
-              tag_.add(input.readBytes());
+              tag_.add(bs);
               break;
             }
             case 57: {
@@ -5204,8 +8347,9 @@ public final class BatchReport {
               break;
             }
             case 74: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000080;
-              uuid_ = input.readBytes();
+              uuid_ = bs;
               break;
             }
             case 80: {
@@ -5214,18 +8358,21 @@ public final class BatchReport {
               break;
             }
             case 90: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000200;
-              resolution_ = input.readBytes();
+              resolution_ = bs;
               break;
             }
             case 98: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000400;
-              status_ = input.readBytes();
+              status_ = bs;
               break;
             }
             case 106: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000800;
-              checksum_ = input.readBytes();
+              checksum_ = bs;
               break;
             }
             case 112: {
@@ -5234,28 +8381,33 @@ public final class BatchReport {
               break;
             }
             case 122: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00002000;
-              reporter_ = input.readBytes();
+              reporter_ = bs;
               break;
             }
             case 130: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00004000;
-              assignee_ = input.readBytes();
+              assignee_ = bs;
               break;
             }
             case 138: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00008000;
-              actionPlanKey_ = input.readBytes();
+              actionPlanKey_ = bs;
               break;
             }
             case 146: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00010000;
-              attributes_ = input.readBytes();
+              attributes_ = bs;
               break;
             }
             case 154: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00020000;
-              authorLogin_ = input.readBytes();
+              authorLogin_ = bs;
               break;
             }
             case 160: {
@@ -5279,8 +8431,9 @@ public final class BatchReport {
               break;
             }
             case 194: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00400000;
-              diffFields_ = input.readBytes();
+              diffFields_ = bs;
               break;
             }
             case 200: {
@@ -5302,7 +8455,7 @@ public final class BatchReport {
             e.getMessage()).setUnfinishedMessage(this);
       } finally {
         if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
-          tag_ = new com.google.protobuf.UnmodifiableLazyStringList(tag_);
+          tag_ = tag_.getUnmodifiableView();
         }
         this.unknownFields = unknownFields.build();
         makeExtensionsImmutable();
@@ -5336,7 +8489,6 @@ public final class BatchReport {
     }
 
     private int bitField0_;
-    // optional string rule_repository = 1;
     public static final int RULE_REPOSITORY_FIELD_NUMBER = 1;
     private java.lang.Object ruleRepository_;
     /**
@@ -5379,7 +8531,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string rule_key = 2;
     public static final int RULE_KEY_FIELD_NUMBER = 2;
     private java.lang.Object ruleKey_;
     /**
@@ -5422,7 +8573,6 @@ public final class BatchReport {
       }
     }
 
-    // optional int32 line = 3;
     public static final int LINE_FIELD_NUMBER = 3;
     private int line_;
     /**
@@ -5438,7 +8588,6 @@ public final class BatchReport {
       return line_;
     }
 
-    // optional string msg = 4;
     public static final int MSG_FIELD_NUMBER = 4;
     private java.lang.Object msg_;
     /**
@@ -5481,7 +8630,6 @@ public final class BatchReport {
       }
     }
 
-    // optional .Severity severity = 5;
     public static final int SEVERITY_FIELD_NUMBER = 5;
     private org.sonar.batch.protocol.Constants.Severity severity_;
     /**
@@ -5497,13 +8645,12 @@ public final class BatchReport {
       return severity_;
     }
 
-    // repeated string tag = 6;
     public static final int TAG_FIELD_NUMBER = 6;
     private com.google.protobuf.LazyStringList tag_;
     /**
      * <code>repeated string tag = 6;</code>
      */
-    public java.util.List<java.lang.String>
+    public com.google.protobuf.ProtocolStringList
         getTagList() {
       return tag_;
     }
@@ -5527,7 +8674,6 @@ public final class BatchReport {
       return tag_.getByteString(index);
     }
 
-    // optional double effort_to_fix = 7;
     public static final int EFFORT_TO_FIX_FIELD_NUMBER = 7;
     private double effortToFix_;
     /**
@@ -5551,7 +8697,6 @@ public final class BatchReport {
       return effortToFix_;
     }
 
-    // optional bool is_new = 8;
     public static final int IS_NEW_FIELD_NUMBER = 8;
     private boolean isNew_;
     /**
@@ -5567,7 +8712,6 @@ public final class BatchReport {
       return isNew_;
     }
 
-    // optional string uuid = 9;
     public static final int UUID_FIELD_NUMBER = 9;
     private java.lang.Object uuid_;
     /**
@@ -5610,7 +8754,6 @@ public final class BatchReport {
       }
     }
 
-    // optional int64 debt_in_minutes = 10;
     public static final int DEBT_IN_MINUTES_FIELD_NUMBER = 10;
     private long debtInMinutes_;
     /**
@@ -5626,7 +8769,6 @@ public final class BatchReport {
       return debtInMinutes_;
     }
 
-    // optional string resolution = 11;
     public static final int RESOLUTION_FIELD_NUMBER = 11;
     private java.lang.Object resolution_;
     /**
@@ -5669,7 +8811,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string status = 12;
     public static final int STATUS_FIELD_NUMBER = 12;
     private java.lang.Object status_;
     /**
@@ -5712,7 +8853,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string checksum = 13;
     public static final int CHECKSUM_FIELD_NUMBER = 13;
     private java.lang.Object checksum_;
     /**
@@ -5755,7 +8895,6 @@ public final class BatchReport {
       }
     }
 
-    // optional bool manual_severity = 14;
     public static final int MANUAL_SEVERITY_FIELD_NUMBER = 14;
     private boolean manualSeverity_;
     /**
@@ -5771,7 +8910,6 @@ public final class BatchReport {
       return manualSeverity_;
     }
 
-    // optional string reporter = 15;
     public static final int REPORTER_FIELD_NUMBER = 15;
     private java.lang.Object reporter_;
     /**
@@ -5814,7 +8952,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string assignee = 16;
     public static final int ASSIGNEE_FIELD_NUMBER = 16;
     private java.lang.Object assignee_;
     /**
@@ -5857,7 +8994,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string action_plan_key = 17;
     public static final int ACTION_PLAN_KEY_FIELD_NUMBER = 17;
     private java.lang.Object actionPlanKey_;
     /**
@@ -5900,7 +9036,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string attributes = 18;
     public static final int ATTRIBUTES_FIELD_NUMBER = 18;
     private java.lang.Object attributes_;
     /**
@@ -5943,7 +9078,6 @@ public final class BatchReport {
       }
     }
 
-    // optional string author_login = 19;
     public static final int AUTHOR_LOGIN_FIELD_NUMBER = 19;
     private java.lang.Object authorLogin_;
     /**
@@ -5986,7 +9120,6 @@ public final class BatchReport {
       }
     }
 
-    // optional int64 creation_date = 20;
     public static final int CREATION_DATE_FIELD_NUMBER = 20;
     private long creationDate_;
     /**
@@ -6002,7 +9135,6 @@ public final class BatchReport {
       return creationDate_;
     }
 
-    // optional int64 close_date = 21;
     public static final int CLOSE_DATE_FIELD_NUMBER = 21;
     private long closeDate_;
     /**
@@ -6018,7 +9150,6 @@ public final class BatchReport {
       return closeDate_;
     }
 
-    // optional int64 update_date = 22;
     public static final int UPDATE_DATE_FIELD_NUMBER = 22;
     private long updateDate_;
     /**
@@ -6034,7 +9165,6 @@ public final class BatchReport {
       return updateDate_;
     }
 
-    // optional int64 selected_at = 23;
     public static final int SELECTED_AT_FIELD_NUMBER = 23;
     private long selectedAt_;
     /**
@@ -6050,7 +9180,6 @@ public final class BatchReport {
       return selectedAt_;
     }
 
-    // optional string diff_fields = 24;
     public static final int DIFF_FIELDS_FIELD_NUMBER = 24;
     private java.lang.Object diffFields_;
     /**
@@ -6093,7 +9222,6 @@ public final class BatchReport {
       }
     }
 
-    // optional bool is_changed = 25;
     public static final int IS_CHANGED_FIELD_NUMBER = 25;
     private boolean isChanged_;
     /**
@@ -6109,7 +9237,6 @@ public final class BatchReport {
       return isChanged_;
     }
 
-    // optional bool must_send_notification = 26;
     public static final int MUST_SEND_NOTIFICATION_FIELD_NUMBER = 26;
     private boolean mustSendNotification_;
     /**
@@ -6156,7 +9283,8 @@ public final class BatchReport {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -6443,8 +9571,9 @@ public final class BatchReport {
      * Protobuf type {@code Issue}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.batch.protocol.output.BatchReport.IssueOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:Issue)
+        org.sonar.batch.protocol.output.BatchReport.IssueOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.batch.protocol.output.BatchReport.internal_static_Issue_descriptor;
@@ -6578,8 +9707,7 @@ public final class BatchReport {
         }
         result.severity_ = severity_;
         if (((bitField0_ & 0x00000020) == 0x00000020)) {
-          tag_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              tag_);
+          tag_ = tag_.getUnmodifiableView();
           bitField0_ = (bitField0_ & ~0x00000020);
         }
         result.tag_ = tag_;
@@ -6817,7 +9945,6 @@ public final class BatchReport {
       }
       private int bitField0_;
 
-      // optional string rule_repository = 1;
       private java.lang.Object ruleRepository_ = "";
       /**
        * <code>optional string rule_repository = 1;</code>
@@ -6831,9 +9958,12 @@ public final class BatchReport {
       public java.lang.String getRuleRepository() {
         java.lang.Object ref = ruleRepository_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          ruleRepository_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            ruleRepository_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -6891,7 +10021,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string rule_key = 2;
       private java.lang.Object ruleKey_ = "";
       /**
        * <code>optional string rule_key = 2;</code>
@@ -6905,9 +10034,12 @@ public final class BatchReport {
       public java.lang.String getRuleKey() {
         java.lang.Object ref = ruleKey_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          ruleKey_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            ruleKey_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -6965,7 +10097,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int32 line = 3;
       private int line_ ;
       /**
        * <code>optional int32 line = 3;</code>
@@ -6998,7 +10129,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string msg = 4;
       private java.lang.Object msg_ = "";
       /**
        * <code>optional string msg = 4;</code>
@@ -7012,9 +10142,12 @@ public final class BatchReport {
       public java.lang.String getMsg() {
         java.lang.Object ref = msg_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          msg_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            msg_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7072,7 +10205,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional .Severity severity = 5;
       private org.sonar.batch.protocol.Constants.Severity severity_ = org.sonar.batch.protocol.Constants.Severity.INFO;
       /**
        * <code>optional .Severity severity = 5;</code>
@@ -7108,7 +10240,6 @@ public final class BatchReport {
         return this;
       }
 
-      // repeated string tag = 6;
       private com.google.protobuf.LazyStringList tag_ = com.google.protobuf.LazyStringArrayList.EMPTY;
       private void ensureTagIsMutable() {
         if (!((bitField0_ & 0x00000020) == 0x00000020)) {
@@ -7119,9 +10250,9 @@ public final class BatchReport {
       /**
        * <code>repeated string tag = 6;</code>
        */
-      public java.util.List<java.lang.String>
+      public com.google.protobuf.ProtocolStringList
           getTagList() {
-        return java.util.Collections.unmodifiableList(tag_);
+        return tag_.getUnmodifiableView();
       }
       /**
        * <code>repeated string tag = 6;</code>
@@ -7174,7 +10305,8 @@ public final class BatchReport {
       public Builder addAllTag(
           java.lang.Iterable<java.lang.String> values) {
         ensureTagIsMutable();
-        super.addAll(values, tag_);
+        com.google.protobuf.AbstractMessageLite.Builder.addAll(
+            values, tag_);
         onChanged();
         return this;
       }
@@ -7201,7 +10333,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional double effort_to_fix = 7;
       private double effortToFix_ ;
       /**
        * <code>optional double effort_to_fix = 7;</code>
@@ -7250,7 +10381,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional bool is_new = 8;
       private boolean isNew_ ;
       /**
        * <code>optional bool is_new = 8;</code>
@@ -7283,7 +10413,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string uuid = 9;
       private java.lang.Object uuid_ = "";
       /**
        * <code>optional string uuid = 9;</code>
@@ -7297,9 +10426,12 @@ public final class BatchReport {
       public java.lang.String getUuid() {
         java.lang.Object ref = uuid_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          uuid_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            uuid_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7357,7 +10489,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int64 debt_in_minutes = 10;
       private long debtInMinutes_ ;
       /**
        * <code>optional int64 debt_in_minutes = 10;</code>
@@ -7390,7 +10521,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string resolution = 11;
       private java.lang.Object resolution_ = "";
       /**
        * <code>optional string resolution = 11;</code>
@@ -7404,9 +10534,12 @@ public final class BatchReport {
       public java.lang.String getResolution() {
         java.lang.Object ref = resolution_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          resolution_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            resolution_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7464,7 +10597,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string status = 12;
       private java.lang.Object status_ = "";
       /**
        * <code>optional string status = 12;</code>
@@ -7478,9 +10610,12 @@ public final class BatchReport {
       public java.lang.String getStatus() {
         java.lang.Object ref = status_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          status_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            status_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7538,7 +10673,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string checksum = 13;
       private java.lang.Object checksum_ = "";
       /**
        * <code>optional string checksum = 13;</code>
@@ -7552,9 +10686,12 @@ public final class BatchReport {
       public java.lang.String getChecksum() {
         java.lang.Object ref = checksum_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          checksum_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            checksum_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7612,7 +10749,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional bool manual_severity = 14;
       private boolean manualSeverity_ ;
       /**
        * <code>optional bool manual_severity = 14;</code>
@@ -7645,7 +10781,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string reporter = 15;
       private java.lang.Object reporter_ = "";
       /**
        * <code>optional string reporter = 15;</code>
@@ -7659,9 +10794,12 @@ public final class BatchReport {
       public java.lang.String getReporter() {
         java.lang.Object ref = reporter_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          reporter_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            reporter_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7719,7 +10857,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string assignee = 16;
       private java.lang.Object assignee_ = "";
       /**
        * <code>optional string assignee = 16;</code>
@@ -7733,9 +10870,12 @@ public final class BatchReport {
       public java.lang.String getAssignee() {
         java.lang.Object ref = assignee_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          assignee_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            assignee_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7793,7 +10933,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string action_plan_key = 17;
       private java.lang.Object actionPlanKey_ = "";
       /**
        * <code>optional string action_plan_key = 17;</code>
@@ -7807,9 +10946,12 @@ public final class BatchReport {
       public java.lang.String getActionPlanKey() {
         java.lang.Object ref = actionPlanKey_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          actionPlanKey_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            actionPlanKey_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7867,7 +11009,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string attributes = 18;
       private java.lang.Object attributes_ = "";
       /**
        * <code>optional string attributes = 18;</code>
@@ -7881,9 +11022,12 @@ public final class BatchReport {
       public java.lang.String getAttributes() {
         java.lang.Object ref = attributes_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          attributes_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            attributes_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -7941,7 +11085,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string author_login = 19;
       private java.lang.Object authorLogin_ = "";
       /**
        * <code>optional string author_login = 19;</code>
@@ -7955,9 +11098,12 @@ public final class BatchReport {
       public java.lang.String getAuthorLogin() {
         java.lang.Object ref = authorLogin_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          authorLogin_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            authorLogin_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -8015,7 +11161,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int64 creation_date = 20;
       private long creationDate_ ;
       /**
        * <code>optional int64 creation_date = 20;</code>
@@ -8048,7 +11193,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int64 close_date = 21;
       private long closeDate_ ;
       /**
        * <code>optional int64 close_date = 21;</code>
@@ -8081,7 +11225,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int64 update_date = 22;
       private long updateDate_ ;
       /**
        * <code>optional int64 update_date = 22;</code>
@@ -8114,7 +11257,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional int64 selected_at = 23;
       private long selectedAt_ ;
       /**
        * <code>optional int64 selected_at = 23;</code>
@@ -8147,7 +11289,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional string diff_fields = 24;
       private java.lang.Object diffFields_ = "";
       /**
        * <code>optional string diff_fields = 24;</code>
@@ -8161,9 +11302,12 @@ public final class BatchReport {
       public java.lang.String getDiffFields() {
         java.lang.Object ref = diffFields_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          diffFields_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            diffFields_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -8221,7 +11365,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional bool is_changed = 25;
       private boolean isChanged_ ;
       /**
        * <code>optional bool is_changed = 25;</code>
@@ -8254,7 +11397,6 @@ public final class BatchReport {
         return this;
       }
 
-      // optional bool must_send_notification = 26;
       private boolean mustSendNotification_ ;
       /**
        * <code>optional bool must_send_notification = 26;</code>
@@ -8298,10 +11440,10 @@ public final class BatchReport {
     // @@protoc_insertion_point(class_scope:Issue)
   }
 
-  public interface IssuesOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface IssuesOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:Issues)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional int32 component_ref = 1;
     /**
      * <code>optional int32 component_ref = 1;</code>
      */
@@ -8311,7 +11453,6 @@ public final class BatchReport {
      */
     int getComponentRef();
 
-    // repeated .Issue issue = 2;
     /**
      * <code>repeated .Issue issue = 2;</code>
      */
@@ -8336,7 +11477,6 @@ public final class BatchReport {
     org.sonar.batch.protocol.output.BatchReport.IssueOrBuilder getIssueOrBuilder(
         int index);
 
-    // optional string component_uuid = 3;
     /**
      * <code>optional string component_uuid = 3;</code>
      *
@@ -8367,8 +11507,9 @@ public final class BatchReport {
    * Protobuf type {@code Issues}
    */
   public static final class Issues extends
-      com.google.protobuf.GeneratedMessage
-      implements IssuesOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:Issues)
+      IssuesOrBuilder {
     // Use Issues.newBuilder() to construct.
     private Issues(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -8428,8 +11569,9 @@ public final class BatchReport {
               break;
             }
             case 26: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              componentUuid_ = input.readBytes();
+              componentUuid_ = bs;
               break;
             }
           }
@@ -8475,7 +11617,6 @@ public final class BatchReport {
     }
 
     private int bitField0_;
-    // optional int32 component_ref = 1;
     public static final int COMPONENT_REF_FIELD_NUMBER = 1;
     private int componentRef_;
     /**
@@ -8491,7 +11632,6 @@ public final class BatchReport {
       return componentRef_;
     }
 
-    // repeated .Issue issue = 2;
     public static final int ISSUE_FIELD_NUMBER = 2;
     private java.util.List<org.sonar.batch.protocol.output.BatchReport.Issue> issue_;
     /**
@@ -8527,7 +11667,6 @@ public final class BatchReport {
       return issue_.get(index);
     }
 
-    // optional string component_uuid = 3;
     public static final int COMPONENT_UUID_FIELD_NUMBER = 3;
     private java.lang.Object componentUuid_;
     /**
@@ -8590,7 +11729,8 @@ public final class BatchReport {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -8711,8 +11851,9 @@ public final class BatchReport {
      * Protobuf type {@code Issues}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.batch.protocol.output.BatchReport.IssuesOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:Issues)
+        org.sonar.batch.protocol.output.BatchReport.IssuesOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.batch.protocol.output.BatchReport.internal_static_Issues_descriptor;
@@ -8878,7 +12019,6 @@ public final class BatchReport {
       }
       private int bitField0_;
 
-      // optional int32 component_ref = 1;
       private int componentRef_ ;
       /**
        * <code>optional int32 component_ref = 1;</code>
@@ -8911,7 +12051,6 @@ public final class BatchReport {
         return this;
       }
 
-      // repeated .Issue issue = 2;
       private java.util.List<org.sonar.batch.protocol.output.BatchReport.Issue> issue_ =
         java.util.Collections.emptyList();
       private void ensureIssueIsMutable() {
@@ -9053,7 +12192,8 @@ public final class BatchReport {
           java.lang.Iterable<? extends org.sonar.batch.protocol.output.BatchReport.Issue> values) {
         if (issueBuilder_ == null) {
           ensureIssueIsMutable();
-          super.addAll(values, issue_);
+          com.google.protobuf.AbstractMessageLite.Builder.addAll(
+              values, issue_);
           onChanged();
         } else {
           issueBuilder_.addAllMessages(values);
@@ -9151,7 +12291,6 @@ public final class BatchReport {
         return issueBuilder_;
       }
 
-      // optional string component_uuid = 3;
       private java.lang.Object componentUuid_ = "";
       /**
        * <code>optional string component_uuid = 3;</code>
@@ -9173,9 +12312,12 @@ public final class BatchReport {
       public java.lang.String getComponentUuid() {
         java.lang.Object ref = componentUuid_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          componentUuid_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            componentUuid_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -9260,32 +12402,42 @@ public final class BatchReport {
     // @@protoc_insertion_point(class_scope:Issues)
   }
 
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_Metadata_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_Metadata_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_ComponentLink_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_ComponentLink_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_Event_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_Event_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_Component_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_Component_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
+    internal_static_Measure_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_Measure_fieldAccessorTable;
+  private static final com.google.protobuf.Descriptors.Descriptor
+    internal_static_Measures_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_Measures_fieldAccessorTable;
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_Issue_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_Issue_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_Issues_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
@@ -9308,79 +12460,106 @@ public final class BatchReport {
       "(\t\"w\n\005Event\022\025\n\rcomponent_ref\030\001 \001(\005\022\014\n\004na" +
       "me\030\002 \001(\t\022\023\n\013description\030\003 \001(\t\022 \n\010categor" +
       "y\030\004 \001(\0162\016.EventCategory\022\022\n\nevent_data\030\005 " +
-      "\001(\t\"\365\001\n\tComponent\022\013\n\003ref\030\001 \001(\005\022\014\n\004path\030\002",
+      "\001(\t\"\201\002\n\tComponent\022\013\n\003ref\030\001 \001(\005\022\014\n\004path\030\002",
       " \001(\t\022\014\n\004name\030\003 \001(\t\022\034\n\004type\030\004 \001(\0162\016.Compo" +
       "nentType\022\017\n\007is_test\030\005 \001(\010\022\020\n\010language\030\006 " +
       "\001(\t\022\025\n\tchild_ref\030\007 \003(\005B\002\020\001\022\034\n\004link\030\n \003(\013" +
-      "2\016.ComponentLink\022\017\n\007version\030\014 \001(\t\022\023\n\013sna" +
-      "pshot_id\030\010 \001(\003\022\014\n\004uuid\030\t \001(\t\022\025\n\005event\030\013 " +
-      "\003(\0132\006.Event\"\231\004\n\005Issue\022\027\n\017rule_repository" +
-      "\030\001 \001(\t\022\020\n\010rule_key\030\002 \001(\t\022\014\n\004line\030\003 \001(\005\022\013" +
-      "\n\003msg\030\004 \001(\t\022\033\n\010severity\030\005 \001(\0162\t.Severity" +
-      "\022\013\n\003tag\030\006 \003(\t\022\025\n\reffort_to_fix\030\007 \001(\001\022\016\n\006" +
-      "is_new\030\010 \001(\010\022\014\n\004uuid\030\t \001(\t\022\027\n\017debt_in_mi",
-      "nutes\030\n \001(\003\022\022\n\nresolution\030\013 \001(\t\022\016\n\006statu" +
-      "s\030\014 \001(\t\022\020\n\010checksum\030\r \001(\t\022\027\n\017manual_seve" +
-      "rity\030\016 \001(\010\022\020\n\010reporter\030\017 \001(\t\022\020\n\010assignee" +
-      "\030\020 \001(\t\022\027\n\017action_plan_key\030\021 \001(\t\022\022\n\nattri" +
-      "butes\030\022 \001(\t\022\024\n\014author_login\030\023 \001(\t\022\025\n\rcre" +
-      "ation_date\030\024 \001(\003\022\022\n\nclose_date\030\025 \001(\003\022\023\n\013" +
-      "update_date\030\026 \001(\003\022\023\n\013selected_at\030\027 \001(\003\022\023" +
-      "\n\013diff_fields\030\030 \001(\t\022\022\n\nis_changed\030\031 \001(\010\022" +
-      "\036\n\026must_send_notification\030\032 \001(\010\"N\n\006Issue" +
-      "s\022\025\n\rcomponent_ref\030\001 \001(\005\022\025\n\005issue\030\002 \003(\0132",
-      "\006.Issue\022\026\n\016component_uuid\030\003 \001(\tB#\n\037org.s" +
-      "onar.batch.protocol.outputH\001"
+      "2\016.ComponentLink\022\017\n\007version\030\014 \001(\t\022\n\n\002id\030" +
+      "\r \001(\003\022\023\n\013snapshot_id\030\010 \001(\003\022\014\n\004uuid\030\t \001(\t" +
+      "\022\025\n\005event\030\013 \003(\0132\006.Event\"\315\003\n\007Measure\022%\n\nv" +
+      "alue_type\030\001 \001(\0162\021.MeasureValueType\022\025\n\rbo" +
+      "olean_value\030\002 \001(\010\022\021\n\tint_value\030\003 \001(\005\022\022\n\n" +
+      "long_value\030\004 \001(\003\022\024\n\014double_value\030\005 \001(\001\022\024" +
+      "\n\014string_value\030\006 \001(\t\022\022\n\nmetric_key\030\007 \001(\t",
+      "\022\023\n\013description\030\t \001(\t\022\020\n\010rule_key\030\n \001(\t\022" +
+      "\033\n\010severity\030\013 \001(\0162\t.Severity\022\024\n\014alert_st" +
+      "atus\030\014 \001(\t\022\022\n\nalert_text\030\r \001(\t\022\031\n\021variat" +
+      "ion_value_1\030\016 \001(\001\022\031\n\021variation_value_2\030\017" +
+      " \001(\001\022\031\n\021variation_value_3\030\020 \001(\001\022\031\n\021varia" +
+      "tion_value_4\030\021 \001(\001\022\031\n\021variation_value_5\030" +
+      "\022 \001(\001\022\020\n\010tendency\030\023 \001(\005\022\026\n\016characteric_i" +
+      "d\030\024 \001(\005\"<\n\010Measures\022\025\n\rcomponent_ref\030\001 \001" +
+      "(\005\022\031\n\007measure\030\002 \003(\0132\010.Measure\"\231\004\n\005Issue\022" +
+      "\027\n\017rule_repository\030\001 \001(\t\022\020\n\010rule_key\030\002 \001",
+      "(\t\022\014\n\004line\030\003 \001(\005\022\013\n\003msg\030\004 \001(\t\022\033\n\010severit" +
+      "y\030\005 \001(\0162\t.Severity\022\013\n\003tag\030\006 \003(\t\022\025\n\reffor" +
+      "t_to_fix\030\007 \001(\001\022\016\n\006is_new\030\010 \001(\010\022\014\n\004uuid\030\t" +
+      " \001(\t\022\027\n\017debt_in_minutes\030\n \001(\003\022\022\n\nresolut" +
+      "ion\030\013 \001(\t\022\016\n\006status\030\014 \001(\t\022\020\n\010checksum\030\r " +
+      "\001(\t\022\027\n\017manual_severity\030\016 \001(\010\022\020\n\010reporter" +
+      "\030\017 \001(\t\022\020\n\010assignee\030\020 \001(\t\022\027\n\017action_plan_" +
+      "key\030\021 \001(\t\022\022\n\nattributes\030\022 \001(\t\022\024\n\014author_" +
+      "login\030\023 \001(\t\022\025\n\rcreation_date\030\024 \001(\003\022\022\n\ncl" +
+      "ose_date\030\025 \001(\003\022\023\n\013update_date\030\026 \001(\003\022\023\n\013s",
+      "elected_at\030\027 \001(\003\022\023\n\013diff_fields\030\030 \001(\t\022\022\n" +
+      "\nis_changed\030\031 \001(\010\022\036\n\026must_send_notificat" +
+      "ion\030\032 \001(\010\"N\n\006Issues\022\025\n\rcomponent_ref\030\001 \001" +
+      "(\005\022\025\n\005issue\030\002 \003(\0132\006.Issue\022\026\n\016component_u" +
+      "uid\030\003 \001(\tB#\n\037org.sonar.batch.protocol.ou" +
+      "tputH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
-      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
-        public com.google.protobuf.ExtensionRegistry assignDescriptors(
-            com.google.protobuf.Descriptors.FileDescriptor root) {
-          descriptor = root;
-          internal_static_Metadata_descriptor =
-            getDescriptor().getMessageTypes().get(0);
-          internal_static_Metadata_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_Metadata_descriptor,
-              new java.lang.String[] { "AnalysisDate", "ProjectKey", "RootComponentRef", "SnapshotId", "DeletedComponentsCount", });
-          internal_static_ComponentLink_descriptor =
-            getDescriptor().getMessageTypes().get(1);
-          internal_static_ComponentLink_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_ComponentLink_descriptor,
-              new java.lang.String[] { "Type", "Href", });
-          internal_static_Event_descriptor =
-            getDescriptor().getMessageTypes().get(2);
-          internal_static_Event_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_Event_descriptor,
-              new java.lang.String[] { "ComponentRef", "Name", "Description", "Category", "EventData", });
-          internal_static_Component_descriptor =
-            getDescriptor().getMessageTypes().get(3);
-          internal_static_Component_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_Component_descriptor,
-              new java.lang.String[] { "Ref", "Path", "Name", "Type", "IsTest", "Language", "ChildRef", "Link", "Version", "SnapshotId", "Uuid", "Event", });
-          internal_static_Issue_descriptor =
-            getDescriptor().getMessageTypes().get(4);
-          internal_static_Issue_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_Issue_descriptor,
-              new java.lang.String[] { "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "Tag", "EffortToFix", "IsNew", "Uuid", "DebtInMinutes", "Resolution", "Status", "Checksum", "ManualSeverity", "Reporter", "Assignee", "ActionPlanKey", "Attributes", "AuthorLogin", "CreationDate", "CloseDate", "UpdateDate", "SelectedAt", "DiffFields", "IsChanged", "MustSendNotification", });
-          internal_static_Issues_descriptor =
-            getDescriptor().getMessageTypes().get(5);
-          internal_static_Issues_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_Issues_descriptor,
-              new java.lang.String[] { "ComponentRef", "Issue", "ComponentUuid", });
-          return null;
-        }
-      };
+        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
+          public com.google.protobuf.ExtensionRegistry assignDescriptors(
+              com.google.protobuf.Descriptors.FileDescriptor root) {
+            descriptor = root;
+            return null;
+          }
+        };
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
           org.sonar.batch.protocol.Constants.getDescriptor(),
         }, assigner);
+    internal_static_Metadata_descriptor =
+      getDescriptor().getMessageTypes().get(0);
+    internal_static_Metadata_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_Metadata_descriptor,
+        new java.lang.String[] { "AnalysisDate", "ProjectKey", "RootComponentRef", "SnapshotId", "DeletedComponentsCount", });
+    internal_static_ComponentLink_descriptor =
+      getDescriptor().getMessageTypes().get(1);
+    internal_static_ComponentLink_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_ComponentLink_descriptor,
+        new java.lang.String[] { "Type", "Href", });
+    internal_static_Event_descriptor =
+      getDescriptor().getMessageTypes().get(2);
+    internal_static_Event_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_Event_descriptor,
+        new java.lang.String[] { "ComponentRef", "Name", "Description", "Category", "EventData", });
+    internal_static_Component_descriptor =
+      getDescriptor().getMessageTypes().get(3);
+    internal_static_Component_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_Component_descriptor,
+        new java.lang.String[] { "Ref", "Path", "Name", "Type", "IsTest", "Language", "ChildRef", "Link", "Version", "Id", "SnapshotId", "Uuid", "Event", });
+    internal_static_Measure_descriptor =
+      getDescriptor().getMessageTypes().get(4);
+    internal_static_Measure_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_Measure_descriptor,
+        new java.lang.String[] { "ValueType", "BooleanValue", "IntValue", "LongValue", "DoubleValue", "StringValue", "MetricKey", "Description", "RuleKey", "Severity", "AlertStatus", "AlertText", "VariationValue1", "VariationValue2", "VariationValue3", "VariationValue4", "VariationValue5", "Tendency", "CharactericId", });
+    internal_static_Measures_descriptor =
+      getDescriptor().getMessageTypes().get(5);
+    internal_static_Measures_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_Measures_descriptor,
+        new java.lang.String[] { "ComponentRef", "Measure", });
+    internal_static_Issue_descriptor =
+      getDescriptor().getMessageTypes().get(6);
+    internal_static_Issue_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_Issue_descriptor,
+        new java.lang.String[] { "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "Tag", "EffortToFix", "IsNew", "Uuid", "DebtInMinutes", "Resolution", "Status", "Checksum", "ManualSeverity", "Reporter", "Assignee", "ActionPlanKey", "Attributes", "AuthorLogin", "CreationDate", "CloseDate", "UpdateDate", "SelectedAt", "DiffFields", "IsChanged", "MustSendNotification", });
+    internal_static_Issues_descriptor =
+      getDescriptor().getMessageTypes().get(7);
+    internal_static_Issues_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_Issues_descriptor,
+        new java.lang.String[] { "ComponentRef", "Issue", "ComponentUuid", });
+    org.sonar.batch.protocol.Constants.getDescriptor();
   }
 
   // @@protoc_insertion_point(outer_class_scope)
index 6603bc8ef050390476a04f3c3e9b77f04bd95c40..8dad4b4b2b6a51bd0aed9fe1e816d7f9c30f99c1 100644 (file)
@@ -8,10 +8,10 @@ public final class FileSourceDb {
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
   }
-  public interface LineOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface LineOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:org.sonar.server.source.db.Line)
+      com.google.protobuf.MessageOrBuilder {
 
-    // optional int32 line = 1;
     /**
      * <code>optional int32 line = 1;</code>
      */
@@ -21,7 +21,6 @@ public final class FileSourceDb {
      */
     int getLine();
 
-    // optional string source = 2;
     /**
      * <code>optional string source = 2;</code>
      */
@@ -36,7 +35,6 @@ public final class FileSourceDb {
     com.google.protobuf.ByteString
         getSourceBytes();
 
-    // optional string scm_revision = 3;
     /**
      * <code>optional string scm_revision = 3;</code>
      *
@@ -63,7 +61,6 @@ public final class FileSourceDb {
     com.google.protobuf.ByteString
         getScmRevisionBytes();
 
-    // optional string scm_author = 4;
     /**
      * <code>optional string scm_author = 4;</code>
      */
@@ -78,7 +75,6 @@ public final class FileSourceDb {
     com.google.protobuf.ByteString
         getScmAuthorBytes();
 
-    // optional int64 scm_date = 5;
     /**
      * <code>optional int64 scm_date = 5;</code>
      */
@@ -88,7 +84,6 @@ public final class FileSourceDb {
      */
     long getScmDate();
 
-    // optional int32 ut_line_hits = 6;
     /**
      * <code>optional int32 ut_line_hits = 6;</code>
      *
@@ -106,7 +101,6 @@ public final class FileSourceDb {
      */
     int getUtLineHits();
 
-    // optional int32 ut_conditions = 7;
     /**
      * <code>optional int32 ut_conditions = 7;</code>
      */
@@ -116,7 +110,6 @@ public final class FileSourceDb {
      */
     int getUtConditions();
 
-    // optional int32 ut_covered_conditions = 8;
     /**
      * <code>optional int32 ut_covered_conditions = 8;</code>
      */
@@ -126,7 +119,6 @@ public final class FileSourceDb {
      */
     int getUtCoveredConditions();
 
-    // optional int32 it_line_hits = 9;
     /**
      * <code>optional int32 it_line_hits = 9;</code>
      *
@@ -144,7 +136,6 @@ public final class FileSourceDb {
      */
     int getItLineHits();
 
-    // optional int32 it_conditions = 10;
     /**
      * <code>optional int32 it_conditions = 10;</code>
      */
@@ -154,7 +145,6 @@ public final class FileSourceDb {
      */
     int getItConditions();
 
-    // optional int32 it_covered_conditions = 11;
     /**
      * <code>optional int32 it_covered_conditions = 11;</code>
      */
@@ -164,7 +154,6 @@ public final class FileSourceDb {
      */
     int getItCoveredConditions();
 
-    // optional int32 overall_line_hits = 12;
     /**
      * <code>optional int32 overall_line_hits = 12;</code>
      *
@@ -182,7 +171,6 @@ public final class FileSourceDb {
      */
     int getOverallLineHits();
 
-    // optional int32 overall_conditions = 13;
     /**
      * <code>optional int32 overall_conditions = 13;</code>
      */
@@ -192,7 +180,6 @@ public final class FileSourceDb {
      */
     int getOverallConditions();
 
-    // optional int32 overall_covered_conditions = 14;
     /**
      * <code>optional int32 overall_covered_conditions = 14;</code>
      */
@@ -202,7 +189,6 @@ public final class FileSourceDb {
      */
     int getOverallCoveredConditions();
 
-    // optional string highlighting = 15;
     /**
      * <code>optional string highlighting = 15;</code>
      */
@@ -217,7 +203,6 @@ public final class FileSourceDb {
     com.google.protobuf.ByteString
         getHighlightingBytes();
 
-    // optional string symbols = 16;
     /**
      * <code>optional string symbols = 16;</code>
      */
@@ -232,7 +217,6 @@ public final class FileSourceDb {
     com.google.protobuf.ByteString
         getSymbolsBytes();
 
-    // repeated int32 duplication = 17 [packed = true];
     /**
      * <code>repeated int32 duplication = 17 [packed = true];</code>
      */
@@ -250,8 +234,9 @@ public final class FileSourceDb {
    * Protobuf type {@code org.sonar.server.source.db.Line}
    */
   public static final class Line extends
-      com.google.protobuf.GeneratedMessage
-      implements LineOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:org.sonar.server.source.db.Line)
+      LineOrBuilder {
     // Use Line.newBuilder() to construct.
     private Line(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -303,18 +288,21 @@ public final class FileSourceDb {
               break;
             }
             case 18: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              source_ = input.readBytes();
+              source_ = bs;
               break;
             }
             case 26: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000004;
-              scmRevision_ = input.readBytes();
+              scmRevision_ = bs;
               break;
             }
             case 34: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000008;
-              scmAuthor_ = input.readBytes();
+              scmAuthor_ = bs;
               break;
             }
             case 40: {
@@ -368,13 +356,15 @@ public final class FileSourceDb {
               break;
             }
             case 122: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00004000;
-              highlighting_ = input.readBytes();
+              highlighting_ = bs;
               break;
             }
             case 130: {
+              com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00008000;
-              symbols_ = input.readBytes();
+              symbols_ = bs;
               break;
             }
             case 136: {
@@ -441,7 +431,6 @@ public final class FileSourceDb {
     }
 
     private int bitField0_;
-    // optional int32 line = 1;
     public static final int LINE_FIELD_NUMBER = 1;
     private int line_;
     /**
@@ -457,7 +446,6 @@ public final class FileSourceDb {
       return line_;
     }
 
-    // optional string source = 2;
     public static final int SOURCE_FIELD_NUMBER = 2;
     private java.lang.Object source_;
     /**
@@ -500,7 +488,6 @@ public final class FileSourceDb {
       }
     }
 
-    // optional string scm_revision = 3;
     public static final int SCM_REVISION_FIELD_NUMBER = 3;
     private java.lang.Object scmRevision_;
     /**
@@ -555,7 +542,6 @@ public final class FileSourceDb {
       }
     }
 
-    // optional string scm_author = 4;
     public static final int SCM_AUTHOR_FIELD_NUMBER = 4;
     private java.lang.Object scmAuthor_;
     /**
@@ -598,7 +584,6 @@ public final class FileSourceDb {
       }
     }
 
-    // optional int64 scm_date = 5;
     public static final int SCM_DATE_FIELD_NUMBER = 5;
     private long scmDate_;
     /**
@@ -614,7 +599,6 @@ public final class FileSourceDb {
       return scmDate_;
     }
 
-    // optional int32 ut_line_hits = 6;
     public static final int UT_LINE_HITS_FIELD_NUMBER = 6;
     private int utLineHits_;
     /**
@@ -638,7 +622,6 @@ public final class FileSourceDb {
       return utLineHits_;
     }
 
-    // optional int32 ut_conditions = 7;
     public static final int UT_CONDITIONS_FIELD_NUMBER = 7;
     private int utConditions_;
     /**
@@ -654,7 +637,6 @@ public final class FileSourceDb {
       return utConditions_;
     }
 
-    // optional int32 ut_covered_conditions = 8;
     public static final int UT_COVERED_CONDITIONS_FIELD_NUMBER = 8;
     private int utCoveredConditions_;
     /**
@@ -670,7 +652,6 @@ public final class FileSourceDb {
       return utCoveredConditions_;
     }
 
-    // optional int32 it_line_hits = 9;
     public static final int IT_LINE_HITS_FIELD_NUMBER = 9;
     private int itLineHits_;
     /**
@@ -694,7 +675,6 @@ public final class FileSourceDb {
       return itLineHits_;
     }
 
-    // optional int32 it_conditions = 10;
     public static final int IT_CONDITIONS_FIELD_NUMBER = 10;
     private int itConditions_;
     /**
@@ -710,7 +690,6 @@ public final class FileSourceDb {
       return itConditions_;
     }
 
-    // optional int32 it_covered_conditions = 11;
     public static final int IT_COVERED_CONDITIONS_FIELD_NUMBER = 11;
     private int itCoveredConditions_;
     /**
@@ -726,7 +705,6 @@ public final class FileSourceDb {
       return itCoveredConditions_;
     }
 
-    // optional int32 overall_line_hits = 12;
     public static final int OVERALL_LINE_HITS_FIELD_NUMBER = 12;
     private int overallLineHits_;
     /**
@@ -750,7 +728,6 @@ public final class FileSourceDb {
       return overallLineHits_;
     }
 
-    // optional int32 overall_conditions = 13;
     public static final int OVERALL_CONDITIONS_FIELD_NUMBER = 13;
     private int overallConditions_;
     /**
@@ -766,7 +743,6 @@ public final class FileSourceDb {
       return overallConditions_;
     }
 
-    // optional int32 overall_covered_conditions = 14;
     public static final int OVERALL_COVERED_CONDITIONS_FIELD_NUMBER = 14;
     private int overallCoveredConditions_;
     /**
@@ -782,7 +758,6 @@ public final class FileSourceDb {
       return overallCoveredConditions_;
     }
 
-    // optional string highlighting = 15;
     public static final int HIGHLIGHTING_FIELD_NUMBER = 15;
     private java.lang.Object highlighting_;
     /**
@@ -825,7 +800,6 @@ public final class FileSourceDb {
       }
     }
 
-    // optional string symbols = 16;
     public static final int SYMBOLS_FIELD_NUMBER = 16;
     private java.lang.Object symbols_;
     /**
@@ -868,7 +842,6 @@ public final class FileSourceDb {
       }
     }
 
-    // repeated int32 duplication = 17 [packed = true];
     public static final int DUPLICATION_FIELD_NUMBER = 17;
     private java.util.List<java.lang.Integer> duplication_;
     /**
@@ -914,7 +887,8 @@ public final class FileSourceDb {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -1147,8 +1121,9 @@ public final class FileSourceDb {
      * Protobuf type {@code org.sonar.server.source.db.Line}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.server.source.db.FileSourceDb.LineOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:org.sonar.server.source.db.Line)
+        org.sonar.server.source.db.FileSourceDb.LineOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.server.source.db.FileSourceDb.internal_static_org_sonar_server_source_db_Line_descriptor;
@@ -1423,7 +1398,6 @@ public final class FileSourceDb {
       }
       private int bitField0_;
 
-      // optional int32 line = 1;
       private int line_ ;
       /**
        * <code>optional int32 line = 1;</code>
@@ -1456,7 +1430,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional string source = 2;
       private java.lang.Object source_ = "";
       /**
        * <code>optional string source = 2;</code>
@@ -1470,9 +1443,12 @@ public final class FileSourceDb {
       public java.lang.String getSource() {
         java.lang.Object ref = source_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          source_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            source_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1530,7 +1506,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional string scm_revision = 3;
       private java.lang.Object scmRevision_ = "";
       /**
        * <code>optional string scm_revision = 3;</code>
@@ -1552,9 +1527,12 @@ public final class FileSourceDb {
       public java.lang.String getScmRevision() {
         java.lang.Object ref = scmRevision_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          scmRevision_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            scmRevision_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1628,7 +1606,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional string scm_author = 4;
       private java.lang.Object scmAuthor_ = "";
       /**
        * <code>optional string scm_author = 4;</code>
@@ -1642,9 +1619,12 @@ public final class FileSourceDb {
       public java.lang.String getScmAuthor() {
         java.lang.Object ref = scmAuthor_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          scmAuthor_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            scmAuthor_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -1702,7 +1682,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int64 scm_date = 5;
       private long scmDate_ ;
       /**
        * <code>optional int64 scm_date = 5;</code>
@@ -1735,7 +1714,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 ut_line_hits = 6;
       private int utLineHits_ ;
       /**
        * <code>optional int32 ut_line_hits = 6;</code>
@@ -1784,7 +1762,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 ut_conditions = 7;
       private int utConditions_ ;
       /**
        * <code>optional int32 ut_conditions = 7;</code>
@@ -1817,7 +1794,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 ut_covered_conditions = 8;
       private int utCoveredConditions_ ;
       /**
        * <code>optional int32 ut_covered_conditions = 8;</code>
@@ -1850,7 +1826,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 it_line_hits = 9;
       private int itLineHits_ ;
       /**
        * <code>optional int32 it_line_hits = 9;</code>
@@ -1899,7 +1874,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 it_conditions = 10;
       private int itConditions_ ;
       /**
        * <code>optional int32 it_conditions = 10;</code>
@@ -1932,7 +1906,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 it_covered_conditions = 11;
       private int itCoveredConditions_ ;
       /**
        * <code>optional int32 it_covered_conditions = 11;</code>
@@ -1965,7 +1938,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 overall_line_hits = 12;
       private int overallLineHits_ ;
       /**
        * <code>optional int32 overall_line_hits = 12;</code>
@@ -2014,7 +1986,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 overall_conditions = 13;
       private int overallConditions_ ;
       /**
        * <code>optional int32 overall_conditions = 13;</code>
@@ -2047,7 +2018,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional int32 overall_covered_conditions = 14;
       private int overallCoveredConditions_ ;
       /**
        * <code>optional int32 overall_covered_conditions = 14;</code>
@@ -2080,7 +2050,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional string highlighting = 15;
       private java.lang.Object highlighting_ = "";
       /**
        * <code>optional string highlighting = 15;</code>
@@ -2094,9 +2063,12 @@ public final class FileSourceDb {
       public java.lang.String getHighlighting() {
         java.lang.Object ref = highlighting_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          highlighting_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            highlighting_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2154,7 +2126,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // optional string symbols = 16;
       private java.lang.Object symbols_ = "";
       /**
        * <code>optional string symbols = 16;</code>
@@ -2168,9 +2139,12 @@ public final class FileSourceDb {
       public java.lang.String getSymbols() {
         java.lang.Object ref = symbols_;
         if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          symbols_ = s;
+          com.google.protobuf.ByteString bs =
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            symbols_ = s;
+          }
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2228,7 +2202,6 @@ public final class FileSourceDb {
         return this;
       }
 
-      // repeated int32 duplication = 17 [packed = true];
       private java.util.List<java.lang.Integer> duplication_ = java.util.Collections.emptyList();
       private void ensureDuplicationIsMutable() {
         if (!((bitField0_ & 0x00010000) == 0x00010000)) {
@@ -2280,7 +2253,8 @@ public final class FileSourceDb {
       public Builder addAllDuplication(
           java.lang.Iterable<? extends java.lang.Integer> values) {
         ensureDuplicationIsMutable();
-        super.addAll(values, duplication_);
+        com.google.protobuf.AbstractMessageLite.Builder.addAll(
+            values, duplication_);
         onChanged();
         return this;
       }
@@ -2305,10 +2279,10 @@ public final class FileSourceDb {
     // @@protoc_insertion_point(class_scope:org.sonar.server.source.db.Line)
   }
 
-  public interface DataOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
+  public interface DataOrBuilder extends
+      // @@protoc_insertion_point(interface_extends:org.sonar.server.source.db.Data)
+      com.google.protobuf.MessageOrBuilder {
 
-    // repeated .org.sonar.server.source.db.Line lines = 1;
     /**
      * <code>repeated .org.sonar.server.source.db.Line lines = 1;</code>
      */
@@ -2337,8 +2311,9 @@ public final class FileSourceDb {
    * Protobuf type {@code org.sonar.server.source.db.Data}
    */
   public static final class Data extends
-      com.google.protobuf.GeneratedMessage
-      implements DataOrBuilder {
+      com.google.protobuf.GeneratedMessage implements
+      // @@protoc_insertion_point(message_implements:org.sonar.server.source.db.Data)
+      DataOrBuilder {
     // Use Data.newBuilder() to construct.
     private Data(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
@@ -2434,7 +2409,6 @@ public final class FileSourceDb {
       return PARSER;
     }
 
-    // repeated .org.sonar.server.source.db.Line lines = 1;
     public static final int LINES_FIELD_NUMBER = 1;
     private java.util.List<org.sonar.server.source.db.FileSourceDb.Line> lines_;
     /**
@@ -2476,7 +2450,8 @@ public final class FileSourceDb {
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
+      if (isInitialized == 1) return true;
+      if (isInitialized == 0) return false;
 
       memoizedIsInitialized = 1;
       return true;
@@ -2583,8 +2558,9 @@ public final class FileSourceDb {
      * Protobuf type {@code org.sonar.server.source.db.Data}
      */
     public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.sonar.server.source.db.FileSourceDb.DataOrBuilder {
+        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
+        // @@protoc_insertion_point(builder_implements:org.sonar.server.source.db.Data)
+        org.sonar.server.source.db.FileSourceDb.DataOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
         return org.sonar.server.source.db.FileSourceDb.internal_static_org_sonar_server_source_db_Data_descriptor;
@@ -2728,7 +2704,6 @@ public final class FileSourceDb {
       }
       private int bitField0_;
 
-      // repeated .org.sonar.server.source.db.Line lines = 1;
       private java.util.List<org.sonar.server.source.db.FileSourceDb.Line> lines_ =
         java.util.Collections.emptyList();
       private void ensureLinesIsMutable() {
@@ -2870,7 +2845,8 @@ public final class FileSourceDb {
           java.lang.Iterable<? extends org.sonar.server.source.db.FileSourceDb.Line> values) {
         if (linesBuilder_ == null) {
           ensureLinesIsMutable();
-          super.addAll(values, lines_);
+          com.google.protobuf.AbstractMessageLite.Builder.addAll(
+              values, lines_);
           onChanged();
         } else {
           linesBuilder_.addAllMessages(values);
@@ -2979,12 +2955,12 @@ public final class FileSourceDb {
     // @@protoc_insertion_point(class_scope:org.sonar.server.source.db.Data)
   }
 
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_org_sonar_server_source_db_Line_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_org_sonar_server_source_db_Line_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
+  private static final com.google.protobuf.Descriptors.Descriptor
     internal_static_org_sonar_server_source_db_Data_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
@@ -3013,29 +2989,29 @@ public final class FileSourceDb {
       " .org.sonar.server.source.db.LineB\002H\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
-      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
-        public com.google.protobuf.ExtensionRegistry assignDescriptors(
-            com.google.protobuf.Descriptors.FileDescriptor root) {
-          descriptor = root;
-          internal_static_org_sonar_server_source_db_Line_descriptor =
-            getDescriptor().getMessageTypes().get(0);
-          internal_static_org_sonar_server_source_db_Line_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_sonar_server_source_db_Line_descriptor,
-              new java.lang.String[] { "Line", "Source", "ScmRevision", "ScmAuthor", "ScmDate", "UtLineHits", "UtConditions", "UtCoveredConditions", "ItLineHits", "ItConditions", "ItCoveredConditions", "OverallLineHits", "OverallConditions", "OverallCoveredConditions", "Highlighting", "Symbols", "Duplication", });
-          internal_static_org_sonar_server_source_db_Data_descriptor =
-            getDescriptor().getMessageTypes().get(1);
-          internal_static_org_sonar_server_source_db_Data_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_sonar_server_source_db_Data_descriptor,
-              new java.lang.String[] { "Lines", });
-          return null;
-        }
-      };
+        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
+          public com.google.protobuf.ExtensionRegistry assignDescriptors(
+              com.google.protobuf.Descriptors.FileDescriptor root) {
+            descriptor = root;
+            return null;
+          }
+        };
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
         }, assigner);
+    internal_static_org_sonar_server_source_db_Line_descriptor =
+      getDescriptor().getMessageTypes().get(0);
+    internal_static_org_sonar_server_source_db_Line_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_org_sonar_server_source_db_Line_descriptor,
+        new java.lang.String[] { "Line", "Source", "ScmRevision", "ScmAuthor", "ScmDate", "UtLineHits", "UtConditions", "UtCoveredConditions", "ItLineHits", "ItConditions", "ItCoveredConditions", "OverallLineHits", "OverallConditions", "OverallCoveredConditions", "Highlighting", "Symbols", "Duplication", });
+    internal_static_org_sonar_server_source_db_Data_descriptor =
+      getDescriptor().getMessageTypes().get(1);
+    internal_static_org_sonar_server_source_db_Data_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+        internal_static_org_sonar_server_source_db_Data_descriptor,
+        new java.lang.String[] { "Lines", });
   }
 
   // @@protoc_insertion_point(outer_class_scope)
index 58807f83d4029930bb87892d7d794f7753b453c6..819e23a09c1c146f8e4dbc24727b9ed17bb32067 100644 (file)
@@ -36,15 +36,25 @@ public class BatchReportReader {
 
   public BatchReport.Metadata readMetadata() {
     File file = fileStructure.metadataFile();
-    if (!file.exists() || !file.isFile()) {
+    if (isNotAnExistingFile(file)) {
       throw new IllegalStateException("Metadata file is missing in analysis report: " + file);
     }
     return ProtobufUtil.readFile(file, BatchReport.Metadata.PARSER);
   }
 
+  public List<BatchReport.Measure> readComponentMeasures(int componentRef) {
+    File file = fileStructure.fileFor(FileStructure.Domain.MEASURES, componentRef);
+    if (file.exists() && file.isFile()) {
+      // all the measures are loaded in memory
+      BatchReport.Measures measures = ProtobufUtil.readFile(file, BatchReport.Measures.PARSER);
+      return measures.getMeasureList();
+    }
+    return Collections.emptyList();
+  }
+
   public BatchReport.Component readComponent(int componentRef) {
     File file = fileStructure.fileFor(FileStructure.Domain.COMPONENT, componentRef);
-    if (!file.exists() || !file.isFile()) {
+    if (isNotAnExistingFile(file)) {
       throw new IllegalStateException("Unable to find report for component #" + componentRef + ". File does not exist: " + file);
     }
     return ProtobufUtil.readFile(file, BatchReport.Component.PARSER);
@@ -62,10 +72,14 @@ public class BatchReportReader {
 
   public Issues readDeletedComponentIssues(int deletedComponentRef) {
     File file = fileStructure.fileFor(FileStructure.Domain.ISSUES_ON_DELETED, deletedComponentRef);
-    if (!file.exists() || !file.isFile()) {
+    if (isNotAnExistingFile(file)) {
       throw new IllegalStateException("Unable to find report for deleted component #" + deletedComponentRef);
     }
     // all the issues are loaded in memory
     return ProtobufUtil.readFile(file, Issues.PARSER);
   }
+
+  private boolean isNotAnExistingFile(File file) {
+    return !file.exists() || !file.isFile();
+  }
 }
index 47f62c80b903cbc38f0bdbe9dd06f874b2602ac9..7022d1da350f507cf6b0f8bfbba37ceef1b64a88 100644 (file)
@@ -63,6 +63,14 @@ public class BatchReportWriter {
     ProtobufUtil.writeToFile(issuesBuilder.build(), file);
   }
 
+  public void writeComponentMeasures(int componentRef, Iterable<BatchReport.Measure> measures) {
+    BatchReport.Measures.Builder measuresBuilder = BatchReport.Measures.newBuilder();
+    measuresBuilder.setComponentRef(componentRef);
+    measuresBuilder.addAllMeasure(measures);
+    File file = fileStructure.fileFor(FileStructure.Domain.MEASURES, componentRef);
+    ProtobufUtil.writeToFile(measuresBuilder.build(), file);
+  }
+
   /**
    * Issues on components which have been deleted are stored in another location.
    * Temporary hack, waiting for computation stack
index 4f9529d2c3b89bd86440775c360a4db04c0d5efc..ded4fa227ab3cdff556050da6891c3f9e3b1fe7e 100644 (file)
@@ -27,7 +27,7 @@ import java.io.File;
 public class FileStructure {
 
   public static enum Domain {
-    ISSUES("issues-"), ISSUES_ON_DELETED("issues-deleted-"), COMPONENT("component-");
+    ISSUES("issues-"), ISSUES_ON_DELETED("issues-deleted-"), COMPONENT("component-"), MEASURES("measures-");
 
     private final String filePrefix;
 
index b281fd69e5709d0903827584dbb4b7618806b486..32ac04440f2ec63c5f7c8c20e3e973e16586a521 100644 (file)
@@ -36,6 +36,7 @@ Notes
 import "constants.proto";
 
 option java_package = "org.sonar.batch.protocol.output";
+
 option optimize_for = SPEED;
 
 message Metadata {
@@ -75,11 +76,41 @@ message Component {
   optional string version = 12;
 
   // temporary fields during development of computation stack
+  optional int64 id = 13;
   optional int64 snapshot_id = 8;
   optional string uuid = 9;
   repeated Event event = 11;
 }
 
+message Measure {
+  optional MeasureValueType value_type = 1;
+  optional bool boolean_value = 2;
+  optional int32 int_value = 3;
+  optional int64 long_value = 4;
+  optional double double_value = 5;
+  optional string string_value = 6;
+  optional string metric_key = 7;
+
+  // temporary fields during development of computation stack
+  optional string description = 9;
+  optional string rule_key = 10;
+  optional Severity severity = 11;
+  optional string alert_status = 12;
+  optional string alert_text = 13;
+  optional double variation_value_1 = 14;
+  optional double variation_value_2 = 15;
+  optional double variation_value_3 = 16;
+  optional double variation_value_4 = 17;
+  optional double variation_value_5 = 18;
+  optional int32 tendency = 19;
+  optional int32 characteric_id = 20;
+}
+
+message Measures {
+  optional int32 component_ref = 1;
+  repeated Measure measure = 2;
+}
+
 message Issue {
     optional string rule_repository = 1;
     optional string rule_key = 2;
index 07c8aaf35408e71c7a7623c41204ff917c8f5ebc..4955dbaaa70183bb5f2ad67ddac7611940ec3765 100644 (file)
@@ -38,6 +38,14 @@ enum ComponentType {
   SUBVIEW = 5;
 }
 
+enum MeasureValueType {
+  INT = 0;
+  LONG = 1;
+  DOUBLE = 2;
+  BOOLEAN = 3;
+  STRING = 4;
+}
+
 // temporary enum during development of computation stack
 enum EventCategory {
   ALERT = 0;
index 45117e4799984ea6f31de537783645c79ddcbbda..2766bb2efc594c7bed7e50499a169cdc62413876 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.batch.protocol.output;
 
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -35,57 +36,59 @@ public class BatchReportReaderTest {
   @Rule
   public TemporaryFolder temp = new TemporaryFolder();
 
+  BatchReportReader sut;
+
+  @Before
+  public void setUp() throws Exception {
+    sut = new BatchReportReader(temp.newFolder());
+  }
+
   @Test
   public void create_dir_if_does_not_exist() throws Exception {
     File dir = temp.newFolder();
 
     initFiles(dir);
 
-    BatchReportReader reader = new BatchReportReader(dir);
-    Metadata readMetadata = reader.readMetadata();
+    sut = new BatchReportReader(dir);
+    Metadata readMetadata = sut.readMetadata();
     assertThat(readMetadata.getAnalysisDate()).isEqualTo(15000000L);
     assertThat(readMetadata.getDeletedComponentsCount()).isEqualTo(1);
-    assertThat(reader.readComponentIssues(1)).hasSize(1);
-    assertThat(reader.readComponentIssues(200)).isEmpty();
-    assertThat(reader.readComponent(1).getUuid()).isEqualTo("UUID_A");
-    Issues deletedComponentIssues = reader.readDeletedComponentIssues(1);
+    assertThat(sut.readComponentIssues(1)).hasSize(1);
+    assertThat(sut.readComponentIssues(200)).isEmpty();
+    assertThat(sut.readComponent(1).getUuid()).isEqualTo("UUID_A");
+    Issues deletedComponentIssues = sut.readDeletedComponentIssues(1);
     assertThat(deletedComponentIssues.getComponentUuid()).isEqualTo("compUuid");
     assertThat(deletedComponentIssues.getIssueList()).hasSize(1);
+    assertThat(sut.readComponentMeasures(1)).hasSize(1);
+    assertThat(sut.readComponentMeasures(1).get(0).getStringValue()).isEqualTo("value_a");
   }
 
   @Test(expected = IllegalStateException.class)
   public void fail_if_missing_metadata_file() throws Exception {
-    File dir = temp.newFolder();
-
-    BatchReportReader reader = new BatchReportReader(dir);
-    reader.readMetadata();
+    sut.readMetadata();
   }
 
   @Test(expected = IllegalStateException.class)
-  public void fail_if_missing_file_on_deleted_component() throws Exception {
-    File dir = temp.newFolder();
-
-    BatchReportReader reader = new BatchReportReader(dir);
-    reader.readDeletedComponentIssues(666);
+   public void fail_if_missing_file_on_deleted_component() throws Exception {
+    sut.readDeletedComponentIssues(666);
   }
 
   @Test(expected = IllegalStateException.class)
   public void fail_if_missing_file_on_component() throws Exception {
-    File dir = temp.newFolder();
+    sut.readComponent(666);
+  }
 
-    BatchReportReader reader = new BatchReportReader(dir);
-    reader.readComponent(666);
+  @Test
+  public void empty_list_if_no_measure_found() throws Exception {
+    assertThat(sut.readComponentMeasures(666)).isEmpty();
   }
 
   /**
    * no file if no issues
    */
   @Test
-  public void ignore_missing_file_on_component_issues() throws Exception {
-    File dir = temp.newFolder();
-
-    BatchReportReader reader = new BatchReportReader(dir);
-    assertThat(reader.readComponentIssues(666)).isEmpty();
+  public void empty_list_if_no_issue_found() throws Exception {
+    assertThat(sut.readComponentIssues(666)).isEmpty();
   }
 
   private void initFiles(File dir) {
@@ -111,5 +114,10 @@ public class BatchReportReaderTest {
     writer.writeComponentIssues(1, Arrays.asList(issue));
 
     writer.writeDeletedComponentIssues(1, "compUuid", Arrays.asList(issue));
+
+    BatchReport.Measure.Builder measure = BatchReport.Measure.newBuilder()
+      .setStringValue("value_a");
+
+    writer.writeComponentMeasures(1, Arrays.asList(measure.build()));
   }
 }
index dd9b619687c14594aae383574142bc9b6790ab17..3bec2d5c6f0fc3cbef4d5f8c79cc490718d8f006 100644 (file)
@@ -119,6 +119,30 @@ public class BatchReportWriterTest {
     assertThat(read.getIssueCount()).isEqualTo(1);
   }
 
+  @Test
+  public void write_measures() throws Exception {
+    File dir = temp.newFolder();
+    BatchReportWriter writer = new BatchReportWriter(dir);
+
+    assertThat(writer.hasComponentData(FileStructure.Domain.MEASURES, 1)).isFalse();
+
+    BatchReport.Measure measure = BatchReport.Measure.newBuilder()
+      .setStringValue("text-value")
+      .setDoubleValue(2.5d)
+      .setValueType(Constants.MeasureValueType.DOUBLE)
+      .setDescription("description")
+      .build();
+
+    writer.writeComponentMeasures(1, Arrays.asList(measure));
+
+    assertThat(writer.hasComponentData(FileStructure.Domain.MEASURES, 1)).isTrue();
+    File file = writer.getFileStructure().fileFor(FileStructure.Domain.MEASURES, 1);
+    assertThat(file).exists().isFile();
+    BatchReport.Measures measures = ProtobufUtil.readFile(file, BatchReport.Measures.PARSER);
+    assertThat(measures.getComponentRef()).isEqualTo(1);
+    assertThat(measures.getMeasureCount()).isEqualTo(1);
+  }
+
   @Test
   public void write_issues_of_deleted_component() throws Exception {
     File dir = temp.newFolder();
index 460f3a647c4eb8f6ac6c59a816d8e684e06a662a..c077a0608616f45d72543b22776e57d00e9b7812 100644 (file)
@@ -169,7 +169,6 @@ public class DefaultTimeMachine implements TimeMachine {
     measure.setVariation3(model.getVariationValue3());
     measure.setVariation4(model.getVariationValue4());
     measure.setVariation5(model.getVariationValue5());
-    measure.setUrl(model.getUrl());
     measure.setCharacteristic(characteristic);
     measure.setPersonId(model.getPersonId());
     return measure;
index c74a8fc5bace499cdb53afae2d2fcf432f1edfa9..6559b0a7f7f690221bf049e68d04c8e861904e67 100644 (file)
@@ -111,7 +111,6 @@ public class MeasurePersister implements ScanPersister {
     model.setVariationValue3(measure.getVariation3());
     model.setVariationValue4(measure.getVariation4());
     model.setVariationValue5(measure.getVariation5());
-    model.setUrl(measure.getUrl());
     Characteristic characteristic = measure.getCharacteristic();
     if (characteristic != null) {
       model.setCharacteristicId(characteristic.id());
index d51a9009ed550c9aada719c8b75c896cc77e599b..3af2c2358526d5894147346ae06c59af0fa35b30 100644 (file)
 package org.sonar.core.measure.db;
 
 import com.google.common.base.Charsets;
-import org.sonar.core.persistence.Dto;
+import org.sonar.api.rule.Severity;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 
-public class MeasureDto extends Dto<MeasureKey>{
+import static com.google.common.base.Preconditions.checkArgument;
 
+public class MeasureDto {
   private static final String INDEX_SHOULD_BE_IN_RANGE_FROM_1_TO_5 = "Index should be in range from 1 to 5";
+  private static final int MAX_TEXT_VALUE_LENGTH = 4000;
 
   private Long id;
-
-  private String metricKey;
-
-  private String componentKey;
-
   private Double value;
-
   private String textValue;
+  private byte[] dataValue;
+  private Integer tendency;
+  private Double variation1, variation2, variation3, variation4, variation5;
+  private String alertStatus;
+  private String alertText;
+  private String description;
+  private Integer severityIndex;
 
-  private byte[] data;
-
-  protected Double variation1, variation2, variation3, variation4, variation5;
+  private Long projectId;
+  private Long snapshotId;
+  private Integer metricId;
+  private Integer ruleId;
+  private Integer characteristicId;
+  private Integer personId;
 
-  private MeasureDto(){
-    // Nothing here
-  }
+  // TODO to delete â€“ not in db
+  private String metricKey;
+  private String componentKey;
 
   public Long getId() {
     return id;
@@ -57,16 +63,6 @@ public class MeasureDto extends Dto<MeasureKey>{
     return this;
   }
 
-  private MeasureDto setMetricKey(String metricKey) {
-    this.metricKey = metricKey;
-    return this;
-  }
-
-  private MeasureDto setComponentKey(String componentKey) {
-    this.componentKey = componentKey;
-    return this;
-  }
-
   @CheckForNull
   public Double getValue() {
     return value;
@@ -77,25 +73,30 @@ public class MeasureDto extends Dto<MeasureKey>{
     return this;
   }
 
-  public MeasureDto setTextValue(String textValue) {
-    this.textValue = textValue;
-    return this;
-  }
-
-  @CheckForNull
-  public MeasureDto setData(@Nullable byte[] data) {
-    this.data = data;
-    return this;
-  }
-
   @CheckForNull
   public String getData() {
-    if (data != null) {
-      return new String(data, Charsets.UTF_8);
+    if (dataValue != null) {
+      return new String(dataValue, Charsets.UTF_8);
     }
     return textValue;
   }
 
+  public MeasureDto setData(String data) {
+    if (data == null) {
+      this.textValue = null;
+      this.dataValue = null;
+    } else if (data.length() > MAX_TEXT_VALUE_LENGTH) {
+      this.textValue = null;
+      this.dataValue = data.getBytes(Charsets.UTF_8);
+    } else {
+      this.textValue = data;
+      this.dataValue = null;
+    }
+
+    return this;
+  }
+
+  @CheckForNull
   public Double getVariation(int index) {
     switch (index) {
       case 1:
@@ -113,7 +114,7 @@ public class MeasureDto extends Dto<MeasureKey>{
     }
   }
 
-  public MeasureDto setVariation(int index, Double d) {
+  public MeasureDto setVariation(int index, @Nullable Double d) {
     switch (index) {
       case 1:
         variation1 = d;
@@ -136,14 +137,135 @@ public class MeasureDto extends Dto<MeasureKey>{
     return this;
   }
 
-  @Override
-  public MeasureKey getKey() {
-    return MeasureKey.of(componentKey, metricKey);
+  @CheckForNull
+  public Integer getTendency() {
+    return tendency;
+  }
+
+  public MeasureDto setTendency(@Nullable Integer tendency) {
+    this.tendency = tendency;
+    return this;
+  }
+
+  @CheckForNull
+  public String getAlertStatus() {
+    return alertStatus;
+  }
+
+  public MeasureDto setAlertStatus(@Nullable String alertStatus) {
+    this.alertStatus = alertStatus;
+    return this;
+  }
+
+  @CheckForNull
+  public String getAlertText() {
+    return alertText;
+  }
+
+  public MeasureDto setAlertText(@Nullable String alertText) {
+    this.alertText = alertText;
+    return this;
+  }
+
+  @CheckForNull
+  public String getDescription() {
+    return description;
+  }
+
+  public MeasureDto setDescription(@Nullable String description) {
+    this.description = description;
+    return this;
+  }
+
+  public Long getComponentId() {
+    return projectId;
+  }
+
+  public MeasureDto setComponentId(Long componentId) {
+    this.projectId = componentId;
+    return this;
+  }
+
+  public Integer getMetricId() {
+    return metricId;
+  }
+
+  public MeasureDto setMetricId(Integer metricId) {
+    this.metricId = metricId;
+    return this;
+  }
+
+  public Long getSnapshotId() {
+    return snapshotId;
+  }
+
+  public MeasureDto setSnapshotId(Long snapshotId) {
+    this.snapshotId = snapshotId;
+    return this;
+  }
+
+  public Integer getRuleId() {
+    return ruleId;
+  }
+
+  public MeasureDto setRuleId(Integer ruleId) {
+    this.ruleId = ruleId;
+    return this;
+  }
+
+  public Integer getCharacteristicId() {
+    return characteristicId;
+  }
+
+  public MeasureDto setCharacteristicId(@Nullable Integer characteristicId) {
+    this.characteristicId = characteristicId;
+    return this;
+  }
+
+  public Integer getPersonId() {
+    return personId;
+  }
+
+  public MeasureDto setPersonId(Integer personId) {
+    this.personId = personId;
+    return this;
+  }
+
+  public String getMetricKey() {
+    return metricKey;
+  }
+
+  public MeasureDto setMetricKey(String metricKey) {
+    this.metricKey = metricKey;
+    return this;
+  }
+
+  public String getComponentKey() {
+    return componentKey;
   }
 
-  public static MeasureDto createFor(MeasureKey key){
-    return new MeasureDto()
-      .setComponentKey(key.componentKey())
-      .setMetricKey(key.metricKey());
+  public MeasureDto setComponentKey(String componentKey) {
+    this.componentKey = componentKey;
+    return this;
+  }
+
+  @CheckForNull
+  public String getSeverity() {
+    if (severityIndex == null) {
+      return null;
+    }
+
+    return Severity.ALL.get(severityIndex);
+  }
+
+  public MeasureDto setSeverity(@Nullable String severity) {
+    if (severity == null) {
+      return this;
+    }
+
+    checkArgument(Severity.ALL.contains(severity), "Severity must be included in the org.sonar.api.rule.Severity values");
+
+    this.severityIndex = Severity.ALL.indexOf(severity);
+    return this;
   }
 }
diff --git a/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureKey.java b/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureKey.java
deleted file mode 100644 (file)
index 2945d98..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.core.measure.db;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-
-import java.io.Serializable;
-
-public class MeasureKey implements Serializable {
-
-  private final String componentKey;
-  private final String metricKey;
-
-  private MeasureKey(String componentKey, String metricKey) {
-    this.componentKey = componentKey;
-    this.metricKey = metricKey;
-  }
-
-  public String componentKey() {
-    return componentKey;
-  }
-
-  public String metricKey() {
-    return metricKey;
-  }
-
-  public static MeasureKey of(String componentKey, String metricKey) {
-    Preconditions.checkArgument(!Strings.isNullOrEmpty(componentKey), "Component key must be set");
-    Preconditions.checkArgument(!Strings.isNullOrEmpty(metricKey), "Metric key must be set");
-    return new MeasureKey(componentKey, metricKey);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    MeasureKey that = (MeasureKey) o;
-
-    if (!componentKey.equals(that.componentKey)) {
-      return false;
-    }
-    if (!metricKey.equals(that.metricKey)) {
-      return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = componentKey.hashCode();
-    result = 31 * result + metricKey.hashCode();
-    return result;
-  }
-}
index 572d70715cd8f79abf8017b945b30eb152115359..de8df080ea69aa1b20c6c8f2568aa066dd3d86b6 100644 (file)
@@ -28,13 +28,14 @@ import java.util.List;
 
 public interface MeasureMapper {
 
-  MeasureDto selectByKey(@Param("key") MeasureKey key);
+  MeasureDto selectByKey(@Param("componentKey") String componentKey, @Param("metricKey") String metricKey);
 
   List<MeasureDto> selectByComponentAndMetrics(@Param("componentKey") String componentKey, @Param("metricKeys") List<String> metricKeys);
 
   @CheckForNull
   MeasureDto selectByComponentAndMetric(@Param("componentKey") String componentKey, @Param("metricKey") String metricKey);
 
-  long countByKey(@Param("key") MeasureKey key);
+  long countByComponentAndMetric(@Param("componentKey") String componentKey, @Param("metricKey") String metricKey);
 
+  void insert(MeasureDto measureDto);
 }
index be3805f5661a90010e6197333d1d3e9310eabbf4..9b1fff40e278700cc83967ab684af039fdd3ec4b 100644 (file)
@@ -33,7 +33,7 @@ import javax.annotation.Nullable;
 
 import java.util.*;
 
-public final class RuleDto extends Dto<RuleKey> {
+public class RuleDto extends Dto<RuleKey> {
 
   public static final Integer DISABLED_CHARACTERISTIC_ID = -1;
 
index 0964ff196f108777f36a070006dceea7925e3ef4..288eccb685d03d9bd2937ad06b75e97087e5c5c4 100644 (file)
@@ -8,7 +8,7 @@
     pm.snapshot_id as snapshotId,
     pm.value as value,
     pm.text_value as textValue,
-    pm.measure_data as data,
+    pm.measure_data as dataValue,
     pm.variation_value_1 as variation1,
     pm.variation_value_2 as variation2,
     pm.variation_value_3 as variation3,
     metric.name as metricKey
   </sql>
 
-  <select id="selectByKey" parameterType="map" resultType="Measure">
-    SELECT
-    <include refid="measureColumns"/>
-    FROM project_measures pm
-    INNER JOIN snapshots s ON s.id=pm.snapshot_id AND s.islast=${_true}
-    INNER JOIN metrics metric ON metric.id=pm.metric_id
-    INNER JOIN projects p ON p.id=s.project_id AND p.enabled=${_true}
-    <where>
-      AND p.kee = #{key.componentKey}
-      AND metric.name = #{key.metricKey}
-      AND pm.rule_id IS NULL
-      AND pm.characteristic_id IS NULL
-      AND pm.person_id IS NULL
-    </where>
-  </select>
-
-  <select id="selectByComponentAndMetrics" parameterType="map" resultType="Measure">
+  <select id="selectByComponentAndMetric" parameterType="map" resultType="Measure">
     SELECT metric.name as metric_name,
     <include refid="measureColumns"/>
     FROM project_measures pm
     INNER JOIN metrics metric ON metric.id=pm.metric_id
     <where>
       AND p.kee = #{componentKey}
-      AND <foreach item="metricKey" index="index" collection="metricKeys" open="(" separator=" or " close=")">metric.name=#{metricKey}</foreach>
+      AND metric.name=#{metricKey}
       AND pm.rule_id IS NULL
       AND pm.characteristic_id IS NULL
       AND pm.person_id IS NULL
     </where>
   </select>
 
-  <select id="selectByComponentAndMetric" parameterType="map" resultType="Measure">
+  <select id="selectByComponentAndMetrics" parameterType="map" resultType="Measure">
     SELECT metric.name as metric_name,
     <include refid="measureColumns"/>
     FROM project_measures pm
     INNER JOIN metrics metric ON metric.id=pm.metric_id
     <where>
       AND p.kee = #{componentKey}
-      AND metric.name=#{metricKey}
+      AND
+      <foreach item="metricKey" index="index" collection="metricKeys" open="(" separator=" or " close=")">
+        metric.name=#{metricKey}
+      </foreach>
       AND pm.rule_id IS NULL
       AND pm.characteristic_id IS NULL
       AND pm.person_id IS NULL
     </where>
   </select>
 
-  <select id="countByKey" parameterType="map" resultType="long">
+  <select id="countByComponentAndMetric" parameterType="map" resultType="long">
     SELECT count(pm.id)
     FROM project_measures pm
     INNER JOIN snapshots s ON s.id=pm.snapshot_id AND s.islast=${_true}
     INNER JOIN metrics metric ON metric.id=pm.metric_id
     INNER JOIN projects p ON p.id=s.project_id AND p.enabled=${_true}
     <where>
-      AND p.kee = #{key.componentKey}
-      AND metric.name = #{key.metricKey}
+      AND p.kee = #{componentKey}
+      AND metric.name = #{metricKey}
       AND pm.rule_id IS NULL
       AND pm.characteristic_id IS NULL
       AND pm.person_id IS NULL
     </where>
   </select>
 
+  <insert id="insert" parameterType="Measure" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+    INSERT INTO project_measures (
+    value, metric_id, snapshot_id, rule_id, text_value, tendency, project_id, alert_status, alert_text, description,
+    rule_priority, characteristic_id, variation_value_1, variation_value_2, variation_value_3, variation_value_4,
+    variation_value_5, measure_data)
+    VALUES (
+    #{value, jdbcType=DOUBLE}, #{metricId, jdbcType=INTEGER}, #{snapshotId, jdbcType=INTEGER},
+    #{ruleId, jdbcType=INTEGER}, #{textValue, jdbcType=VARCHAR}, #{tendency, jdbcType=INTEGER},
+    #{projectId, jdbcType=INTEGER}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
+    #{description, jdbcType=VARCHAR}, #{severityIndex, jdbcType=INTEGER}, #{characteristicId, jdbcType=INTEGER},
+    #{variation1, jdbcType=DOUBLE}, #{variation2, jdbcType=DOUBLE}, #{variation3, jdbcType=DOUBLE},
+    #{variation4, jdbcType=DOUBLE}, #{variation5, jdbcType=DOUBLE}, #{dataValue, jdbcType=BINARY}
+    )
+  </insert>
+
 </mapper>
index 81aecce817173a02c27fb5245ab083b8192e2751..e75676287e87088414876a050a55020da5828002 100644 (file)
 
 package org.sonar.core.measure.db;
 
+import com.google.common.base.Strings;
 import org.junit.Test;
+import org.sonar.api.rule.Severity;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
 
 public class MeasureDtoTest {
 
+  MeasureDto sut = new MeasureDto();
+
   @Test
   public void test_getter_and_setter() throws Exception {
-    MeasureDto measureDto = MeasureDto.createFor(MeasureKey.of("component", "metric"))
+    sut
+      .setComponentKey("component")
+      .setMetricKey("metric")
       .setId(10L)
       .setValue(2d)
-      .setTextValue("text value")
-      .setData(new byte[]{})
+      .setData("text value")
       .setVariation(1, 1d)
       .setVariation(2, 2d)
       .setVariation(3, 3d)
       .setVariation(4, 4d)
       .setVariation(5, 5d);
 
-    assertThat(measureDto.getId()).isEqualTo(10);
-    assertThat(measureDto.getValue()).isEqualTo(2d);
-    assertThat(measureDto.getData()).isNotNull();
-    assertThat(measureDto.getVariation(1)).isEqualTo(1d);
-    assertThat(measureDto.getVariation(2)).isEqualTo(2d);
-    assertThat(measureDto.getVariation(3)).isEqualTo(3d);
-    assertThat(measureDto.getVariation(4)).isEqualTo(4d);
-    assertThat(measureDto.getVariation(5)).isEqualTo(5d);
+    assertThat(sut.getId()).isEqualTo(10);
+    assertThat(sut.getValue()).isEqualTo(2d);
+    assertThat(sut.getData()).isNotNull();
+    assertThat(sut.getVariation(1)).isEqualTo(1d);
+    assertThat(sut.getVariation(2)).isEqualTo(2d);
+    assertThat(sut.getVariation(3)).isEqualTo(3d);
+    assertThat(sut.getVariation(4)).isEqualTo(4d);
+    assertThat(sut.getVariation(5)).isEqualTo(5d);
   }
 
   @Test
-  public void test_data() throws Exception {
-    assertThat(MeasureDto.createFor(MeasureKey.of("component", "metric"))
-      .setTextValue("text value")
-      .setData(null).getData()).isEqualTo("text value");
-
-    assertThat(MeasureDto.createFor(MeasureKey.of("component", "metric"))
-      .setTextValue(null)
-      .setData(new byte[]{}).getData()).isNotNull();
+  public void value_with_text_over_4000_characters() throws Exception {
+    assertThat(sut.setData(Strings.repeat("1", 4001)).getData()).isNotNull();
   }
 
   @Test
+  public void text_value_under_4000_characters() throws Exception {
+    assertThat(sut.setData("text value").getData()).isEqualTo("text value");
+  }
+
+  @Test(expected = IndexOutOfBoundsException.class)
   public void fail_to_set_out_of_bounds_variation() throws Exception {
-    try {
-      MeasureDto.createFor(MeasureKey.of("component", "metric"))
-        .setVariation(6, 1d);
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IndexOutOfBoundsException.class);
-    }
+    sut.setVariation(6, 1d);
   }
 
-  @Test
+  @Test(expected = IndexOutOfBoundsException.class)
   public void fail_to_get_out_of_bounds_variation() throws Exception {
-    try {
-      MeasureDto.createFor(MeasureKey.of("component", "metric"))
-        .getVariation(6);
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IndexOutOfBoundsException.class);
+    sut.getVariation(6);
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void fail_if_non_existent_severity() throws Exception {
+    sut.setSeverity("MAYOR");
+  }
+
+  @Test
+  public void severity_values_are_retrieved() throws Exception {
+    assertThat(sut.getSeverity()).isNull();
+
+    for (String severity : Severity.ALL) {
+      sut = new MeasureDto().setSeverity(severity);
+      assertThat(sut.getSeverity()).isEqualTo(severity);
     }
   }
 }
diff --git a/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureKeyTest.java b/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureKeyTest.java
deleted file mode 100644 (file)
index 342aa6e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.core.measure.db;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class MeasureKeyTest {
-
-  @Test
-  public void create_key() throws Exception {
-    MeasureKey key = MeasureKey.of("sample", "ncloc");
-    assertThat(key.componentKey()).isEqualTo("sample");
-    assertThat(key.metricKey()).isEqualTo("ncloc");
-  }
-
-  @Test
-  public void component_key_must_not_be_null() throws Exception {
-    try {
-      MeasureKey.of(null, "ncloc");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Component key must be set");
-    }
-  }
-
-  @Test
-  public void metric_key_must_not_be_null() throws Exception {
-    try {
-      MeasureKey.of("sample", null);
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Metric key must be set");
-    }
-  }
-
-  @Test
-  public void test_equals_and_hashcode() throws Exception {
-    MeasureKey key1 = MeasureKey.of("sample", "ncloc");
-    MeasureKey key2 = MeasureKey.of("sample", "ncloc");
-    MeasureKey key3 = MeasureKey.of("sample", "coverage");
-    MeasureKey key4 = MeasureKey.of("sample2", "coverage");
-
-    assertThat(key1).isEqualTo(key1);
-    assertThat(key1).isEqualTo(key2);
-    assertThat(key1).isNotEqualTo(key3);
-    assertThat(key3).isNotEqualTo(key4);
-    assertThat(key1).isNotEqualTo(null);
-    assertThat(key1.hashCode()).isEqualTo(key1.hashCode());
-    assertThat(key1.hashCode()).isEqualTo(key2.hashCode());
-  }
-}
index 39c3a397b78198ea7d1a2dcf5a212fd70e4a5d4e..3d5ff943f92f7b980b78e6b152a74e0a49339045 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.core.persistence;
 
-import com.google.common.base.Objects;
 import com.google.common.collect.Maps;
 import com.google.common.io.Closeables;
 import org.apache.commons.io.FileUtils;
@@ -31,11 +30,7 @@ import org.dbunit.DatabaseUnitException;
 import org.dbunit.IDatabaseTester;
 import org.dbunit.database.DatabaseConfig;
 import org.dbunit.database.IDatabaseConnection;
-import org.dbunit.dataset.CompositeDataSet;
-import org.dbunit.dataset.DataSetException;
-import org.dbunit.dataset.IDataSet;
-import org.dbunit.dataset.ITable;
-import org.dbunit.dataset.ReplacementDataSet;
+import org.dbunit.dataset.*;
 import org.dbunit.dataset.filter.DefaultColumnFilter;
 import org.dbunit.dataset.xml.FlatXmlDataSet;
 import org.dbunit.ext.mssql.InsertIdentityOperation;
@@ -103,12 +98,6 @@ public abstract class AbstractDaoTestCase {
     }
   }
 
-  @Before
-  public void startDbUnit() throws Exception {
-    databaseCommands.truncateDatabase(database.getDataSource());
-    databaseTester = new DataSourceDatabaseTester(database.getDataSource(), databaseCommands.useLoginAsSchema() ? login : null);
-  }
-
   /**
    * Orchestrator is the name of a SonarSource close-source library for database and integration testing.
    */
@@ -142,6 +131,18 @@ public abstract class AbstractDaoTestCase {
     }
   }
 
+  private static RuntimeException translateException(String msg, Exception cause) {
+    RuntimeException runtimeException = new RuntimeException(String.format("%s: [%s] %s", msg, cause.getClass().getName(), cause.getMessage()));
+    runtimeException.setStackTrace(cause.getStackTrace());
+    return runtimeException;
+  }
+
+  @Before
+  public void startDbUnit() throws Exception {
+    databaseCommands.truncateDatabase(database.getDataSource());
+    databaseTester = new DataSourceDatabaseTester(database.getDataSource(), databaseCommands.useLoginAsSchema() ? login : null);
+  }
+
   protected MyBatis getMyBatis() {
     return myBatis;
   }
@@ -294,12 +295,6 @@ public abstract class AbstractDaoTestCase {
     }
   }
 
-  private static RuntimeException translateException(String msg, Exception cause) {
-    RuntimeException runtimeException = new RuntimeException(String.format("%s: [%s] %s", msg, cause.getClass().getName(), cause.getMessage()));
-    runtimeException.setStackTrace(cause.getStackTrace());
-    return runtimeException;
-  }
-
   protected Connection getConnection() throws SQLException {
     return database.getDataSource().getConnection();
   }