Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@

set -o errexit -o errtrace -o nounset -o pipefail

MODULE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
LOG_FILE_NAME="generate.log"
LOG_FILE=${MODULE_DIR}/${LOG_FILE_NAME}

function errNotify() {
echo "Error while generating conformance tests" >&2;
echo "See generate.log for details" >&2;
echo "See ${LOG_FILE_NAME} for details" >&2;
return 1
}
trap errNotify ERR
Expand All @@ -28,7 +32,7 @@ function cpDir() {
}

function main() {
rm generate.log 2> /dev/null || true
rm ${LOG_FILE} 2> /dev/null || true

local javaBasePackage="com/google/cloud/conformance"
local firestorePackage="${javaBasePackage}/firestore/v1"
Expand Down Expand Up @@ -58,17 +62,16 @@ function main() {
cpDir "src/main/resources/${bigtablePackage}/" conformance-tests/bigtable/v2/*.json

msg "Generating protos"
mvn -Pgen-conformance-protos clean verify > generate.log 2>&1
mvn -Pgen-conformance-protos clean verify >> ${LOG_FILE} 2>&1

msg "Adding copyright header to generated sources"
## java classes generated from protoc do not include the copyright header
## prepend it to the generated files
local moduleDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
pushd target/generated-sources/protobuf/java/ > /dev/null 2>&1
for f in $(find ./ -type f -name '*.java' | sort); do
msg "Processing $f"
mv ${f} ${f}.tmp
cat ${moduleDir}/copyright-header.txt > ${f}
cat ${MODULE_DIR}/copyright-header.txt > ${f}
cat ${f}.tmp >> ${f}
rm ${f}.tmp
done
Expand All @@ -78,16 +81,16 @@ function main() {
cpDir src/main/java/ target/generated-sources/protobuf/java/*

## cleanup any generated files that may have not been moved over
mvn clean > /dev/null 2>&1
mvn clean >> ${LOG_FILE} 2>&1

msg "Building module..."
## ensure building of the module still works
mvn clean package
mvn clean package | tee -a ${LOG_FILE}
msg "Complete"
}

function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
function msg { println "$*" >&2 ;}
function msg { println "$*" | tee -a ${LOG_FILE} >&2 ;}
function println { printf '%s\n' "$(now) $*" ;}

main
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ private TestFile() {
readRowsTests_ = java.util.Collections.emptyList();
}

@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new TestFile();
}

@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
Expand Down Expand Up @@ -965,6 +971,12 @@ private ReadRowsTest() {
results_ = java.util.Collections.emptyList();
}

@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new ReadRowsTest();
}

@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
Expand Down Expand Up @@ -998,10 +1010,10 @@ private ReadRowsTest(
}
case 18:
{
if (!((mutable_bitField0_ & 0x00000002) != 0)) {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
chunks_ =
new java.util.ArrayList<com.google.bigtable.v2.ReadRowsResponse.CellChunk>();
mutable_bitField0_ |= 0x00000002;
mutable_bitField0_ |= 0x00000001;
}
chunks_.add(
input.readMessage(
Expand All @@ -1011,12 +1023,12 @@ private ReadRowsTest(
}
case 26:
{
if (!((mutable_bitField0_ & 0x00000004) != 0)) {
if (!((mutable_bitField0_ & 0x00000002) != 0)) {
results_ =
new java.util.ArrayList<
com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest
.Result>();
mutable_bitField0_ |= 0x00000004;
mutable_bitField0_ |= 0x00000002;
}
results_.add(
input.readMessage(
Expand All @@ -1039,10 +1051,10 @@ private ReadRowsTest(
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000002) != 0)) {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
chunks_ = java.util.Collections.unmodifiableList(chunks_);
}
if (((mutable_bitField0_ & 0x00000004) != 0)) {
if (((mutable_bitField0_ & 0x00000002) != 0)) {
results_ = java.util.Collections.unmodifiableList(results_);
}
this.unknownFields = unknownFields.build();
Expand Down Expand Up @@ -1129,6 +1141,12 @@ private Result() {
label_ = "";
}

@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new Result();
}

@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
Expand All @@ -1142,7 +1160,6 @@ private Result(
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
Expand Down Expand Up @@ -2192,7 +2209,6 @@ public com.google.protobuf.Parser<Result> getParserForType() {
}
}

private int bitField0_;
public static final int DESCRIPTION_FIELD_NUMBER = 1;
private volatile java.lang.Object description_;
/** <code>string description = 1;</code> */
Expand Down Expand Up @@ -2518,13 +2534,13 @@ public Builder clear() {

if (chunksBuilder_ == null) {
chunks_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
} else {
chunksBuilder_.clear();
}
if (resultsBuilder_ == null) {
results_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
bitField0_ = (bitField0_ & ~0x00000002);
} else {
resultsBuilder_.clear();
}
Expand Down Expand Up @@ -2559,27 +2575,25 @@ public com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest buil
com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest result =
new com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
result.description_ = description_;
if (chunksBuilder_ == null) {
if (((bitField0_ & 0x00000002) != 0)) {
if (((bitField0_ & 0x00000001) != 0)) {
chunks_ = java.util.Collections.unmodifiableList(chunks_);
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.chunks_ = chunks_;
} else {
result.chunks_ = chunksBuilder_.build();
}
if (resultsBuilder_ == null) {
if (((bitField0_ & 0x00000004) != 0)) {
if (((bitField0_ & 0x00000002) != 0)) {
results_ = java.util.Collections.unmodifiableList(results_);
bitField0_ = (bitField0_ & ~0x00000004);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.results_ = results_;
} else {
result.results_ = resultsBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
Expand Down Expand Up @@ -2643,7 +2657,7 @@ public Builder mergeFrom(
if (!other.chunks_.isEmpty()) {
if (chunks_.isEmpty()) {
chunks_ = other.chunks_;
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureChunksIsMutable();
chunks_.addAll(other.chunks_);
Expand All @@ -2656,7 +2670,7 @@ public Builder mergeFrom(
chunksBuilder_.dispose();
chunksBuilder_ = null;
chunks_ = other.chunks_;
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
chunksBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
? getChunksFieldBuilder()
Expand All @@ -2670,7 +2684,7 @@ public Builder mergeFrom(
if (!other.results_.isEmpty()) {
if (results_.isEmpty()) {
results_ = other.results_;
bitField0_ = (bitField0_ & ~0x00000004);
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureResultsIsMutable();
results_.addAll(other.results_);
Expand All @@ -2683,7 +2697,7 @@ public Builder mergeFrom(
resultsBuilder_.dispose();
resultsBuilder_ = null;
results_ = other.results_;
bitField0_ = (bitField0_ & ~0x00000004);
bitField0_ = (bitField0_ & ~0x00000002);
resultsBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
? getResultsFieldBuilder()
Expand Down Expand Up @@ -2784,10 +2798,10 @@ public Builder setDescriptionBytes(com.google.protobuf.ByteString value) {
java.util.Collections.emptyList();

private void ensureChunksIsMutable() {
if (!((bitField0_ & 0x00000002) != 0)) {
if (!((bitField0_ & 0x00000001) != 0)) {
chunks_ =
new java.util.ArrayList<com.google.bigtable.v2.ReadRowsResponse.CellChunk>(chunks_);
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000001;
}
}

Expand Down Expand Up @@ -2915,7 +2929,7 @@ public Builder addAllChunks(
public Builder clearChunks() {
if (chunksBuilder_ == null) {
chunks_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
chunksBuilder_.clear();
Expand Down Expand Up @@ -2983,7 +2997,7 @@ public com.google.bigtable.v2.ReadRowsResponse.CellChunk.Builder addChunksBuilde
com.google.bigtable.v2.ReadRowsResponse.CellChunk,
com.google.bigtable.v2.ReadRowsResponse.CellChunk.Builder,
com.google.bigtable.v2.ReadRowsResponse.CellChunkOrBuilder>(
chunks_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
chunks_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
chunks_ = null;
}
return chunksBuilder_;
Expand All @@ -2994,12 +3008,12 @@ public com.google.bigtable.v2.ReadRowsResponse.CellChunk.Builder addChunksBuilde
results_ = java.util.Collections.emptyList();

private void ensureResultsIsMutable() {
if (!((bitField0_ & 0x00000004) != 0)) {
if (!((bitField0_ & 0x00000002) != 0)) {
results_ =
new java.util.ArrayList<
com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest.Result>(
results_);
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000002;
}
}

Expand Down Expand Up @@ -3176,7 +3190,7 @@ public Builder addAllResults(
public Builder clearResults() {
if (resultsBuilder_ == null) {
results_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
} else {
resultsBuilder_.clear();
Expand Down Expand Up @@ -3278,7 +3292,7 @@ public Builder removeResults(int index) {
.Builder,
com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest
.ResultOrBuilder>(
results_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean());
results_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
results_ = null;
}
return resultsBuilder_;
Expand Down Expand Up @@ -3378,20 +3392,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "loud.Bigtable.V2.Tests.Conformanceb\006prot"
+ "o3"
};
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[] {
com.google.bigtable.v2.BigtableProto.getDescriptor(),
},
assigner);
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
com.google.bigtable.v2.BigtableProto.getDescriptor(),
});
internal_static_google_cloud_conformance_bigtable_v2_TestFile_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_google_cloud_conformance_bigtable_v2_TestFile_fieldAccessorTable =
Expand Down
Loading