diff --git a/server/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityIndexDefinition.java index 38a8fff0a4e8..a67224f95a7e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityIndexDefinition.java +++ b/server/sonar-server/src/main/java/org/sonar/server/activity/index/ActivityIndexDefinition.java @@ -20,9 +20,8 @@ package org.sonar.server.activity.index; import com.google.common.collect.ImmutableMap; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.sonar.api.config.Settings; -import org.sonar.process.ProcessProperties; +import org.sonar.server.es.EsUtils; import org.sonar.server.es.IndexDefinition; import org.sonar.server.es.NewIndex; @@ -50,16 +49,9 @@ public ActivityIndexDefinition(Settings settings) { @Override public void define(IndexDefinitionContext context) { NewIndex index = context.create(INDEX); - index.getSettings().put("index.refresh_interval", "-1"); index.getSettings().put("analysis.analyzer.default.type", "keyword"); - - // shards - boolean clusterMode = settings.getBoolean(ProcessProperties.CLUSTER_ACTIVATE); - if (clusterMode) { - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 4); - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1); - // else keep defaults (one shard) - } + EsUtils.refreshHandledByIndexer(index); + EsUtils.setShards(index, settings); // type "activity" NewIndex.NewIndexType mapping = index.createType(TYPE); diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java b/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java index 45d253555b31..0945ee219901 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java @@ -28,7 +28,7 @@ public BaseIndex(EsClient client) { this.client = client; } - public EsClient getClient() { + protected EsClient getClient() { return client; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/EsUtils.java b/server/sonar-server/src/main/java/org/sonar/server/es/EsUtils.java index 5c2f6f8e37ae..2eda91efb5fd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/EsUtils.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/EsUtils.java @@ -21,10 +21,13 @@ import com.google.common.base.Function; import com.google.common.collect.Lists; +import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.joda.time.format.ISODateTimeFormat; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.aggregations.bucket.terms.Terms; +import org.sonar.api.config.Settings; +import org.sonar.process.ProcessProperties; import org.sonar.server.search.BaseDoc; import javax.annotation.CheckForNull; @@ -79,4 +82,17 @@ public static String formatDateTime(@Nullable Date date) { } return null; } + + public static void setShards(NewIndex index, Settings settings) { + boolean clusterMode = settings.getBoolean(ProcessProperties.CLUSTER_ACTIVATE); + if (clusterMode) { + index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 4); + index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1); + // else keep defaults (one shard) + } + } + + public static void refreshHandledByIndexer(NewIndex index) { + index.getSettings().put("index.refresh_interval", "-1"); + } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java b/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java index 22493030b9e7..611c1c5ec929 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java @@ -27,7 +27,6 @@ import org.sonar.server.search.IndexField; import javax.annotation.CheckForNull; - import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; @@ -72,6 +71,10 @@ public StringFieldBuilder stringFieldBuilder(String fieldName) { return new StringFieldBuilder(this, fieldName); } + public NestedObjectBuilder nestedObjectBuilder(String fieldName, NewIndexType nestedMapping) { + return new NestedObjectBuilder(this, nestedMapping, fieldName); + } + public NewIndexType createBooleanField(String fieldName) { return setProperty(fieldName, ImmutableMap.of("type", "boolean")); } @@ -97,7 +100,7 @@ public NewIndexType createLongField(String fieldName) { } public NewIndexType createDynamicNestedField(String fieldName) { - return setProperty(fieldName, ImmutableMap.of("type", "nested", "dynamic", "true")); + return setProperty(fieldName, ImmutableMap.of("type", "nested", "dynamic", "true", "include_in_parent", "true")); } public NewIndexType createShortField(String fieldName) { @@ -121,6 +124,33 @@ public Object getProperty(String key) { } } + public static class NestedObjectBuilder { + private final NewIndexType indexType; + private final NewIndexType nestedType; + private final String fieldName; + private boolean dynamic = false; + + public NestedObjectBuilder(NewIndexType indexType, NewIndexType nestedType, String fieldName) { + this.indexType = indexType; + this.nestedType = nestedType; + this.fieldName = fieldName; + } + + public NestedObjectBuilder dynamic() { + this.dynamic = true; + return this; + } + + public void build() { + if (dynamic) { + indexType.setProperty(fieldName, ImmutableMap.of("type", "nested", "dynamic", "true")); + } else { + nestedType.setAttribute("type", "nested"); + indexType.setProperty(fieldName, nestedType.attributes); + } + } + } + /** * Helper to define a string field in mapping of index type */ diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java index 9f6b25f6f969..571852be309d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java @@ -20,9 +20,8 @@ package org.sonar.server.issue.index; import com.google.common.collect.ImmutableMap; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.sonar.api.config.Settings; -import org.sonar.process.ProcessProperties; +import org.sonar.server.es.EsUtils; import org.sonar.server.es.IndexDefinition; import org.sonar.server.es.NewIndex; @@ -93,16 +92,8 @@ public IssueIndexDefinition(Settings settings) { public void define(IndexDefinitionContext context) { NewIndex index = context.create(INDEX); - // refresh is handled by IssueIndexer - index.getSettings().put("index.refresh_interval", "-1"); - - // shards - boolean clusterMode = settings.getBoolean(ProcessProperties.CLUSTER_ACTIVATE); - if (clusterMode) { - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 4); - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1); - // else keep defaults (one shard) - } + EsUtils.refreshHandledByIndexer(index); + EsUtils.setShards(index, settings); // type "authorization" NewIndex.NewIndexType authorizationMapping = index.createType(TYPE_AUTHORIZATION); diff --git a/server/sonar-server/src/main/java/org/sonar/server/source/index/SourceLineIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/source/index/SourceLineIndexDefinition.java index d80f57f6496d..ecae43895683 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/source/index/SourceLineIndexDefinition.java +++ b/server/sonar-server/src/main/java/org/sonar/server/source/index/SourceLineIndexDefinition.java @@ -20,9 +20,8 @@ package org.sonar.server.source.index; import com.google.common.collect.ImmutableMap; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.sonar.api.config.Settings; -import org.sonar.process.ProcessProperties; +import org.sonar.server.es.EsUtils; import org.sonar.server.es.IndexDefinition; import org.sonar.server.es.NewIndex; @@ -61,16 +60,8 @@ public SourceLineIndexDefinition(Settings settings) { public void define(IndexDefinitionContext context) { NewIndex index = context.create(INDEX); - // refresh is always handled by SourceLineIndexer - index.getSettings().put("index.refresh_interval", "-1"); - - // shards - boolean clusterMode = settings.getBoolean(ProcessProperties.CLUSTER_ACTIVATE); - if (clusterMode) { - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 4); - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1); - // else keep defaults (one shard) - } + EsUtils.refreshHandledByIndexer(index); + EsUtils.setShards(index, settings); // type "sourceline" NewIndex.NewIndexType mapping = index.createType(TYPE); diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/index/TestDoc.java b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestDoc.java new file mode 100644 index 000000000000..511bf9ba33d1 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestDoc.java @@ -0,0 +1,105 @@ +/* + * 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.test.index; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.Maps; +import org.sonar.server.search.BaseDoc; + +import java.util.List; +import java.util.Map; + +import static org.sonar.server.test.index.TestIndexDefinition.*; + +public class TestDoc extends BaseDoc { + public TestDoc(Map fields) { + super(fields); + } + + @VisibleForTesting + TestDoc() { + super(Maps.newHashMapWithExpectedSize(7)); + } + + public String uuid() { + return getField(FIELD_UUID); + } + + public TestDoc setUuid(String uuid) { + setField(FIELD_UUID, uuid); + return this; + } + + public String name() { + return getField(FIELD_NAME); + } + + public TestDoc setName(String name) { + setField(FIELD_NAME, name); + return this; + } + + public String status() { + return getField(FIELD_STATUS); + } + + public TestDoc setStatus(String status) { + setField(FIELD_STATUS, status); + return this; + } + + public String message() { + return getField(FIELD_MESSAGE); + } + + public TestDoc setMessage(String message) { + setField(FIELD_MESSAGE, message); + return this; + } + + public String stackTrace() { + return getField(FIELD_STACKTRACE); + } + + public TestDoc setStackTrace(String stackTrace) { + setField(FIELD_STACKTRACE, stackTrace); + return this; + } + + public String type() { + return getField(FIELD_TYPE); + } + + public TestDoc setType(String type) { + setField(FIELD_TYPE, type); + return this; + } + + // TODO TBE - it should be a CoverageBlockDoc list + public List> coverageBlocks() { + return getField(FIELD_COVERAGE_BLOCKS); + } + + public TestDoc setCoverageBlocks(List> coverageBlocks) { + setField(FIELD_COVERAGE_BLOCKS, coverageBlocks); + return this; + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndex.java b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndex.java new file mode 100644 index 000000000000..dce696199abb --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndex.java @@ -0,0 +1,85 @@ +/* + * 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.test.index; + +import org.elasticsearch.index.query.FilterBuilders; +import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.search.SearchHit; +import org.sonar.server.es.BaseIndex; +import org.sonar.server.es.EsClient; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.sonar.server.test.index.TestIndexDefinition.*; + +public class TestIndex extends BaseIndex { + public TestIndex(EsClient client) { + super(client); + } + + public List> coveredLines(String testFileUuid, String methodName) { + List> coverageBlocks = new ArrayList<>(); + + for (SearchHit hit : getClient().prepareSearch(TestIndexDefinition.INDEX) + .setTypes(TestIndexDefinition.TYPE) + .setSize(1) + .setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.boolFilter() + .must(FilterBuilders.termFilter(FIELD_UUID, testFileUuid).cache(false)) + .must(FilterBuilders.termFilter(TestIndexDefinition.FIELD_NAME, methodName).cache(false)))) + .get().getHits().getHits()) { + coverageBlocks.addAll(new TestDoc(hit.sourceAsMap()).coverageBlocks()); + } + + return coverageBlocks; + } + + public List testMethods(String testFileUuid) { + List testDocs = new ArrayList<>(); + + for (SearchHit hit : getClient().prepareSearch(TestIndexDefinition.INDEX) + .setTypes(TestIndexDefinition.TYPE) + .setSize(10_000) + .setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.termFilter(FIELD_UUID, testFileUuid))) + .get().getHits().getHits()) { + testDocs.add(new TestDoc(hit.sourceAsMap())); + } + + return testDocs; + } + + public List testsCovering(String mainFileUuid, int line) { + List testDocs = new ArrayList<>(); + + for (SearchHit hit : getClient().prepareSearch(TestIndexDefinition.INDEX) + .setTypes(TestIndexDefinition.TYPE) + .setSize(10_000) + .setQuery(QueryBuilders.nestedQuery(FIELD_COVERAGE_BLOCKS, FilterBuilders.boolFilter() + .must(FilterBuilders.termFilter(FIELD_COVERAGE_BLOCKS + "." + FIELD_COVERAGE_BLOCK_UUID, mainFileUuid).cache(false)) + .must(FilterBuilders.termFilter(FIELD_COVERAGE_BLOCKS + "." + FIELD_COVERAGE_BLOCK_LINES, line).cache(false)))) + .get().getHits().getHits()) { + testDocs.add(new TestDoc(hit.sourceAsMap())); + } + + return testDocs; + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexDefinition.java new file mode 100644 index 000000000000..c4de32f3bf2f --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/test/index/TestIndexDefinition.java @@ -0,0 +1,71 @@ +/* + * 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.test.index; + +import org.sonar.api.config.Settings; +import org.sonar.server.es.EsUtils; +import org.sonar.server.es.IndexDefinition; +import org.sonar.server.es.NewIndex; + +public class TestIndexDefinition implements IndexDefinition { + public static final String INDEX = "tests"; + public static final String TYPE = "test"; + public static final String FIELD_UUID = "uuid"; + public static final String FIELD_NAME = "name"; + public static final String FIELD_STATUS = "status"; + public static final String FIELD_MESSAGE = "message"; + public static final String FIELD_STACKTRACE = "stacktrace"; + public static final String FIELD_TYPE = "type"; + public static final String FIELD_COVERAGE_BLOCKS = "coverageBlocks"; + public static final String FIELD_COVERAGE_BLOCK_UUID = "uuid"; + public static final String FIELD_COVERAGE_BLOCK_KEY = "key"; + public static final String FIELD_COVERAGE_BLOCK_LINES = "lines"; + public static final String FIELD_COVERAGE_BLOCK_COVERED_LINES = "coveredLines"; + + private final Settings settings; + + public TestIndexDefinition(Settings settings) { + this.settings = settings; + } + + @Override + public void define(IndexDefinitionContext context) { + NewIndex index = context.create(INDEX); + + EsUtils.refreshHandledByIndexer(index); + EsUtils.setShards(index, settings); + + NewIndex.NewIndexType nestedMapping = index.createType(TYPE); + nestedMapping.stringFieldBuilder(FIELD_COVERAGE_BLOCK_KEY).build(); + nestedMapping.stringFieldBuilder(FIELD_COVERAGE_BLOCK_UUID).build(); + nestedMapping.createIntegerField(FIELD_COVERAGE_BLOCK_LINES); + nestedMapping.createIntegerField(FIELD_COVERAGE_BLOCK_COVERED_LINES); + + NewIndex.NewIndexType mapping = index.createType(TYPE); + mapping.stringFieldBuilder(FIELD_UUID).build(); + mapping.stringFieldBuilder(FIELD_NAME).build(); + mapping.stringFieldBuilder(FIELD_STATUS).disableSearch().build(); + mapping.stringFieldBuilder(FIELD_MESSAGE).disableSearch().build(); + mapping.stringFieldBuilder(FIELD_STACKTRACE).disableSearch().build(); + mapping.stringFieldBuilder(FIELD_TYPE).disableSearch().build(); + mapping.nestedObjectBuilder(FIELD_COVERAGE_BLOCKS, nestedMapping).build(); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/index/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/test/index/package-info.java new file mode 100644 index 000000000000..8cc52cb76a2e --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/test/index/package-info.java @@ -0,0 +1,25 @@ +/* + * 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. + */ + +@ParametersAreNonnullByDefault +package org.sonar.server.test.index; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndexDefinition.java index 68a191aab1fa..5c158a7d1dbf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndexDefinition.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndexDefinition.java @@ -20,9 +20,8 @@ package org.sonar.server.user.index; import com.google.common.collect.ImmutableMap; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.sonar.api.config.Settings; -import org.sonar.process.ProcessProperties; +import org.sonar.server.es.EsUtils; import org.sonar.server.es.IndexDefinition; import org.sonar.server.es.NewIndex; @@ -53,13 +52,7 @@ public UserIndexDefinition(Settings settings) { public void define(IndexDefinitionContext context) { NewIndex index = context.create(INDEX); - // shards - boolean clusterMode = settings.getBoolean(ProcessProperties.CLUSTER_ACTIVATE); - if (clusterMode) { - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 4); - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1); - // else keep defaults (one shard) - } + EsUtils.setShards(index, settings); // type "user" NewIndex.NewIndexType mapping = index.createType(TYPE_USER); diff --git a/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndexDefinition.java index 3fe2be97a98b..bb6f746fa921 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndexDefinition.java +++ b/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndexDefinition.java @@ -21,9 +21,8 @@ package org.sonar.server.view.index; import com.google.common.collect.ImmutableMap; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.sonar.api.config.Settings; -import org.sonar.process.ProcessProperties; +import org.sonar.server.es.EsUtils; import org.sonar.server.es.IndexDefinition; import org.sonar.server.es.NewIndex; @@ -49,13 +48,7 @@ public ViewIndexDefinition(Settings settings) { public void define(IndexDefinitionContext context) { NewIndex index = context.create(INDEX); - // shards - boolean clusterMode = settings.getBoolean(ProcessProperties.CLUSTER_ACTIVATE); - if (clusterMode) { - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 4); - index.getSettings().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1); - // else keep defaults (one shard) - } + EsUtils.setShards(index, settings); // type "view" NewIndex.NewIndexType mapping = index.createType(TYPE_VIEW); diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/index/TestIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/index/TestIndexTest.java new file mode 100644 index 000000000000..54102e827e72 --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/test/index/TestIndexTest.java @@ -0,0 +1,104 @@ +/* + * 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.test.index; + +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; +import org.sonar.api.config.Settings; +import org.sonar.server.es.EsTester; + +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; + +public class TestIndexTest { + @ClassRule + public static EsTester es = new EsTester().addDefinitions(new TestIndexDefinition(new Settings())); + + TestIndex sut = new TestIndex(es.client()); + + @Before + public void before() throws Exception { + es.truncateIndices(); + } + + @Test + public void lines_covered_a_test_method() throws Exception { + es.putDocuments(TestIndexDefinition.INDEX, TestIndexDefinition.TYPE, + newTestDoc("1", newCoverageBlock("3"), newCoverageBlock("4"), newCoverageBlock("5")), + newTestDoc("2", newCoverageBlock("5"), newCoverageBlock("6"), newCoverageBlock("7"))); + + List> result = sut.coveredLines("uuid-1", "name-1"); + + assertThat(result).hasSize(3); + assertThat(result.get(0).get("uuid")).isEqualTo("main-uuid-3"); + assertThat((List)result.get(0).get("lines")).containsOnly(25, 33, 82); + } + + @Test + public void test_methods() throws Exception { + es.putDocuments(TestIndexDefinition.INDEX, TestIndexDefinition.TYPE, + newTestDoc("1", newCoverageBlock("3"), newCoverageBlock("4"), newCoverageBlock("5")), + newTestDoc("1", newCoverageBlock("5"), newCoverageBlock("6"), newCoverageBlock("7"))); + + List result = sut.testMethods("uuid-1"); + + assertThat(result).hasSize(2); + } + + @Test + public void test_covering() throws Exception { + List> coverageBlocks = new ArrayList<>(); + coverageBlocks.add(newCoverageBlock("1")); + coverageBlocks.add(newCoverageBlock("2")); + coverageBlocks.add(newCoverageBlock("3")); + + es.putDocuments(TestIndexDefinition.INDEX, TestIndexDefinition.TYPE, + newTestDoc("1", newCoverageBlock("3"), newCoverageBlock("4"), newCoverageBlock("5")), + newTestDoc("1", newCoverageBlock("5"), newCoverageBlock("6"), newCoverageBlock("7"))); + + List result = sut.testsCovering("main-uuid-5", 82); + + assertThat(result).hasSize(2); + assertThat(result.get(0).name()).isEqualTo("name-1"); + assertThat(result.get(0).coverageBlocks().get(0).get("uuid")).isEqualTo("main-uuid-3"); + } + + private Map newCoverageBlock(String id) { + Map coverageBlock = new HashMap<>(); + coverageBlock.put("key", "project:file-" + id); + coverageBlock.put("uuid", "main-uuid-" + id); + coverageBlock.put("lines", Arrays.asList(25, 33, 82)); + return coverageBlock; + } + + private TestDoc newTestDoc(String id, Map... coverageBlocks) { + return new TestDoc() + .setName("name-" + id) + .setMessage("message-" + id) + .setStackTrace("stacktrace-" + id) + .setStatus("status-" + id) + .setType("type-" + id) + .setUuid("uuid-" + id) + .setCoverageBlocks(Arrays.asList(coverageBlocks)); + } +} diff --git a/server/sonar-server/src/test/resources/org/sonar/server/component/db/ComponentDaoTest/select_module_files_tree.xml b/server/sonar-server/src/test/resources/org/sonar/server/component/db/ComponentDaoTest/select_module_files_tree.xml index 20e8797e9d44..0bfa9cfb70cd 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/component/db/ComponentDaoTest/select_module_files_tree.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/component/db/ComponentDaoTest/select_module_files_tree.xml @@ -21,6 +21,7 @@ diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/IndexSourceLinesStepTest/update_source_date_on_sources_with_update_at_to_zero.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/IndexSourceLinesStepTest/update_source_date_on_sources_with_update_at_to_zero.xml index 311357173485..63608752e315 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/IndexSourceLinesStepTest/update_source_date_on_sources_with_update_at_to_zero.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/IndexSourceLinesStepTest/update_source_date_on_sources_with_update_at_to_zero.xml @@ -2,6 +2,7 @@ diff --git a/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/schema.sql index 859eefe36254..abfc5bbcd87b 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/schema.sql +++ b/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/schema.sql @@ -4,6 +4,7 @@ CREATE TABLE "FILE_SOURCES" ( "PROJECT_UUID" VARCHAR(50) NOT NULL, "FILE_UUID" VARCHAR(50) NOT NULL, "BINARY_DATA" BINARY(167772150), + "TEST_DATA" BINARY(167772150), "DATA_HASH" VARCHAR(50) NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL diff --git a/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/shared.xml index f56c7f5a7960..caba05c55b66 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceFileResultSetIteratorTest/shared.xml @@ -1,6 +1,6 @@ + binary_data="" test_data="[null]" data_hash="" /> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceLineIndexerTest/db.xml b/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceLineIndexerTest/db.xml index 48e58478ab6c..4ed570abc884 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceLineIndexerTest/db.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/source/index/SourceLineIndexerTest/db.xml @@ -1,6 +1,6 @@ + binary_data="" test_data="[null]" data_hash="DATA_HASH" /> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml index 4dcc5c21ee0b..baf6790601ab 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml @@ -6,6 +6,7 @@ diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/909_add_file_sources_test_data.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/909_add_file_sources_test_data.rb new file mode 100644 index 000000000000..134ee56b27b6 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/909_add_file_sources_test_data.rb @@ -0,0 +1,31 @@ +# +# 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. +# + +# +# SonarQube 5.2 +# SONAR-6255 +# +class AddFileSourcesTestData < ActiveRecord::Migration + + def self.up + add_column 'file_sources', 'test_data', :binary, :null => true + end + +end diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java index 1e58e9104fbf..b8b01b3d317c 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java @@ -684,6 +684,188 @@ private HighlightingType(int index, int value) { // @@protoc_insertion_point(enum_scope:HighlightingType) } + /** + * Protobuf enum {@code TestType} + */ + public enum TestType + implements com.google.protobuf.ProtocolMessageEnum { + /** + * UT = 1; + */ + UT(0, 1), + /** + * IT = 2; + */ + IT(1, 2), + ; + + /** + * UT = 1; + */ + public static final int UT_VALUE = 1; + /** + * IT = 2; + */ + public static final int IT_VALUE = 2; + + + public final int getNumber() { return value; } + + public static TestType valueOf(int value) { + switch (value) { + case 1: return UT; + case 2: return IT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public TestType findValueByNumber(int number) { + return TestType.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(6); + } + + private static final TestType[] VALUES = values(); + + public static TestType 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 TestType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:TestType) + } + + /** + * Protobuf enum {@code TestResultStatus} + */ + public enum TestResultStatus + implements com.google.protobuf.ProtocolMessageEnum { + /** + * OK = 1; + */ + OK(0, 1), + /** + * FAILURE = 2; + */ + FAILURE(1, 2), + /** + * ERROR = 3; + */ + ERROR(2, 3), + /** + * SKIPPED = 4; + */ + SKIPPED(3, 4), + ; + + /** + * OK = 1; + */ + public static final int OK_VALUE = 1; + /** + * FAILURE = 2; + */ + public static final int FAILURE_VALUE = 2; + /** + * ERROR = 3; + */ + public static final int ERROR_VALUE = 3; + /** + * SKIPPED = 4; + */ + public static final int SKIPPED_VALUE = 4; + + + public final int getNumber() { return value; } + + public static TestResultStatus valueOf(int value) { + switch (value) { + case 1: return OK; + case 2: return FAILURE; + case 3: return ERROR; + case 4: return SKIPPED; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public TestResultStatus findValueByNumber(int number) { + return TestResultStatus.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(7); + } + + private static final TestResultStatus[] VALUES = values(); + + public static TestResultStatus 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 TestResultStatus(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:TestResultStatus) + } + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -706,8 +888,10 @@ private HighlightingType(int index, int value) { "ON\020\000\022\014\n\010CONSTANT\020\001\022\013\n\007COMMENT\020\002\022\013\n\007CPP_D" + "OC\020\003\022\026\n\022STRUCTURED_COMMENT\020\004\022\013\n\007KEYWORD\020" + "\005\022\027\n\023HIGHLIGHTING_STRING\020\006\022\021\n\rKEYWORD_LI" + - "GHT\020\007\022\030\n\024PREPROCESS_DIRECTIVE\020\010B\034\n\030org.s" + - "onar.batch.protocolH\001" + "GHT\020\007\022\030\n\024PREPROCESS_DIRECTIVE\020\010*\032\n\010TestT" + + "ype\022\006\n\002UT\020\001\022\006\n\002IT\020\002*?\n\020TestResultStatus\022" + + "\006\n\002OK\020\001\022\013\n\007FAILURE\020\002\022\t\n\005ERROR\020\003\022\013\n\007SKIPP" + + "ED\020\004B\034\n\030org.sonar.batch.protocolH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java index 4b04e4ff9e2e..207941776504 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java @@ -21081,6 +21081,1881 @@ public Builder clearType() { // @@protoc_insertion_point(class_scope:SyntaxHighlighting) } + public interface TestResultOrBuilder extends + // @@protoc_insertion_point(interface_extends:TestResult) + com.google.protobuf.MessageOrBuilder { + + /** + * optional int32 test_file_ref = 1; + */ + boolean hasTestFileRef(); + /** + * optional int32 test_file_ref = 1; + */ + int getTestFileRef(); + + /** + * optional .TestType type = 2; + */ + boolean hasType(); + /** + * optional .TestType type = 2; + */ + org.sonar.batch.protocol.Constants.TestType getType(); + + /** + * optional .TestResultStatus status = 3; + */ + boolean hasStatus(); + /** + * optional .TestResultStatus status = 3; + */ + org.sonar.batch.protocol.Constants.TestResultStatus getStatus(); + + /** + * optional int64 duration_in_ms = 4; + */ + boolean hasDurationInMs(); + /** + * optional int64 duration_in_ms = 4; + */ + long getDurationInMs(); + + /** + * optional string stacktrace = 5; + */ + boolean hasStacktrace(); + /** + * optional string stacktrace = 5; + */ + java.lang.String getStacktrace(); + /** + * optional string stacktrace = 5; + */ + com.google.protobuf.ByteString + getStacktraceBytes(); + + /** + * optional string msg = 6; + */ + boolean hasMsg(); + /** + * optional string msg = 6; + */ + java.lang.String getMsg(); + /** + * optional string msg = 6; + */ + com.google.protobuf.ByteString + getMsgBytes(); + + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + java.util.List + getCoverageBlockList(); + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock getCoverageBlock(int index); + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + int getCoverageBlockCount(); + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + java.util.List + getCoverageBlockOrBuilderList(); + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlockOrBuilder getCoverageBlockOrBuilder( + int index); + } + /** + * Protobuf type {@code TestResult} + */ + public static final class TestResult extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:TestResult) + TestResultOrBuilder { + // Use TestResult.newBuilder() to construct. + private TestResult(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private TestResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final TestResult defaultInstance; + public static TestResult getDefaultInstance() { + return defaultInstance; + } + + public TestResult getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private TestResult( + 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; + testFileRef_ = input.readInt32(); + break; + } + case 16: { + int rawValue = input.readEnum(); + org.sonar.batch.protocol.Constants.TestType value = org.sonar.batch.protocol.Constants.TestType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + type_ = value; + } + break; + } + case 24: { + int rawValue = input.readEnum(); + org.sonar.batch.protocol.Constants.TestResultStatus value = org.sonar.batch.protocol.Constants.TestResultStatus.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(3, rawValue); + } else { + bitField0_ |= 0x00000004; + status_ = value; + } + break; + } + case 32: { + bitField0_ |= 0x00000008; + durationInMs_ = input.readInt64(); + break; + } + case 42: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000010; + stacktrace_ = bs; + break; + } + case 50: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000020; + msg_ = bs; + break; + } + case 58: { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000040; + } + coverageBlock_.add(input.readMessage(org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.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_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = java.util.Collections.unmodifiableList(coverageBlock_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.batch.protocol.output.BatchReport.TestResult.class, org.sonar.batch.protocol.output.BatchReport.TestResult.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public TestResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TestResult(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public interface CoverageBlockOrBuilder extends + // @@protoc_insertion_point(interface_extends:TestResult.CoverageBlock) + com.google.protobuf.MessageOrBuilder { + + /** + * optional int32 file_ref = 1; + */ + boolean hasFileRef(); + /** + * optional int32 file_ref = 1; + */ + int getFileRef(); + + /** + * repeated int32 line = 2; + */ + java.util.List getLineList(); + /** + * repeated int32 line = 2; + */ + int getLineCount(); + /** + * repeated int32 line = 2; + */ + int getLine(int index); + } + /** + * Protobuf type {@code TestResult.CoverageBlock} + */ + public static final class CoverageBlock extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:TestResult.CoverageBlock) + CoverageBlockOrBuilder { + // Use CoverageBlock.newBuilder() to construct. + private CoverageBlock(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CoverageBlock(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CoverageBlock defaultInstance; + public static CoverageBlock getDefaultInstance() { + return defaultInstance; + } + + public CoverageBlock getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CoverageBlock( + 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; + fileRef_ = input.readInt32(); + break; + } + case 16: { + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + line_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + line_.add(input.readInt32()); + break; + } + case 18: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { + line_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + while (input.getBytesUntilLimit() > 0) { + line_.add(input.readInt32()); + } + input.popLimit(limit); + 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)) { + line_ = java.util.Collections.unmodifiableList(line_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_CoverageBlock_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_CoverageBlock_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.class, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CoverageBlock parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CoverageBlock(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + public static final int FILE_REF_FIELD_NUMBER = 1; + private int fileRef_; + /** + * optional int32 file_ref = 1; + */ + public boolean hasFileRef() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional int32 file_ref = 1; + */ + public int getFileRef() { + return fileRef_; + } + + public static final int LINE_FIELD_NUMBER = 2; + private java.util.List line_; + /** + * repeated int32 line = 2; + */ + public java.util.List + getLineList() { + return line_; + } + /** + * repeated int32 line = 2; + */ + public int getLineCount() { + return line_.size(); + } + /** + * repeated int32 line = 2; + */ + public int getLine(int index) { + return line_.get(index); + } + + private void initFields() { + fileRef_ = 0; + line_ = 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, fileRef_); + } + for (int i = 0; i < line_.size(); i++) { + output.writeInt32(2, line_.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, fileRef_); + } + { + int dataSize = 0; + for (int i = 0; i < line_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(line_.get(i)); + } + size += dataSize; + size += 1 * getLineList().size(); + } + 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.TestResult.CoverageBlock parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock 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.TestResult.CoverageBlock parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock 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.TestResult.CoverageBlock parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock 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.TestResult.CoverageBlock parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock 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.TestResult.CoverageBlock parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock 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.TestResult.CoverageBlock 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 TestResult.CoverageBlock} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:TestResult.CoverageBlock) + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlockOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_CoverageBlock_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_CoverageBlock_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.class, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder.class); + } + + // Construct using org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.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(); + fileRef_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + line_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + 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_TestResult_CoverageBlock_descriptor; + } + + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock getDefaultInstanceForType() { + return org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.getDefaultInstance(); + } + + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock build() { + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock buildPartial() { + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock result = new org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fileRef_ = fileRef_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + line_ = java.util.Collections.unmodifiableList(line_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.line_ = line_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock) { + return mergeFrom((org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock other) { + if (other == org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.getDefaultInstance()) return this; + if (other.hasFileRef()) { + setFileRef(other.getFileRef()); + } + if (!other.line_.isEmpty()) { + if (line_.isEmpty()) { + line_ = other.line_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureLineIsMutable(); + line_.addAll(other.line_); + } + onChanged(); + } + 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.TestResult.CoverageBlock parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int fileRef_ ; + /** + * optional int32 file_ref = 1; + */ + public boolean hasFileRef() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional int32 file_ref = 1; + */ + public int getFileRef() { + return fileRef_; + } + /** + * optional int32 file_ref = 1; + */ + public Builder setFileRef(int value) { + bitField0_ |= 0x00000001; + fileRef_ = value; + onChanged(); + return this; + } + /** + * optional int32 file_ref = 1; + */ + public Builder clearFileRef() { + bitField0_ = (bitField0_ & ~0x00000001); + fileRef_ = 0; + onChanged(); + return this; + } + + private java.util.List line_ = java.util.Collections.emptyList(); + private void ensureLineIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + line_ = new java.util.ArrayList(line_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated int32 line = 2; + */ + public java.util.List + getLineList() { + return java.util.Collections.unmodifiableList(line_); + } + /** + * repeated int32 line = 2; + */ + public int getLineCount() { + return line_.size(); + } + /** + * repeated int32 line = 2; + */ + public int getLine(int index) { + return line_.get(index); + } + /** + * repeated int32 line = 2; + */ + public Builder setLine( + int index, int value) { + ensureLineIsMutable(); + line_.set(index, value); + onChanged(); + return this; + } + /** + * repeated int32 line = 2; + */ + public Builder addLine(int value) { + ensureLineIsMutable(); + line_.add(value); + onChanged(); + return this; + } + /** + * repeated int32 line = 2; + */ + public Builder addAllLine( + java.lang.Iterable values) { + ensureLineIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, line_); + onChanged(); + return this; + } + /** + * repeated int32 line = 2; + */ + public Builder clearLine() { + line_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:TestResult.CoverageBlock) + } + + static { + defaultInstance = new CoverageBlock(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:TestResult.CoverageBlock) + } + + private int bitField0_; + public static final int TEST_FILE_REF_FIELD_NUMBER = 1; + private int testFileRef_; + /** + * optional int32 test_file_ref = 1; + */ + public boolean hasTestFileRef() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional int32 test_file_ref = 1; + */ + public int getTestFileRef() { + return testFileRef_; + } + + public static final int TYPE_FIELD_NUMBER = 2; + private org.sonar.batch.protocol.Constants.TestType type_; + /** + * optional .TestType type = 2; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional .TestType type = 2; + */ + public org.sonar.batch.protocol.Constants.TestType getType() { + return type_; + } + + public static final int STATUS_FIELD_NUMBER = 3; + private org.sonar.batch.protocol.Constants.TestResultStatus status_; + /** + * optional .TestResultStatus status = 3; + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional .TestResultStatus status = 3; + */ + public org.sonar.batch.protocol.Constants.TestResultStatus getStatus() { + return status_; + } + + public static final int DURATION_IN_MS_FIELD_NUMBER = 4; + private long durationInMs_; + /** + * optional int64 duration_in_ms = 4; + */ + public boolean hasDurationInMs() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional int64 duration_in_ms = 4; + */ + public long getDurationInMs() { + return durationInMs_; + } + + public static final int STACKTRACE_FIELD_NUMBER = 5; + private java.lang.Object stacktrace_; + /** + * optional string stacktrace = 5; + */ + public boolean hasStacktrace() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional string stacktrace = 5; + */ + public java.lang.String getStacktrace() { + java.lang.Object ref = stacktrace_; + 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()) { + stacktrace_ = s; + } + return s; + } + } + /** + * optional string stacktrace = 5; + */ + public com.google.protobuf.ByteString + getStacktraceBytes() { + java.lang.Object ref = stacktrace_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + stacktrace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MSG_FIELD_NUMBER = 6; + private java.lang.Object msg_; + /** + * optional string msg = 6; + */ + public boolean hasMsg() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional string msg = 6; + */ + public java.lang.String getMsg() { + java.lang.Object ref = msg_; + 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()) { + msg_ = s; + } + return s; + } + } + /** + * optional string msg = 6; + */ + public com.google.protobuf.ByteString + getMsgBytes() { + java.lang.Object ref = msg_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + msg_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int COVERAGE_BLOCK_FIELD_NUMBER = 7; + private java.util.List coverageBlock_; + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public java.util.List getCoverageBlockList() { + return coverageBlock_; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public java.util.List + getCoverageBlockOrBuilderList() { + return coverageBlock_; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public int getCoverageBlockCount() { + return coverageBlock_.size(); + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock getCoverageBlock(int index) { + return coverageBlock_.get(index); + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlockOrBuilder getCoverageBlockOrBuilder( + int index) { + return coverageBlock_.get(index); + } + + private void initFields() { + testFileRef_ = 0; + type_ = org.sonar.batch.protocol.Constants.TestType.UT; + status_ = org.sonar.batch.protocol.Constants.TestResultStatus.OK; + durationInMs_ = 0L; + stacktrace_ = ""; + msg_ = ""; + coverageBlock_ = 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, testFileRef_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(2, type_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(3, status_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt64(4, durationInMs_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, getStacktraceBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(6, getMsgBytes()); + } + for (int i = 0; i < coverageBlock_.size(); i++) { + output.writeMessage(7, coverageBlock_.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, testFileRef_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, type_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, status_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(4, durationInMs_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getStacktraceBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(6, getMsgBytes()); + } + for (int i = 0; i < coverageBlock_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, coverageBlock_.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.TestResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult 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.TestResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult 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.TestResult parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult 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.TestResult parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult 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.TestResult parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.batch.protocol.output.BatchReport.TestResult 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.TestResult 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 TestResult} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:TestResult) + org.sonar.batch.protocol.output.BatchReport.TestResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.batch.protocol.output.BatchReport.internal_static_TestResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.batch.protocol.output.BatchReport.TestResult.class, org.sonar.batch.protocol.output.BatchReport.TestResult.Builder.class); + } + + // Construct using org.sonar.batch.protocol.output.BatchReport.TestResult.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getCoverageBlockFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + testFileRef_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + type_ = org.sonar.batch.protocol.Constants.TestType.UT; + bitField0_ = (bitField0_ & ~0x00000002); + status_ = org.sonar.batch.protocol.Constants.TestResultStatus.OK; + bitField0_ = (bitField0_ & ~0x00000004); + durationInMs_ = 0L; + bitField0_ = (bitField0_ & ~0x00000008); + stacktrace_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + msg_ = ""; + bitField0_ = (bitField0_ & ~0x00000020); + if (coverageBlockBuilder_ == null) { + coverageBlock_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + } else { + coverageBlockBuilder_.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_TestResult_descriptor; + } + + public org.sonar.batch.protocol.output.BatchReport.TestResult getDefaultInstanceForType() { + return org.sonar.batch.protocol.output.BatchReport.TestResult.getDefaultInstance(); + } + + public org.sonar.batch.protocol.output.BatchReport.TestResult build() { + org.sonar.batch.protocol.output.BatchReport.TestResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.sonar.batch.protocol.output.BatchReport.TestResult buildPartial() { + org.sonar.batch.protocol.output.BatchReport.TestResult result = new org.sonar.batch.protocol.output.BatchReport.TestResult(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.testFileRef_ = testFileRef_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.status_ = status_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.durationInMs_ = durationInMs_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.stacktrace_ = stacktrace_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.msg_ = msg_; + if (coverageBlockBuilder_ == null) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = java.util.Collections.unmodifiableList(coverageBlock_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.coverageBlock_ = coverageBlock_; + } else { + result.coverageBlock_ = coverageBlockBuilder_.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.TestResult) { + return mergeFrom((org.sonar.batch.protocol.output.BatchReport.TestResult)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.sonar.batch.protocol.output.BatchReport.TestResult other) { + if (other == org.sonar.batch.protocol.output.BatchReport.TestResult.getDefaultInstance()) return this; + if (other.hasTestFileRef()) { + setTestFileRef(other.getTestFileRef()); + } + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasStatus()) { + setStatus(other.getStatus()); + } + if (other.hasDurationInMs()) { + setDurationInMs(other.getDurationInMs()); + } + if (other.hasStacktrace()) { + bitField0_ |= 0x00000010; + stacktrace_ = other.stacktrace_; + onChanged(); + } + if (other.hasMsg()) { + bitField0_ |= 0x00000020; + msg_ = other.msg_; + onChanged(); + } + if (coverageBlockBuilder_ == null) { + if (!other.coverageBlock_.isEmpty()) { + if (coverageBlock_.isEmpty()) { + coverageBlock_ = other.coverageBlock_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureCoverageBlockIsMutable(); + coverageBlock_.addAll(other.coverageBlock_); + } + onChanged(); + } + } else { + if (!other.coverageBlock_.isEmpty()) { + if (coverageBlockBuilder_.isEmpty()) { + coverageBlockBuilder_.dispose(); + coverageBlockBuilder_ = null; + coverageBlock_ = other.coverageBlock_; + bitField0_ = (bitField0_ & ~0x00000040); + coverageBlockBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getCoverageBlockFieldBuilder() : null; + } else { + coverageBlockBuilder_.addAllMessages(other.coverageBlock_); + } + } + } + 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.TestResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.sonar.batch.protocol.output.BatchReport.TestResult) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int testFileRef_ ; + /** + * optional int32 test_file_ref = 1; + */ + public boolean hasTestFileRef() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional int32 test_file_ref = 1; + */ + public int getTestFileRef() { + return testFileRef_; + } + /** + * optional int32 test_file_ref = 1; + */ + public Builder setTestFileRef(int value) { + bitField0_ |= 0x00000001; + testFileRef_ = value; + onChanged(); + return this; + } + /** + * optional int32 test_file_ref = 1; + */ + public Builder clearTestFileRef() { + bitField0_ = (bitField0_ & ~0x00000001); + testFileRef_ = 0; + onChanged(); + return this; + } + + private org.sonar.batch.protocol.Constants.TestType type_ = org.sonar.batch.protocol.Constants.TestType.UT; + /** + * optional .TestType type = 2; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional .TestType type = 2; + */ + public org.sonar.batch.protocol.Constants.TestType getType() { + return type_; + } + /** + * optional .TestType type = 2; + */ + public Builder setType(org.sonar.batch.protocol.Constants.TestType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + onChanged(); + return this; + } + /** + * optional .TestType type = 2; + */ + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000002); + type_ = org.sonar.batch.protocol.Constants.TestType.UT; + onChanged(); + return this; + } + + private org.sonar.batch.protocol.Constants.TestResultStatus status_ = org.sonar.batch.protocol.Constants.TestResultStatus.OK; + /** + * optional .TestResultStatus status = 3; + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional .TestResultStatus status = 3; + */ + public org.sonar.batch.protocol.Constants.TestResultStatus getStatus() { + return status_; + } + /** + * optional .TestResultStatus status = 3; + */ + public Builder setStatus(org.sonar.batch.protocol.Constants.TestResultStatus value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + status_ = value; + onChanged(); + return this; + } + /** + * optional .TestResultStatus status = 3; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + status_ = org.sonar.batch.protocol.Constants.TestResultStatus.OK; + onChanged(); + return this; + } + + private long durationInMs_ ; + /** + * optional int64 duration_in_ms = 4; + */ + public boolean hasDurationInMs() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional int64 duration_in_ms = 4; + */ + public long getDurationInMs() { + return durationInMs_; + } + /** + * optional int64 duration_in_ms = 4; + */ + public Builder setDurationInMs(long value) { + bitField0_ |= 0x00000008; + durationInMs_ = value; + onChanged(); + return this; + } + /** + * optional int64 duration_in_ms = 4; + */ + public Builder clearDurationInMs() { + bitField0_ = (bitField0_ & ~0x00000008); + durationInMs_ = 0L; + onChanged(); + return this; + } + + private java.lang.Object stacktrace_ = ""; + /** + * optional string stacktrace = 5; + */ + public boolean hasStacktrace() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional string stacktrace = 5; + */ + public java.lang.String getStacktrace() { + java.lang.Object ref = stacktrace_; + 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()) { + stacktrace_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string stacktrace = 5; + */ + public com.google.protobuf.ByteString + getStacktraceBytes() { + java.lang.Object ref = stacktrace_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + stacktrace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string stacktrace = 5; + */ + public Builder setStacktrace( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + stacktrace_ = value; + onChanged(); + return this; + } + /** + * optional string stacktrace = 5; + */ + public Builder clearStacktrace() { + bitField0_ = (bitField0_ & ~0x00000010); + stacktrace_ = getDefaultInstance().getStacktrace(); + onChanged(); + return this; + } + /** + * optional string stacktrace = 5; + */ + public Builder setStacktraceBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + stacktrace_ = value; + onChanged(); + return this; + } + + private java.lang.Object msg_ = ""; + /** + * optional string msg = 6; + */ + public boolean hasMsg() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional string msg = 6; + */ + public java.lang.String getMsg() { + java.lang.Object ref = msg_; + 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()) { + msg_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string msg = 6; + */ + public com.google.protobuf.ByteString + getMsgBytes() { + java.lang.Object ref = msg_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + msg_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string msg = 6; + */ + public Builder setMsg( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + msg_ = value; + onChanged(); + return this; + } + /** + * optional string msg = 6; + */ + public Builder clearMsg() { + bitField0_ = (bitField0_ & ~0x00000020); + msg_ = getDefaultInstance().getMsg(); + onChanged(); + return this; + } + /** + * optional string msg = 6; + */ + public Builder setMsgBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + msg_ = value; + onChanged(); + return this; + } + + private java.util.List coverageBlock_ = + java.util.Collections.emptyList(); + private void ensureCoverageBlockIsMutable() { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = new java.util.ArrayList(coverageBlock_); + bitField0_ |= 0x00000040; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlockOrBuilder> coverageBlockBuilder_; + + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public java.util.List getCoverageBlockList() { + if (coverageBlockBuilder_ == null) { + return java.util.Collections.unmodifiableList(coverageBlock_); + } else { + return coverageBlockBuilder_.getMessageList(); + } + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public int getCoverageBlockCount() { + if (coverageBlockBuilder_ == null) { + return coverageBlock_.size(); + } else { + return coverageBlockBuilder_.getCount(); + } + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock getCoverageBlock(int index) { + if (coverageBlockBuilder_ == null) { + return coverageBlock_.get(index); + } else { + return coverageBlockBuilder_.getMessage(index); + } + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder setCoverageBlock( + int index, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock value) { + if (coverageBlockBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCoverageBlockIsMutable(); + coverageBlock_.set(index, value); + onChanged(); + } else { + coverageBlockBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder setCoverageBlock( + int index, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder builderForValue) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.set(index, builderForValue.build()); + onChanged(); + } else { + coverageBlockBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock(org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock value) { + if (coverageBlockBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCoverageBlockIsMutable(); + coverageBlock_.add(value); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock( + int index, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock value) { + if (coverageBlockBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCoverageBlockIsMutable(); + coverageBlock_.add(index, value); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock( + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder builderForValue) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.add(builderForValue.build()); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock( + int index, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder builderForValue) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.add(index, builderForValue.build()); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder addAllCoverageBlock( + java.lang.Iterable values) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, coverageBlock_); + onChanged(); + } else { + coverageBlockBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder clearCoverageBlock() { + if (coverageBlockBuilder_ == null) { + coverageBlock_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + } else { + coverageBlockBuilder_.clear(); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public Builder removeCoverageBlock(int index) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.remove(index); + onChanged(); + } else { + coverageBlockBuilder_.remove(index); + } + return this; + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder getCoverageBlockBuilder( + int index) { + return getCoverageBlockFieldBuilder().getBuilder(index); + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlockOrBuilder getCoverageBlockOrBuilder( + int index) { + if (coverageBlockBuilder_ == null) { + return coverageBlock_.get(index); } else { + return coverageBlockBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public java.util.List + getCoverageBlockOrBuilderList() { + if (coverageBlockBuilder_ != null) { + return coverageBlockBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(coverageBlock_); + } + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder addCoverageBlockBuilder() { + return getCoverageBlockFieldBuilder().addBuilder( + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.getDefaultInstance()); + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder addCoverageBlockBuilder( + int index) { + return getCoverageBlockFieldBuilder().addBuilder( + index, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.getDefaultInstance()); + } + /** + * repeated .TestResult.CoverageBlock coverage_block = 7; + */ + public java.util.List + getCoverageBlockBuilderList() { + return getCoverageBlockFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlockOrBuilder> + getCoverageBlockFieldBuilder() { + if (coverageBlockBuilder_ == null) { + coverageBlockBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlock.Builder, org.sonar.batch.protocol.output.BatchReport.TestResult.CoverageBlockOrBuilder>( + coverageBlock_, + ((bitField0_ & 0x00000040) == 0x00000040), + getParentForChildren(), + isClean()); + coverageBlock_ = null; + } + return coverageBlockBuilder_; + } + + // @@protoc_insertion_point(builder_scope:TestResult) + } + + static { + defaultInstance = new TestResult(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:TestResult) + } + private static final com.google.protobuf.Descriptors.Descriptor internal_static_Metadata_descriptor; private static @@ -21171,6 +23046,16 @@ public Builder clearType() { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_SyntaxHighlighting_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_TestResult_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_TestResult_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_TestResult_CoverageBlock_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_TestResult_CoverageBlock_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -21247,8 +23132,14 @@ public Builder clearType() { "\035\n\025it_covered_conditions\030\006 \001(\005\022\"\n\032overal" + "l_covered_conditions\030\007 \001(\005\"L\n\022SyntaxHigh" + "lighting\022\025\n\005range\030\001 \001(\0132\006.Range\022\037\n\004type\030" + - "\002 \001(\0162\021.HighlightingTypeB#\n\037org.sonar.ba" + - "tch.protocol.outputH\001" + "\002 \001(\0162\021.HighlightingType\"\374\001\n\nTestResult\022" + + "\025\n\rtest_file_ref\030\001 \001(\005\022\027\n\004type\030\002 \001(\0162\t.T" + + "estType\022!\n\006status\030\003 \001(\0162\021.TestResultStat", + "us\022\026\n\016duration_in_ms\030\004 \001(\003\022\022\n\nstacktrace" + + "\030\005 \001(\t\022\013\n\003msg\030\006 \001(\t\0221\n\016coverage_block\030\007 " + + "\003(\0132\031.TestResult.CoverageBlock\032/\n\rCovera" + + "geBlock\022\020\n\010file_ref\030\001 \001(\005\022\014\n\004line\030\002 \003(\005B" + + "#\n\037org.sonar.batch.protocol.outputH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -21371,6 +23262,18 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_SyntaxHighlighting_descriptor, new java.lang.String[] { "Range", "Type", }); + internal_static_TestResult_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_TestResult_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_TestResult_descriptor, + new java.lang.String[] { "TestFileRef", "Type", "Status", "DurationInMs", "Stacktrace", "Msg", "CoverageBlock", }); + internal_static_TestResult_CoverageBlock_descriptor = + internal_static_TestResult_descriptor.getNestedTypes().get(0); + internal_static_TestResult_CoverageBlock_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_TestResult_CoverageBlock_descriptor, + new java.lang.String[] { "FileRef", "Line", }); org.sonar.batch.protocol.Constants.getDescriptor(); } diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceTestDb.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceTestDb.java new file mode 100644 index 000000000000..ac69f62aa29b --- /dev/null +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceTestDb.java @@ -0,0 +1,3400 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: file_source_test_db.proto + +package org.sonar.server.source.db; + +public final class FileSourceTestDb { + private FileSourceTestDb() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface TestOrBuilder extends + // @@protoc_insertion_point(interface_extends:org.sonar.server.source.db.Test) + com.google.protobuf.MessageOrBuilder { + + /** + * optional string uuid = 1; + */ + boolean hasUuid(); + /** + * optional string uuid = 1; + */ + java.lang.String getUuid(); + /** + * optional string uuid = 1; + */ + com.google.protobuf.ByteString + getUuidBytes(); + + /** + * optional string key = 2; + */ + boolean hasKey(); + /** + * optional string key = 2; + */ + java.lang.String getKey(); + /** + * optional string key = 2; + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * optional string method_name = 3; + */ + boolean hasMethodName(); + /** + * optional string method_name = 3; + */ + java.lang.String getMethodName(); + /** + * optional string method_name = 3; + */ + com.google.protobuf.ByteString + getMethodNameBytes(); + + /** + * optional string status = 4; + */ + boolean hasStatus(); + /** + * optional string status = 4; + */ + java.lang.String getStatus(); + /** + * optional string status = 4; + */ + com.google.protobuf.ByteString + getStatusBytes(); + + /** + * optional string test_message = 5; + */ + boolean hasTestMessage(); + /** + * optional string test_message = 5; + */ + java.lang.String getTestMessage(); + /** + * optional string test_message = 5; + */ + com.google.protobuf.ByteString + getTestMessageBytes(); + + /** + * optional string type = 6; + */ + boolean hasType(); + /** + * optional string type = 6; + */ + java.lang.String getType(); + /** + * optional string type = 6; + */ + com.google.protobuf.ByteString + getTypeBytes(); + + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + java.util.List + getCoverageBlockList(); + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock getCoverageBlock(int index); + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + int getCoverageBlockCount(); + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + java.util.List + getCoverageBlockOrBuilderList(); + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlockOrBuilder getCoverageBlockOrBuilder( + int index); + } + /** + * Protobuf type {@code org.sonar.server.source.db.Test} + */ + public static final class Test extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:org.sonar.server.source.db.Test) + TestOrBuilder { + // Use Test.newBuilder() to construct. + private Test(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Test(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Test defaultInstance; + public static Test getDefaultInstance() { + return defaultInstance; + } + + public Test getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Test( + 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 10: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000001; + uuid_ = bs; + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000002; + key_ = bs; + break; + } + case 26: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000004; + methodName_ = bs; + break; + } + case 34: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000008; + status_ = bs; + break; + } + case 42: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000010; + testMessage_ = bs; + break; + } + case 50: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000020; + type_ = bs; + break; + } + case 58: { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000040; + } + coverageBlock_.add(input.readMessage(org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.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_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = java.util.Collections.unmodifiableList(coverageBlock_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.server.source.db.FileSourceTestDb.Test.class, org.sonar.server.source.db.FileSourceTestDb.Test.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Test parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Test(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public interface CoverageBlockOrBuilder extends + // @@protoc_insertion_point(interface_extends:org.sonar.server.source.db.Test.CoverageBlock) + com.google.protobuf.MessageOrBuilder { + + /** + * optional string uuid = 1; + */ + boolean hasUuid(); + /** + * optional string uuid = 1; + */ + java.lang.String getUuid(); + /** + * optional string uuid = 1; + */ + com.google.protobuf.ByteString + getUuidBytes(); + + /** + * optional string key = 2; + */ + boolean hasKey(); + /** + * optional string key = 2; + */ + java.lang.String getKey(); + /** + * optional string key = 2; + */ + com.google.protobuf.ByteString + getKeyBytes(); + + /** + * optional string long_name = 3; + */ + boolean hasLongName(); + /** + * optional string long_name = 3; + */ + java.lang.String getLongName(); + /** + * optional string long_name = 3; + */ + com.google.protobuf.ByteString + getLongNameBytes(); + + /** + * repeated int32 lines = 4; + */ + java.util.List getLinesList(); + /** + * repeated int32 lines = 4; + */ + int getLinesCount(); + /** + * repeated int32 lines = 4; + */ + int getLines(int index); + + /** + * optional int32 nb_covered_lines = 5; + */ + boolean hasNbCoveredLines(); + /** + * optional int32 nb_covered_lines = 5; + */ + int getNbCoveredLines(); + } + /** + * Protobuf type {@code org.sonar.server.source.db.Test.CoverageBlock} + */ + public static final class CoverageBlock extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:org.sonar.server.source.db.Test.CoverageBlock) + CoverageBlockOrBuilder { + // Use CoverageBlock.newBuilder() to construct. + private CoverageBlock(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CoverageBlock(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CoverageBlock defaultInstance; + public static CoverageBlock getDefaultInstance() { + return defaultInstance; + } + + public CoverageBlock getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CoverageBlock( + 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 10: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000001; + uuid_ = bs; + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000002; + key_ = bs; + break; + } + case 26: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000004; + longName_ = bs; + break; + } + case 32: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + lines_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + lines_.add(input.readInt32()); + break; + } + case 34: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) { + lines_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + while (input.getBytesUntilLimit() > 0) { + lines_.add(input.readInt32()); + } + input.popLimit(limit); + break; + } + case 40: { + bitField0_ |= 0x00000008; + nbCoveredLines_ = 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 { + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + lines_ = java.util.Collections.unmodifiableList(lines_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_CoverageBlock_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_CoverageBlock_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.class, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CoverageBlock parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CoverageBlock(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + public static final int UUID_FIELD_NUMBER = 1; + private java.lang.Object uuid_; + /** + * optional string uuid = 1; + */ + public boolean hasUuid() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional string uuid = 1; + */ + public java.lang.String getUuid() { + java.lang.Object ref = uuid_; + 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()) { + uuid_ = s; + } + return s; + } + } + /** + * optional string uuid = 1; + */ + public com.google.protobuf.ByteString + getUuidBytes() { + java.lang.Object ref = uuid_; + if (ref instanceof java.lang.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 static final int KEY_FIELD_NUMBER = 2; + private java.lang.Object key_; + /** + * optional string key = 2; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string key = 2; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + 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()) { + key_ = s; + } + return s; + } + } + /** + * optional string key = 2; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LONG_NAME_FIELD_NUMBER = 3; + private java.lang.Object longName_; + /** + * optional string long_name = 3; + */ + public boolean hasLongName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string long_name = 3; + */ + public java.lang.String getLongName() { + java.lang.Object ref = longName_; + 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()) { + longName_ = s; + } + return s; + } + } + /** + * optional string long_name = 3; + */ + public com.google.protobuf.ByteString + getLongNameBytes() { + java.lang.Object ref = longName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + longName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LINES_FIELD_NUMBER = 4; + private java.util.List lines_; + /** + * repeated int32 lines = 4; + */ + public java.util.List + getLinesList() { + return lines_; + } + /** + * repeated int32 lines = 4; + */ + public int getLinesCount() { + return lines_.size(); + } + /** + * repeated int32 lines = 4; + */ + public int getLines(int index) { + return lines_.get(index); + } + + public static final int NB_COVERED_LINES_FIELD_NUMBER = 5; + private int nbCoveredLines_; + /** + * optional int32 nb_covered_lines = 5; + */ + public boolean hasNbCoveredLines() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional int32 nb_covered_lines = 5; + */ + public int getNbCoveredLines() { + return nbCoveredLines_; + } + + private void initFields() { + uuid_ = ""; + key_ = ""; + longName_ = ""; + lines_ = java.util.Collections.emptyList(); + nbCoveredLines_ = 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.writeBytes(1, getUuidBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getKeyBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getLongNameBytes()); + } + for (int i = 0; i < lines_.size(); i++) { + output.writeInt32(4, lines_.get(i)); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(5, nbCoveredLines_); + } + 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 + .computeBytesSize(1, getUuidBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getKeyBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getLongNameBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < lines_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(lines_.get(i)); + } + size += dataSize; + size += 1 * getLinesList().size(); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, nbCoveredLines_); + } + 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.server.source.db.FileSourceTestDb.Test.CoverageBlock parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock 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.server.source.db.FileSourceTestDb.Test.CoverageBlock parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock 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.server.source.db.FileSourceTestDb.Test.CoverageBlock 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 org.sonar.server.source.db.Test.CoverageBlock} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:org.sonar.server.source.db.Test.CoverageBlock) + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlockOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_CoverageBlock_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_CoverageBlock_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.class, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder.class); + } + + // Construct using org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.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(); + uuid_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + key_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + longName_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + lines_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + nbCoveredLines_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_CoverageBlock_descriptor; + } + + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock getDefaultInstanceForType() { + return org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.getDefaultInstance(); + } + + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock build() { + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock buildPartial() { + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock result = new org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.uuid_ = uuid_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.key_ = key_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.longName_ = longName_; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + lines_ = java.util.Collections.unmodifiableList(lines_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.lines_ = lines_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000008; + } + result.nbCoveredLines_ = nbCoveredLines_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock) { + return mergeFrom((org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock other) { + if (other == org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.getDefaultInstance()) return this; + if (other.hasUuid()) { + bitField0_ |= 0x00000001; + uuid_ = other.uuid_; + onChanged(); + } + if (other.hasKey()) { + bitField0_ |= 0x00000002; + key_ = other.key_; + onChanged(); + } + if (other.hasLongName()) { + bitField0_ |= 0x00000004; + longName_ = other.longName_; + onChanged(); + } + if (!other.lines_.isEmpty()) { + if (lines_.isEmpty()) { + lines_ = other.lines_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureLinesIsMutable(); + lines_.addAll(other.lines_); + } + onChanged(); + } + if (other.hasNbCoveredLines()) { + setNbCoveredLines(other.getNbCoveredLines()); + } + 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.server.source.db.FileSourceTestDb.Test.CoverageBlock parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.lang.Object uuid_ = ""; + /** + * optional string uuid = 1; + */ + public boolean hasUuid() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional string uuid = 1; + */ + 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; + } + } + /** + * optional string uuid = 1; + */ + 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; + } + } + /** + * optional string uuid = 1; + */ + public Builder setUuid( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + uuid_ = value; + onChanged(); + return this; + } + /** + * optional string uuid = 1; + */ + public Builder clearUuid() { + bitField0_ = (bitField0_ & ~0x00000001); + uuid_ = getDefaultInstance().getUuid(); + onChanged(); + return this; + } + /** + * optional string uuid = 1; + */ + public Builder setUuidBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + uuid_ = value; + onChanged(); + return this; + } + + private java.lang.Object key_ = ""; + /** + * optional string key = 2; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string key = 2; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + 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()) { + key_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string key = 2; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string key = 2; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + key_ = value; + onChanged(); + return this; + } + /** + * optional string key = 2; + */ + public Builder clearKey() { + bitField0_ = (bitField0_ & ~0x00000002); + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * optional string key = 2; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + key_ = value; + onChanged(); + return this; + } + + private java.lang.Object longName_ = ""; + /** + * optional string long_name = 3; + */ + public boolean hasLongName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string long_name = 3; + */ + public java.lang.String getLongName() { + java.lang.Object ref = longName_; + 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()) { + longName_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string long_name = 3; + */ + public com.google.protobuf.ByteString + getLongNameBytes() { + java.lang.Object ref = longName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + longName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string long_name = 3; + */ + public Builder setLongName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + longName_ = value; + onChanged(); + return this; + } + /** + * optional string long_name = 3; + */ + public Builder clearLongName() { + bitField0_ = (bitField0_ & ~0x00000004); + longName_ = getDefaultInstance().getLongName(); + onChanged(); + return this; + } + /** + * optional string long_name = 3; + */ + public Builder setLongNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + longName_ = value; + onChanged(); + return this; + } + + private java.util.List lines_ = java.util.Collections.emptyList(); + private void ensureLinesIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + lines_ = new java.util.ArrayList(lines_); + bitField0_ |= 0x00000008; + } + } + /** + * repeated int32 lines = 4; + */ + public java.util.List + getLinesList() { + return java.util.Collections.unmodifiableList(lines_); + } + /** + * repeated int32 lines = 4; + */ + public int getLinesCount() { + return lines_.size(); + } + /** + * repeated int32 lines = 4; + */ + public int getLines(int index) { + return lines_.get(index); + } + /** + * repeated int32 lines = 4; + */ + public Builder setLines( + int index, int value) { + ensureLinesIsMutable(); + lines_.set(index, value); + onChanged(); + return this; + } + /** + * repeated int32 lines = 4; + */ + public Builder addLines(int value) { + ensureLinesIsMutable(); + lines_.add(value); + onChanged(); + return this; + } + /** + * repeated int32 lines = 4; + */ + public Builder addAllLines( + java.lang.Iterable values) { + ensureLinesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, lines_); + onChanged(); + return this; + } + /** + * repeated int32 lines = 4; + */ + public Builder clearLines() { + lines_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + private int nbCoveredLines_ ; + /** + * optional int32 nb_covered_lines = 5; + */ + public boolean hasNbCoveredLines() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional int32 nb_covered_lines = 5; + */ + public int getNbCoveredLines() { + return nbCoveredLines_; + } + /** + * optional int32 nb_covered_lines = 5; + */ + public Builder setNbCoveredLines(int value) { + bitField0_ |= 0x00000010; + nbCoveredLines_ = value; + onChanged(); + return this; + } + /** + * optional int32 nb_covered_lines = 5; + */ + public Builder clearNbCoveredLines() { + bitField0_ = (bitField0_ & ~0x00000010); + nbCoveredLines_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.sonar.server.source.db.Test.CoverageBlock) + } + + static { + defaultInstance = new CoverageBlock(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.sonar.server.source.db.Test.CoverageBlock) + } + + private int bitField0_; + public static final int UUID_FIELD_NUMBER = 1; + private java.lang.Object uuid_; + /** + * optional string uuid = 1; + */ + public boolean hasUuid() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional string uuid = 1; + */ + public java.lang.String getUuid() { + java.lang.Object ref = uuid_; + 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()) { + uuid_ = s; + } + return s; + } + } + /** + * optional string uuid = 1; + */ + public com.google.protobuf.ByteString + getUuidBytes() { + java.lang.Object ref = uuid_; + if (ref instanceof java.lang.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 static final int KEY_FIELD_NUMBER = 2; + private java.lang.Object key_; + /** + * optional string key = 2; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string key = 2; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + 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()) { + key_ = s; + } + return s; + } + } + /** + * optional string key = 2; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int METHOD_NAME_FIELD_NUMBER = 3; + private java.lang.Object methodName_; + /** + * optional string method_name = 3; + */ + public boolean hasMethodName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string method_name = 3; + */ + public java.lang.String getMethodName() { + java.lang.Object ref = methodName_; + 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()) { + methodName_ = s; + } + return s; + } + } + /** + * optional string method_name = 3; + */ + public com.google.protobuf.ByteString + getMethodNameBytes() { + java.lang.Object ref = methodName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + methodName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATUS_FIELD_NUMBER = 4; + private java.lang.Object status_; + /** + * optional string status = 4; + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string status = 4; + */ + public java.lang.String getStatus() { + java.lang.Object ref = status_; + 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()) { + status_ = s; + } + return s; + } + } + /** + * optional string status = 4; + */ + public com.google.protobuf.ByteString + getStatusBytes() { + java.lang.Object ref = status_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + status_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TEST_MESSAGE_FIELD_NUMBER = 5; + private java.lang.Object testMessage_; + /** + * optional string test_message = 5; + */ + public boolean hasTestMessage() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional string test_message = 5; + */ + public java.lang.String getTestMessage() { + java.lang.Object ref = testMessage_; + 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()) { + testMessage_ = s; + } + return s; + } + } + /** + * optional string test_message = 5; + */ + public com.google.protobuf.ByteString + getTestMessageBytes() { + java.lang.Object ref = testMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + testMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TYPE_FIELD_NUMBER = 6; + private java.lang.Object type_; + /** + * optional string type = 6; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional string type = 6; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + 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()) { + type_ = s; + } + return s; + } + } + /** + * optional string type = 6; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int COVERAGE_BLOCK_FIELD_NUMBER = 7; + private java.util.List coverageBlock_; + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public java.util.List getCoverageBlockList() { + return coverageBlock_; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public java.util.List + getCoverageBlockOrBuilderList() { + return coverageBlock_; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public int getCoverageBlockCount() { + return coverageBlock_.size(); + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock getCoverageBlock(int index) { + return coverageBlock_.get(index); + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlockOrBuilder getCoverageBlockOrBuilder( + int index) { + return coverageBlock_.get(index); + } + + private void initFields() { + uuid_ = ""; + key_ = ""; + methodName_ = ""; + status_ = ""; + testMessage_ = ""; + type_ = ""; + coverageBlock_ = 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.writeBytes(1, getUuidBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getKeyBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getMethodNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getStatusBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, getTestMessageBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(6, getTypeBytes()); + } + for (int i = 0; i < coverageBlock_.size(); i++) { + output.writeMessage(7, coverageBlock_.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 + .computeBytesSize(1, getUuidBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getKeyBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getMethodNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getStatusBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getTestMessageBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(6, getTypeBytes()); + } + for (int i = 0; i < coverageBlock_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, coverageBlock_.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.server.source.db.FileSourceTestDb.Test parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test 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.server.source.db.FileSourceTestDb.Test parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Test 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.server.source.db.FileSourceTestDb.Test 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 org.sonar.server.source.db.Test} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:org.sonar.server.source.db.Test) + org.sonar.server.source.db.FileSourceTestDb.TestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.server.source.db.FileSourceTestDb.Test.class, org.sonar.server.source.db.FileSourceTestDb.Test.Builder.class); + } + + // Construct using org.sonar.server.source.db.FileSourceTestDb.Test.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getCoverageBlockFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + uuid_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + key_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + methodName_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + status_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + testMessage_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + type_ = ""; + bitField0_ = (bitField0_ & ~0x00000020); + if (coverageBlockBuilder_ == null) { + coverageBlock_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + } else { + coverageBlockBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Test_descriptor; + } + + public org.sonar.server.source.db.FileSourceTestDb.Test getDefaultInstanceForType() { + return org.sonar.server.source.db.FileSourceTestDb.Test.getDefaultInstance(); + } + + public org.sonar.server.source.db.FileSourceTestDb.Test build() { + org.sonar.server.source.db.FileSourceTestDb.Test result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.sonar.server.source.db.FileSourceTestDb.Test buildPartial() { + org.sonar.server.source.db.FileSourceTestDb.Test result = new org.sonar.server.source.db.FileSourceTestDb.Test(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.uuid_ = uuid_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.key_ = key_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.methodName_ = methodName_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.status_ = status_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.testMessage_ = testMessage_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.type_ = type_; + if (coverageBlockBuilder_ == null) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = java.util.Collections.unmodifiableList(coverageBlock_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.coverageBlock_ = coverageBlock_; + } else { + result.coverageBlock_ = coverageBlockBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.sonar.server.source.db.FileSourceTestDb.Test) { + return mergeFrom((org.sonar.server.source.db.FileSourceTestDb.Test)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.sonar.server.source.db.FileSourceTestDb.Test other) { + if (other == org.sonar.server.source.db.FileSourceTestDb.Test.getDefaultInstance()) return this; + if (other.hasUuid()) { + bitField0_ |= 0x00000001; + uuid_ = other.uuid_; + onChanged(); + } + if (other.hasKey()) { + bitField0_ |= 0x00000002; + key_ = other.key_; + onChanged(); + } + if (other.hasMethodName()) { + bitField0_ |= 0x00000004; + methodName_ = other.methodName_; + onChanged(); + } + if (other.hasStatus()) { + bitField0_ |= 0x00000008; + status_ = other.status_; + onChanged(); + } + if (other.hasTestMessage()) { + bitField0_ |= 0x00000010; + testMessage_ = other.testMessage_; + onChanged(); + } + if (other.hasType()) { + bitField0_ |= 0x00000020; + type_ = other.type_; + onChanged(); + } + if (coverageBlockBuilder_ == null) { + if (!other.coverageBlock_.isEmpty()) { + if (coverageBlock_.isEmpty()) { + coverageBlock_ = other.coverageBlock_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureCoverageBlockIsMutable(); + coverageBlock_.addAll(other.coverageBlock_); + } + onChanged(); + } + } else { + if (!other.coverageBlock_.isEmpty()) { + if (coverageBlockBuilder_.isEmpty()) { + coverageBlockBuilder_.dispose(); + coverageBlockBuilder_ = null; + coverageBlock_ = other.coverageBlock_; + bitField0_ = (bitField0_ & ~0x00000040); + coverageBlockBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getCoverageBlockFieldBuilder() : null; + } else { + coverageBlockBuilder_.addAllMessages(other.coverageBlock_); + } + } + } + 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.server.source.db.FileSourceTestDb.Test parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.sonar.server.source.db.FileSourceTestDb.Test) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.lang.Object uuid_ = ""; + /** + * optional string uuid = 1; + */ + public boolean hasUuid() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional string uuid = 1; + */ + 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; + } + } + /** + * optional string uuid = 1; + */ + 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; + } + } + /** + * optional string uuid = 1; + */ + public Builder setUuid( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + uuid_ = value; + onChanged(); + return this; + } + /** + * optional string uuid = 1; + */ + public Builder clearUuid() { + bitField0_ = (bitField0_ & ~0x00000001); + uuid_ = getDefaultInstance().getUuid(); + onChanged(); + return this; + } + /** + * optional string uuid = 1; + */ + public Builder setUuidBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + uuid_ = value; + onChanged(); + return this; + } + + private java.lang.Object key_ = ""; + /** + * optional string key = 2; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string key = 2; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + 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()) { + key_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string key = 2; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string key = 2; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + key_ = value; + onChanged(); + return this; + } + /** + * optional string key = 2; + */ + public Builder clearKey() { + bitField0_ = (bitField0_ & ~0x00000002); + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * optional string key = 2; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + key_ = value; + onChanged(); + return this; + } + + private java.lang.Object methodName_ = ""; + /** + * optional string method_name = 3; + */ + public boolean hasMethodName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string method_name = 3; + */ + public java.lang.String getMethodName() { + java.lang.Object ref = methodName_; + 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()) { + methodName_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string method_name = 3; + */ + public com.google.protobuf.ByteString + getMethodNameBytes() { + java.lang.Object ref = methodName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + methodName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string method_name = 3; + */ + public Builder setMethodName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + methodName_ = value; + onChanged(); + return this; + } + /** + * optional string method_name = 3; + */ + public Builder clearMethodName() { + bitField0_ = (bitField0_ & ~0x00000004); + methodName_ = getDefaultInstance().getMethodName(); + onChanged(); + return this; + } + /** + * optional string method_name = 3; + */ + public Builder setMethodNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + methodName_ = value; + onChanged(); + return this; + } + + private java.lang.Object status_ = ""; + /** + * optional string status = 4; + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string status = 4; + */ + public java.lang.String getStatus() { + java.lang.Object ref = status_; + 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()) { + status_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string status = 4; + */ + public com.google.protobuf.ByteString + getStatusBytes() { + java.lang.Object ref = status_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + status_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string status = 4; + */ + public Builder setStatus( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + status_ = value; + onChanged(); + return this; + } + /** + * optional string status = 4; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000008); + status_ = getDefaultInstance().getStatus(); + onChanged(); + return this; + } + /** + * optional string status = 4; + */ + public Builder setStatusBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + status_ = value; + onChanged(); + return this; + } + + private java.lang.Object testMessage_ = ""; + /** + * optional string test_message = 5; + */ + public boolean hasTestMessage() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional string test_message = 5; + */ + public java.lang.String getTestMessage() { + java.lang.Object ref = testMessage_; + 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()) { + testMessage_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string test_message = 5; + */ + public com.google.protobuf.ByteString + getTestMessageBytes() { + java.lang.Object ref = testMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + testMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string test_message = 5; + */ + public Builder setTestMessage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + testMessage_ = value; + onChanged(); + return this; + } + /** + * optional string test_message = 5; + */ + public Builder clearTestMessage() { + bitField0_ = (bitField0_ & ~0x00000010); + testMessage_ = getDefaultInstance().getTestMessage(); + onChanged(); + return this; + } + /** + * optional string test_message = 5; + */ + public Builder setTestMessageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + testMessage_ = value; + onChanged(); + return this; + } + + private java.lang.Object type_ = ""; + /** + * optional string type = 6; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional string type = 6; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + 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()) { + type_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string type = 6; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string type = 6; + */ + public Builder setType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + type_ = value; + onChanged(); + return this; + } + /** + * optional string type = 6; + */ + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000020); + type_ = getDefaultInstance().getType(); + onChanged(); + return this; + } + /** + * optional string type = 6; + */ + public Builder setTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + type_ = value; + onChanged(); + return this; + } + + private java.util.List coverageBlock_ = + java.util.Collections.emptyList(); + private void ensureCoverageBlockIsMutable() { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { + coverageBlock_ = new java.util.ArrayList(coverageBlock_); + bitField0_ |= 0x00000040; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlockOrBuilder> coverageBlockBuilder_; + + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public java.util.List getCoverageBlockList() { + if (coverageBlockBuilder_ == null) { + return java.util.Collections.unmodifiableList(coverageBlock_); + } else { + return coverageBlockBuilder_.getMessageList(); + } + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public int getCoverageBlockCount() { + if (coverageBlockBuilder_ == null) { + return coverageBlock_.size(); + } else { + return coverageBlockBuilder_.getCount(); + } + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock getCoverageBlock(int index) { + if (coverageBlockBuilder_ == null) { + return coverageBlock_.get(index); + } else { + return coverageBlockBuilder_.getMessage(index); + } + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder setCoverageBlock( + int index, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock value) { + if (coverageBlockBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCoverageBlockIsMutable(); + coverageBlock_.set(index, value); + onChanged(); + } else { + coverageBlockBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder setCoverageBlock( + int index, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder builderForValue) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.set(index, builderForValue.build()); + onChanged(); + } else { + coverageBlockBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock(org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock value) { + if (coverageBlockBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCoverageBlockIsMutable(); + coverageBlock_.add(value); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock( + int index, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock value) { + if (coverageBlockBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCoverageBlockIsMutable(); + coverageBlock_.add(index, value); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock( + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder builderForValue) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.add(builderForValue.build()); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder addCoverageBlock( + int index, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder builderForValue) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.add(index, builderForValue.build()); + onChanged(); + } else { + coverageBlockBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder addAllCoverageBlock( + java.lang.Iterable values) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, coverageBlock_); + onChanged(); + } else { + coverageBlockBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder clearCoverageBlock() { + if (coverageBlockBuilder_ == null) { + coverageBlock_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + } else { + coverageBlockBuilder_.clear(); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public Builder removeCoverageBlock(int index) { + if (coverageBlockBuilder_ == null) { + ensureCoverageBlockIsMutable(); + coverageBlock_.remove(index); + onChanged(); + } else { + coverageBlockBuilder_.remove(index); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder getCoverageBlockBuilder( + int index) { + return getCoverageBlockFieldBuilder().getBuilder(index); + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlockOrBuilder getCoverageBlockOrBuilder( + int index) { + if (coverageBlockBuilder_ == null) { + return coverageBlock_.get(index); } else { + return coverageBlockBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public java.util.List + getCoverageBlockOrBuilderList() { + if (coverageBlockBuilder_ != null) { + return coverageBlockBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(coverageBlock_); + } + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder addCoverageBlockBuilder() { + return getCoverageBlockFieldBuilder().addBuilder( + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.getDefaultInstance()); + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder addCoverageBlockBuilder( + int index) { + return getCoverageBlockFieldBuilder().addBuilder( + index, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.getDefaultInstance()); + } + /** + * repeated .org.sonar.server.source.db.Test.CoverageBlock coverage_block = 7; + */ + public java.util.List + getCoverageBlockBuilderList() { + return getCoverageBlockFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlockOrBuilder> + getCoverageBlockFieldBuilder() { + if (coverageBlockBuilder_ == null) { + coverageBlockBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlock.Builder, org.sonar.server.source.db.FileSourceTestDb.Test.CoverageBlockOrBuilder>( + coverageBlock_, + ((bitField0_ & 0x00000040) == 0x00000040), + getParentForChildren(), + isClean()); + coverageBlock_ = null; + } + return coverageBlockBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.sonar.server.source.db.Test) + } + + static { + defaultInstance = new Test(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.sonar.server.source.db.Test) + } + + public interface TestsOrBuilder extends + // @@protoc_insertion_point(interface_extends:org.sonar.server.source.db.Tests) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + java.util.List + getTestList(); + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + org.sonar.server.source.db.FileSourceTestDb.Test getTest(int index); + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + int getTestCount(); + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + java.util.List + getTestOrBuilderList(); + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + org.sonar.server.source.db.FileSourceTestDb.TestOrBuilder getTestOrBuilder( + int index); + } + /** + * Protobuf type {@code org.sonar.server.source.db.Tests} + */ + public static final class Tests extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:org.sonar.server.source.db.Tests) + TestsOrBuilder { + // Use Tests.newBuilder() to construct. + private Tests(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Tests(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Tests defaultInstance; + public static Tests getDefaultInstance() { + return defaultInstance; + } + + public Tests getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Tests( + 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 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + test_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + test_.add(input.readMessage(org.sonar.server.source.db.FileSourceTestDb.Test.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_ & 0x00000001) == 0x00000001)) { + test_ = java.util.Collections.unmodifiableList(test_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Tests_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Tests_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.server.source.db.FileSourceTestDb.Tests.class, org.sonar.server.source.db.FileSourceTestDb.Tests.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Tests parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Tests(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public static final int TEST_FIELD_NUMBER = 1; + private java.util.List test_; + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public java.util.List getTestList() { + return test_; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public java.util.List + getTestOrBuilderList() { + return test_; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public int getTestCount() { + return test_.size(); + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test getTest(int index) { + return test_.get(index); + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public org.sonar.server.source.db.FileSourceTestDb.TestOrBuilder getTestOrBuilder( + int index) { + return test_.get(index); + } + + private void initFields() { + test_ = 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(); + for (int i = 0; i < test_.size(); i++) { + output.writeMessage(1, test_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < test_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, test_.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.server.source.db.FileSourceTestDb.Tests parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests 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.server.source.db.FileSourceTestDb.Tests parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.sonar.server.source.db.FileSourceTestDb.Tests 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.server.source.db.FileSourceTestDb.Tests 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 org.sonar.server.source.db.Tests} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:org.sonar.server.source.db.Tests) + org.sonar.server.source.db.FileSourceTestDb.TestsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Tests_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Tests_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sonar.server.source.db.FileSourceTestDb.Tests.class, org.sonar.server.source.db.FileSourceTestDb.Tests.Builder.class); + } + + // Construct using org.sonar.server.source.db.FileSourceTestDb.Tests.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTestFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (testBuilder_ == null) { + test_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + testBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.sonar.server.source.db.FileSourceTestDb.internal_static_org_sonar_server_source_db_Tests_descriptor; + } + + public org.sonar.server.source.db.FileSourceTestDb.Tests getDefaultInstanceForType() { + return org.sonar.server.source.db.FileSourceTestDb.Tests.getDefaultInstance(); + } + + public org.sonar.server.source.db.FileSourceTestDb.Tests build() { + org.sonar.server.source.db.FileSourceTestDb.Tests result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.sonar.server.source.db.FileSourceTestDb.Tests buildPartial() { + org.sonar.server.source.db.FileSourceTestDb.Tests result = new org.sonar.server.source.db.FileSourceTestDb.Tests(this); + int from_bitField0_ = bitField0_; + if (testBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + test_ = java.util.Collections.unmodifiableList(test_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.test_ = test_; + } else { + result.test_ = testBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.sonar.server.source.db.FileSourceTestDb.Tests) { + return mergeFrom((org.sonar.server.source.db.FileSourceTestDb.Tests)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.sonar.server.source.db.FileSourceTestDb.Tests other) { + if (other == org.sonar.server.source.db.FileSourceTestDb.Tests.getDefaultInstance()) return this; + if (testBuilder_ == null) { + if (!other.test_.isEmpty()) { + if (test_.isEmpty()) { + test_ = other.test_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTestIsMutable(); + test_.addAll(other.test_); + } + onChanged(); + } + } else { + if (!other.test_.isEmpty()) { + if (testBuilder_.isEmpty()) { + testBuilder_.dispose(); + testBuilder_ = null; + test_ = other.test_; + bitField0_ = (bitField0_ & ~0x00000001); + testBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getTestFieldBuilder() : null; + } else { + testBuilder_.addAllMessages(other.test_); + } + } + } + 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.server.source.db.FileSourceTestDb.Tests parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.sonar.server.source.db.FileSourceTestDb.Tests) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List test_ = + java.util.Collections.emptyList(); + private void ensureTestIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + test_ = new java.util.ArrayList(test_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.sonar.server.source.db.FileSourceTestDb.Test, org.sonar.server.source.db.FileSourceTestDb.Test.Builder, org.sonar.server.source.db.FileSourceTestDb.TestOrBuilder> testBuilder_; + + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public java.util.List getTestList() { + if (testBuilder_ == null) { + return java.util.Collections.unmodifiableList(test_); + } else { + return testBuilder_.getMessageList(); + } + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public int getTestCount() { + if (testBuilder_ == null) { + return test_.size(); + } else { + return testBuilder_.getCount(); + } + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test getTest(int index) { + if (testBuilder_ == null) { + return test_.get(index); + } else { + return testBuilder_.getMessage(index); + } + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder setTest( + int index, org.sonar.server.source.db.FileSourceTestDb.Test value) { + if (testBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTestIsMutable(); + test_.set(index, value); + onChanged(); + } else { + testBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder setTest( + int index, org.sonar.server.source.db.FileSourceTestDb.Test.Builder builderForValue) { + if (testBuilder_ == null) { + ensureTestIsMutable(); + test_.set(index, builderForValue.build()); + onChanged(); + } else { + testBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder addTest(org.sonar.server.source.db.FileSourceTestDb.Test value) { + if (testBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTestIsMutable(); + test_.add(value); + onChanged(); + } else { + testBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder addTest( + int index, org.sonar.server.source.db.FileSourceTestDb.Test value) { + if (testBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTestIsMutable(); + test_.add(index, value); + onChanged(); + } else { + testBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder addTest( + org.sonar.server.source.db.FileSourceTestDb.Test.Builder builderForValue) { + if (testBuilder_ == null) { + ensureTestIsMutable(); + test_.add(builderForValue.build()); + onChanged(); + } else { + testBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder addTest( + int index, org.sonar.server.source.db.FileSourceTestDb.Test.Builder builderForValue) { + if (testBuilder_ == null) { + ensureTestIsMutable(); + test_.add(index, builderForValue.build()); + onChanged(); + } else { + testBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder addAllTest( + java.lang.Iterable values) { + if (testBuilder_ == null) { + ensureTestIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, test_); + onChanged(); + } else { + testBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder clearTest() { + if (testBuilder_ == null) { + test_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + testBuilder_.clear(); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public Builder removeTest(int index) { + if (testBuilder_ == null) { + ensureTestIsMutable(); + test_.remove(index); + onChanged(); + } else { + testBuilder_.remove(index); + } + return this; + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.Builder getTestBuilder( + int index) { + return getTestFieldBuilder().getBuilder(index); + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public org.sonar.server.source.db.FileSourceTestDb.TestOrBuilder getTestOrBuilder( + int index) { + if (testBuilder_ == null) { + return test_.get(index); } else { + return testBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public java.util.List + getTestOrBuilderList() { + if (testBuilder_ != null) { + return testBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(test_); + } + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.Builder addTestBuilder() { + return getTestFieldBuilder().addBuilder( + org.sonar.server.source.db.FileSourceTestDb.Test.getDefaultInstance()); + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public org.sonar.server.source.db.FileSourceTestDb.Test.Builder addTestBuilder( + int index) { + return getTestFieldBuilder().addBuilder( + index, org.sonar.server.source.db.FileSourceTestDb.Test.getDefaultInstance()); + } + /** + * repeated .org.sonar.server.source.db.Test test = 1; + */ + public java.util.List + getTestBuilderList() { + return getTestFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.sonar.server.source.db.FileSourceTestDb.Test, org.sonar.server.source.db.FileSourceTestDb.Test.Builder, org.sonar.server.source.db.FileSourceTestDb.TestOrBuilder> + getTestFieldBuilder() { + if (testBuilder_ == null) { + testBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.sonar.server.source.db.FileSourceTestDb.Test, org.sonar.server.source.db.FileSourceTestDb.Test.Builder, org.sonar.server.source.db.FileSourceTestDb.TestOrBuilder>( + test_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + test_ = null; + } + return testBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.sonar.server.source.db.Tests) + } + + static { + defaultInstance = new Tests(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.sonar.server.source.db.Tests) + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_org_sonar_server_source_db_Test_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_sonar_server_source_db_Test_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_org_sonar_server_source_db_Test_CoverageBlock_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_sonar_server_source_db_Test_CoverageBlock_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_org_sonar_server_source_db_Tests_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_sonar_server_source_db_Tests_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\031file_source_test_db.proto\022\032org.sonar.s" + + "erver.source.db\"\232\002\n\004Test\022\014\n\004uuid\030\001 \001(\t\022\013" + + "\n\003key\030\002 \001(\t\022\023\n\013method_name\030\003 \001(\t\022\016\n\006stat" + + "us\030\004 \001(\t\022\024\n\014test_message\030\005 \001(\t\022\014\n\004type\030\006" + + " \001(\t\022F\n\016coverage_block\030\007 \003(\0132..org.sonar" + + ".server.source.db.Test.CoverageBlock\032f\n\r" + + "CoverageBlock\022\014\n\004uuid\030\001 \001(\t\022\013\n\003key\030\002 \001(\t" + + "\022\021\n\tlong_name\030\003 \001(\t\022\r\n\005lines\030\004 \003(\005\022\030\n\020nb" + + "_covered_lines\030\005 \001(\005\"7\n\005Tests\022.\n\004test\030\001 " + + "\003(\0132 .org.sonar.server.source.db.TestB\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; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_org_sonar_server_source_db_Test_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_sonar_server_source_db_Test_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_sonar_server_source_db_Test_descriptor, + new java.lang.String[] { "Uuid", "Key", "MethodName", "Status", "TestMessage", "Type", "CoverageBlock", }); + internal_static_org_sonar_server_source_db_Test_CoverageBlock_descriptor = + internal_static_org_sonar_server_source_db_Test_descriptor.getNestedTypes().get(0); + internal_static_org_sonar_server_source_db_Test_CoverageBlock_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_sonar_server_source_db_Test_CoverageBlock_descriptor, + new java.lang.String[] { "Uuid", "Key", "LongName", "Lines", "NbCoveredLines", }); + internal_static_org_sonar_server_source_db_Tests_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_org_sonar_server_source_db_Tests_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_sonar_server_source_db_Tests_descriptor, + new java.lang.String[] { "Test", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java index fa11aa19b1bc..e7524bec5aa5 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java @@ -23,7 +23,6 @@ import org.sonar.batch.protocol.output.BatchReport.Issues; import javax.annotation.CheckForNull; - import java.io.File; import java.util.Collections; import java.util.List; @@ -141,6 +140,16 @@ public File readFileSource(int fileRef) { return file; } + @CheckForNull + public File readTestResults(int fileRef) { + File file = fileStructure.fileFor(FileStructure.Domain.TEST_RESULT, fileRef); + if (doesFileExists(file)) { + return file; + } + + return null; + } + private boolean doesFileExists(File file) { return file.exists() && file.isFile(); } diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java index 8011382f086f..6e717fbee42b 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java @@ -115,6 +115,11 @@ public void writeComponentCoverage(int componentRef, Iterable testResults) { + File file = fileStructure.fileFor(FileStructure.Domain.TEST_RESULT, componentRef); + ProtobufUtil.writeMessagesToFile(testResults, file); + } + public File getSourceFile(int componentRef) { return fileStructure.fileFor(FileStructure.Domain.SOURCE, componentRef); } diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java index e0add6865a0c..d6d52ac04716 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java @@ -36,6 +36,7 @@ public enum Domain { SCM("scm-", Domain.PB), SYMBOLS("symbol-", Domain.PB), COVERAGE("coverage-", Domain.PB), + TEST_RESULT("test-", Domain.PB), SOURCE("source-", ".txt"); private static final String PB = ".pb"; diff --git a/sonar-batch-protocol/src/main/protobuf/batch_report.proto b/sonar-batch-protocol/src/main/protobuf/batch_report.proto index 3ab4bfc463f8..cc0de55f061e 100644 --- a/sonar-batch-protocol/src/main/protobuf/batch_report.proto +++ b/sonar-batch-protocol/src/main/protobuf/batch_report.proto @@ -161,7 +161,7 @@ message Scm { optional int32 component_ref = 1; repeated Changeset changeset = 2; // if changesetIndexByLine[3] = 2 then it means that changeset[2] is the last one on line 4 - repeated int32 changesetIndexByLine = 3 [packed=true]; + repeated int32 changesetIndexByLine = 3 [packed = true]; message Changeset { optional string revision = 1; @@ -233,3 +233,17 @@ message SyntaxHighlighting { optional HighlightingType type = 2; } +message TestResult { + optional int32 test_file_ref = 1; + optional TestType type = 2; + optional TestResultStatus status = 3; + optional int64 duration_in_ms = 4; + optional string stacktrace = 5; + optional string msg = 6; + repeated CoverageBlock coverage_block = 7; + + message CoverageBlock { + optional int32 file_ref = 1; + repeated int32 line = 2; + } +} \ No newline at end of file diff --git a/sonar-batch-protocol/src/main/protobuf/constants.proto b/sonar-batch-protocol/src/main/protobuf/constants.proto index d41548178e53..3e9068140293 100644 --- a/sonar-batch-protocol/src/main/protobuf/constants.proto +++ b/sonar-batch-protocol/src/main/protobuf/constants.proto @@ -19,6 +19,7 @@ */ option java_package = "org.sonar.batch.protocol"; + option optimize_for = SPEED; enum Severity { @@ -71,3 +72,15 @@ enum HighlightingType { KEYWORD_LIGHT = 7; PREPROCESS_DIRECTIVE = 8; } + +enum TestType { + UT = 1; + IT = 2; +} + +enum TestResultStatus { + OK = 1; + FAILURE = 2; + ERROR = 3; + SKIPPED = 4; +} diff --git a/sonar-batch-protocol/src/main/protobuf/file_source_test_db.proto b/sonar-batch-protocol/src/main/protobuf/file_source_test_db.proto new file mode 100644 index 000000000000..4f3678bdb060 --- /dev/null +++ b/sonar-batch-protocol/src/main/protobuf/file_source_test_db.proto @@ -0,0 +1,61 @@ +/* + SonarQube, open source software quality management tool. + Copyright (C) 2008-2015 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. +*/ + +/* +Notes + + - "required" fields are not used as recommended by Google to keep forward-compatibility: + https://developers.google.com/protocol-buffers/docs/proto#simple + + - the related Java files are not generated during build. Indeed the existing protoc maven + plugins require protobuf to be installed on boxes. That means that generated Java files + are updated and committed for each change (see src/main/gen-java). +*/ + +// structure of db column FILE_SOURCES.TEST_DATA + +// Temporarily in sonar-batch-protocol + +package org.sonar.server.source.db; + +option optimize_for = SPEED; + +message Test { + optional string uuid = 1; + optional string key = 2; + optional string method_name = 3; + optional string status = 4; + optional string test_message = 5; + optional string type = 6; + repeated CoverageBlock coverage_block = 7; + + message CoverageBlock { + optional string uuid = 1; + //TODO TBE - should the key and long_name specified directly ? + optional string key = 2; + optional string long_name = 3; + repeated int32 lines = 4; + optional int32 nb_covered_lines = 5; + } +} + +message Tests { + repeated Test test = 1; +} \ No newline at end of file diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java index 4d785ba153f3..0e942e14ab38 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java @@ -50,11 +50,8 @@ public void setUp() throws Exception { @Test public void create_dir_if_does_not_exist() throws Exception { - File dir = temp.newFolder(); - initFiles(dir); - sut = new BatchReportReader(dir); BatchReport.Metadata readMetadata = sut.readMetadata(); assertThat(readMetadata.getAnalysisDate()).isEqualTo(15000000L); assertThat(readMetadata.getDeletedComponentsCount()).isEqualTo(1); @@ -105,7 +102,6 @@ public void read_duplications() throws Exception { @Test public void read_syntax_highlighting() throws Exception { - File dir = temp.newFolder(); BatchReportWriter writer = new BatchReportWriter(dir); writer.writeMetadata(BatchReport.Metadata.newBuilder() @@ -123,11 +119,9 @@ public void read_syntax_highlighting() throws Exception { .build()) .setType(Constants.HighlightingType.ANNOTATION) .build() - )); + )); - sut = new BatchReportReader(dir); - - try (InputStream inputStream = FileUtils.openInputStream(new BatchReportReader(dir).readComponentSyntaxHighlighting(1))) { + try (InputStream inputStream = FileUtils.openInputStream(sut.readComponentSyntaxHighlighting(1))) { BatchReport.SyntaxHighlighting syntaxHighlighting = BatchReport.SyntaxHighlighting.PARSER.parseDelimitedFrom(inputStream); assertThat(syntaxHighlighting.getRange()).isNotNull(); assertThat(syntaxHighlighting.getRange().getStartLine()).isEqualTo(1); @@ -171,7 +165,6 @@ public void read_symbols() throws Exception { @Test public void read_coverage() throws Exception { - File dir = temp.newFolder(); BatchReportWriter writer = new BatchReportWriter(dir); writer.writeMetadata(BatchReport.Metadata.newBuilder() @@ -235,6 +228,36 @@ public void read_source_lines() throws Exception { assertThat(sourceFile).isEqualTo(file); } + @Test + public void read_tests() throws Exception { + initFiles(dir); + BatchReportWriter writer = new BatchReportWriter(dir); + writer.writeTestResults(1, Arrays.asList( + BatchReport.TestResult.newBuilder() + .setTestFileRef(1) + .setDurationInMs(60_000) + .setStacktrace("stacktrace") + .setMsg("message") + .setStatus(Constants.TestResultStatus.OK) + .setType(Constants.TestType.IT) + .addCoverageBlock(BatchReport.TestResult.CoverageBlock.newBuilder() + .setFileRef(2) + .addAllLine(Arrays.asList(1, 2, 3, 4, 5))) + .build())); + + try (InputStream inputStream = FileUtils.openInputStream(sut.readTestResults(1))) { + BatchReport.TestResult testResult = BatchReport.TestResult.PARSER.parseDelimitedFrom(inputStream); + assertThat(testResult.getTestFileRef()).isEqualTo(1); + assertThat(testResult.getDurationInMs()).isEqualTo(60_000); + assertThat(testResult.getStacktrace()).isEqualTo("stacktrace"); + assertThat(testResult.getMsg()).isEqualTo("message"); + assertThat(testResult.getType()).isEqualTo(Constants.TestType.IT); + assertThat(testResult.getStatus()).isEqualTo(Constants.TestResultStatus.OK); + assertThat(testResult.getCoverageBlockList().get(0).getFileRef()).isEqualTo(2); + assertThat(testResult.getCoverageBlockList().get(0).getLineList()).containsOnly(1, 2, 3, 4, 5); + } + } + @Test(expected = IllegalStateException.class) public void fail_if_missing_metadata_file() throws Exception { sut.readMetadata(); @@ -285,14 +308,16 @@ public void return_null_if_no_source_found() throws Exception { assertThat(sut.readComponentCoverage(123)).isNull(); } - /** - * no file if no issues - */ @Test public void empty_list_if_no_issue_found() throws Exception { assertThat(sut.readComponentIssues(666)).isEmpty(); } + @Test + public void null_if_no_test_found() throws Exception { + assertThat(sut.readTestResults(666)).isNull(); + } + private void initFiles(File dir) { BatchReportWriter writer = new BatchReportWriter(dir); diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java index c58ecbb67dfe..dd9e7d83b2df 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java @@ -20,6 +20,7 @@ package org.sonar.batch.protocol.output; import org.apache.commons.io.FileUtils; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -36,28 +37,32 @@ public class BatchReportWriterTest { @Rule public TemporaryFolder temp = new TemporaryFolder(); + File dir; + BatchReportWriter sut; + + @Before + public void setUp() throws Exception { + dir = temp.newFolder(); + sut = new BatchReportWriter(dir); + } @Test public void create_dir_if_does_not_exist() throws Exception { - File dir = temp.newFolder(); FileUtils.deleteQuietly(dir); - - new BatchReportWriter(dir); + sut = new BatchReportWriter(dir); assertThat(dir).isDirectory().exists(); } @Test public void write_metadata() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); BatchReport.Metadata.Builder metadata = BatchReport.Metadata.newBuilder() .setAnalysisDate(15000000L) .setProjectKey("PROJECT_A") .setRootComponentRef(1); - writer.writeMetadata(metadata.build()); + sut.writeMetadata(metadata.build()); - BatchReport.Metadata read = ProtobufUtil.readFile(writer.getFileStructure().metadataFile(), BatchReport.Metadata.PARSER); + BatchReport.Metadata read = ProtobufUtil.readFile(sut.getFileStructure().metadataFile(), BatchReport.Metadata.PARSER); assertThat(read.getAnalysisDate()).isEqualTo(15000000L); assertThat(read.getProjectKey()).isEqualTo("PROJECT_A"); assertThat(read.getRootComponentRef()).isEqualTo(1); @@ -65,11 +70,8 @@ public void write_metadata() throws Exception { @Test public void write_component() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - // no data yet - assertThat(writer.hasComponentData(FileStructure.Domain.COMPONENT, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.COMPONENT, 1)).isFalse(); // write data BatchReport.Component.Builder component = BatchReport.Component.newBuilder() @@ -81,10 +83,10 @@ public void write_component() throws Exception { .setIsTest(false) .addChildRef(5) .addChildRef(42); - writer.writeComponent(component.build()); + sut.writeComponent(component.build()); - assertThat(writer.hasComponentData(FileStructure.Domain.COMPONENT, 1)).isTrue(); - File file = writer.getFileStructure().fileFor(FileStructure.Domain.COMPONENT, 1); + assertThat(sut.hasComponentData(FileStructure.Domain.COMPONENT, 1)).isTrue(); + File file = sut.getFileStructure().fileFor(FileStructure.Domain.COMPONENT, 1); assertThat(file).exists().isFile(); BatchReport.Component read = ProtobufUtil.readFile(file, BatchReport.Component.PARSER); assertThat(read.getRef()).isEqualTo(1); @@ -96,11 +98,8 @@ public void write_component() throws Exception { @Test public void write_issues() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - // no data yet - assertThat(writer.hasComponentData(FileStructure.Domain.ISSUES, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.ISSUES, 1)).isFalse(); // write data BatchReport.Issue issue = BatchReport.Issue.newBuilder() @@ -109,10 +108,10 @@ public void write_issues() throws Exception { .setMsg("the message") .build(); - writer.writeComponentIssues(1, Arrays.asList(issue)); + sut.writeComponentIssues(1, Arrays.asList(issue)); - assertThat(writer.hasComponentData(FileStructure.Domain.ISSUES, 1)).isTrue(); - File file = writer.getFileStructure().fileFor(FileStructure.Domain.ISSUES, 1); + assertThat(sut.hasComponentData(FileStructure.Domain.ISSUES, 1)).isTrue(); + File file = sut.getFileStructure().fileFor(FileStructure.Domain.ISSUES, 1); assertThat(file).exists().isFile(); BatchReport.Issues read = ProtobufUtil.readFile(file, BatchReport.Issues.PARSER); assertThat(read.getComponentRef()).isEqualTo(1); @@ -122,11 +121,8 @@ public void write_issues() throws Exception { @Test public void write_issues_of_deleted_component() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - // no data yet - assertThat(writer.hasComponentData(FileStructure.Domain.ISSUES_ON_DELETED, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.ISSUES_ON_DELETED, 1)).isFalse(); // write data BatchReport.Issue issue = BatchReport.Issue.newBuilder() @@ -135,10 +131,10 @@ public void write_issues_of_deleted_component() throws Exception { .setMsg("the message") .build(); - writer.writeDeletedComponentIssues(1, "componentUuid", Arrays.asList(issue)); + sut.writeDeletedComponentIssues(1, "componentUuid", Arrays.asList(issue)); - assertThat(writer.hasComponentData(FileStructure.Domain.ISSUES_ON_DELETED, 1)).isTrue(); - File file = writer.getFileStructure().fileFor(FileStructure.Domain.ISSUES_ON_DELETED, 1); + assertThat(sut.hasComponentData(FileStructure.Domain.ISSUES_ON_DELETED, 1)).isTrue(); + File file = sut.getFileStructure().fileFor(FileStructure.Domain.ISSUES_ON_DELETED, 1); assertThat(file).exists().isFile(); BatchReport.Issues read = ProtobufUtil.readFile(file, BatchReport.Issues.PARSER); assertThat(read.getComponentRef()).isEqualTo(1); @@ -148,10 +144,7 @@ public void write_issues_of_deleted_component() throws Exception { @Test public void write_measures() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - - assertThat(writer.hasComponentData(FileStructure.Domain.MEASURES, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.MEASURES, 1)).isFalse(); BatchReport.Measure measure = BatchReport.Measure.newBuilder() .setStringValue("text-value") @@ -160,10 +153,10 @@ public void write_measures() throws Exception { .setDescription("description") .build(); - writer.writeComponentMeasures(1, Arrays.asList(measure)); + sut.writeComponentMeasures(1, Arrays.asList(measure)); - assertThat(writer.hasComponentData(FileStructure.Domain.MEASURES, 1)).isTrue(); - File file = writer.getFileStructure().fileFor(FileStructure.Domain.MEASURES, 1); + assertThat(sut.hasComponentData(FileStructure.Domain.MEASURES, 1)).isTrue(); + File file = sut.getFileStructure().fileFor(FileStructure.Domain.MEASURES, 1); assertThat(file).exists().isFile(); BatchReport.Measures measures = ProtobufUtil.readFile(file, BatchReport.Measures.PARSER); assertThat(measures.getComponentRef()).isEqualTo(1); @@ -176,10 +169,7 @@ public void write_measures() throws Exception { @Test public void write_scm() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - - assertThat(writer.hasComponentData(FileStructure.Domain.SCM, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.SCM, 1)).isFalse(); BatchReport.Scm scm = BatchReport.Scm.newBuilder() .setComponentRef(1) @@ -190,10 +180,10 @@ public void write_scm() throws Exception { .setDate(123_456_789L)) .build(); - writer.writeComponentScm(scm); + sut.writeComponentScm(scm); - assertThat(writer.hasComponentData(FileStructure.Domain.SCM, 1)).isTrue(); - File file = writer.getFileStructure().fileFor(FileStructure.Domain.SCM, 1); + assertThat(sut.hasComponentData(FileStructure.Domain.SCM, 1)).isTrue(); + File file = sut.getFileStructure().fileFor(FileStructure.Domain.SCM, 1); assertThat(file).exists().isFile(); BatchReport.Scm read = ProtobufUtil.readFile(file, BatchReport.Scm.PARSER); assertThat(read.getComponentRef()).isEqualTo(1); @@ -204,10 +194,7 @@ public void write_scm() throws Exception { @Test public void write_duplications() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - - assertThat(writer.hasComponentData(FileStructure.Domain.DUPLICATIONS, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.DUPLICATIONS, 1)).isFalse(); BatchReport.Duplication duplication = BatchReport.Duplication.newBuilder() .setOriginPosition(Range.newBuilder() @@ -223,10 +210,10 @@ public void write_duplications() throws Exception { .build()) .build()) .build(); - writer.writeComponentDuplications(1, Arrays.asList(duplication)); + sut.writeComponentDuplications(1, Arrays.asList(duplication)); - assertThat(writer.hasComponentData(FileStructure.Domain.DUPLICATIONS, 1)).isTrue(); - File file = writer.getFileStructure().fileFor(FileStructure.Domain.DUPLICATIONS, 1); + assertThat(sut.hasComponentData(FileStructure.Domain.DUPLICATIONS, 1)).isTrue(); + File file = sut.getFileStructure().fileFor(FileStructure.Domain.DUPLICATIONS, 1); assertThat(file).exists().isFile(); BatchReport.Duplications duplications = ProtobufUtil.readFile(file, BatchReport.Duplications.PARSER); assertThat(duplications.getComponentRef()).isEqualTo(1); @@ -237,11 +224,8 @@ public void write_duplications() throws Exception { @Test public void write_symbols() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - // no data yet - assertThat(writer.hasComponentData(FileStructure.Domain.SYMBOLS, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.SYMBOLS, 1)).isFalse(); // write data BatchReport.Symbols.Symbol symbol = BatchReport.Symbols.Symbol.newBuilder() @@ -259,11 +243,11 @@ public void write_symbols() throws Exception { .build()) .build(); - writer.writeComponentSymbols(1, Arrays.asList(symbol)); + sut.writeComponentSymbols(1, Arrays.asList(symbol)); - assertThat(writer.hasComponentData(FileStructure.Domain.SYMBOLS, 1)).isTrue(); + assertThat(sut.hasComponentData(FileStructure.Domain.SYMBOLS, 1)).isTrue(); - File file = writer.getFileStructure().fileFor(FileStructure.Domain.SYMBOLS, 1); + File file = sut.getFileStructure().fileFor(FileStructure.Domain.SYMBOLS, 1); assertThat(file).exists().isFile(); BatchReport.Symbols read = ProtobufUtil.readFile(file, BatchReport.Symbols.PARSER); assertThat(read.getFileRef()).isEqualTo(1); @@ -274,13 +258,10 @@ public void write_symbols() throws Exception { @Test public void write_syntax_highlighting() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - // no data yet - assertThat(writer.hasComponentData(FileStructure.Domain.SYNTAX_HIGHLIGHTING, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.SYNTAX_HIGHLIGHTING, 1)).isFalse(); - writer.writeComponentSyntaxHighlighting(1, Arrays.asList( + sut.writeComponentSyntaxHighlighting(1, Arrays.asList( BatchReport.SyntaxHighlighting.newBuilder() .setRange(BatchReport.Range.newBuilder() .setStartLine(1) @@ -288,20 +269,17 @@ public void write_syntax_highlighting() throws Exception { .build()) .setType(Constants.HighlightingType.ANNOTATION) .build() - )); + )); - assertThat(writer.hasComponentData(FileStructure.Domain.SYNTAX_HIGHLIGHTING, 1)).isTrue(); + assertThat(sut.hasComponentData(FileStructure.Domain.SYNTAX_HIGHLIGHTING, 1)).isTrue(); } @Test public void write_coverage() throws Exception { - File dir = temp.newFolder(); - BatchReportWriter writer = new BatchReportWriter(dir); - // no data yet - assertThat(writer.hasComponentData(FileStructure.Domain.COVERAGE, 1)).isFalse(); + assertThat(sut.hasComponentData(FileStructure.Domain.COVERAGE, 1)).isFalse(); - writer.writeComponentCoverage(1, Arrays.asList( + sut.writeComponentCoverage(1, Arrays.asList( BatchReport.Coverage.newBuilder() .setLine(1) .setConditions(1) @@ -311,9 +289,22 @@ public void write_coverage() throws Exception { .setItCoveredConditions(1) .setOverallCoveredConditions(1) .build() - )); + )); - assertThat(writer.hasComponentData(FileStructure.Domain.COVERAGE, 1)).isTrue(); + assertThat(sut.hasComponentData(FileStructure.Domain.COVERAGE, 1)).isTrue(); } + @Test + public void write_test() throws Exception { + assertThat(sut.hasComponentData(FileStructure.Domain.TEST_RESULT, 1)).isFalse(); + + sut.writeTestResults(1, Arrays.asList( + BatchReport.TestResult.newBuilder() + .setTestFileRef(1) + .build() + )); + + assertThat(sut.hasComponentData(FileStructure.Domain.TEST_RESULT, 1)).isTrue(); + + } } diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/file_sources_missing_src_hash.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/file_sources_missing_src_hash.xml index 2fc32f5845b0..bcc10abe0b57 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/file_sources_missing_src_hash.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/file_sources_missing_src_hash.xml @@ -1,9 +1,10 @@ - - + + diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/shared.xml index 14fded38340c..bd23aa0d917e 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/shared.xml @@ -1,9 +1,10 @@ - + binary_data="[null]" + test_data="[null]" + line_hashes="8d7b3d6b83c0a517eac07e1aac94b773 9a0364b9e99bb480dd25e1f0284c8555" + data_hash="0263047cd758c68c27683625f072f010" + src_hash="123456" + created_at="1412952242000" updated_at="1412952242000"/> + diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistDontTouchUnchanged-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistDontTouchUnchanged-result.xml index 0942d062ede6..39774b75559b 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistDontTouchUnchanged-result.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistDontTouchUnchanged-result.xml @@ -2,9 +2,10 @@ + test_data="[null]" + line_hashes="8d7b3d6b83c0a517eac07e1aac94b773 9a0364b9e99bb480dd25e1f0284c8555" + data_hash="0263047cd758c68c27683625f072f010" + src_hash="123456" + created_at="1412952242000" updated_at="1412952242000"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistEmptyFile-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistEmptyFile-result.xml index 0bdadc4baccb..430a70baac3b 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistEmptyFile-result.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/SourcePersisterTest/testPersistEmptyFile-result.xml @@ -1,15 +1,17 @@ - - - + + + diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index 5ebe86e0e1b9..0e7b81d2a4cd 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -562,6 +562,7 @@ CREATE TABLE "FILE_SOURCES" ( "FILE_UUID" VARCHAR(50) NOT NULL, "LINE_HASHES" CLOB(2147483647), "BINARY_DATA" BLOB(167772150), + "TEST_DATA" BLOB(167772150), "DATA_HASH" VARCHAR(50) NOT NULL, "SRC_HASH" VARCHAR(50) NULL, "CREATED_AT" BIGINT NOT NULL, diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources-result.xml index 7caaa5265131..b5e97717395b 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources-result.xml @@ -1,5 +1,5 @@ - diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml index aaae9915d98c..05dc0c9015a4 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml @@ -72,8 +72,8 @@ depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" version="[null]" path="[null]"/> - - diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/select_purgeable_file_uuids.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/select_purgeable_file_uuids.xml index 5bbb5aa58913..469122aeb01c 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/select_purgeable_file_uuids.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/select_purgeable_file_uuids.xml @@ -79,8 +79,8 @@ depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" version="[null]" path="[null]"/> - - diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml index d50cc3926f5b..9a1feb6e0654 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml @@ -103,6 +103,6 @@ depth="[null]" scope="FIL" qualifier="FIL" created_at="1228222680000" build_date="1228222680000" version="[null]" path="[null]"/> - diff --git a/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/insert-result.xml b/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/insert-result.xml index 74bca5ec788c..67fb0ae86e70 100644 --- a/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/insert-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/insert-result.xml @@ -2,6 +2,7 @@ @@ -9,6 +10,7 @@ diff --git a/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update-result.xml b/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update-result.xml index 40cbfa91a43b..2d71f379cf2c 100644 --- a/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update-result.xml @@ -2,6 +2,7 @@ diff --git a/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update_date_when_updated_date_is_zero.xml b/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update_date_when_updated_date_is_zero.xml index 9782d5c38378..5444e33435f9 100644 --- a/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update_date_when_updated_date_is_zero.xml +++ b/sonar-core/src/test/resources/org/sonar/core/source/db/FileSourceDaoTest/update_date_when_updated_date_is_zero.xml @@ -3,14 +3,17 @@