Greetings, I'm trying to write a provider verifica...
# protobufs
r
Greetings, I'm trying to write a provider verification test on Android using the gRPC protobuf plugin. Since I am constrained to using jUnit4, I am trying my best to get the plugin working but having some trouble. At a high level: 1) Is this even possible? 2) Is there an easier way to do this? So far I created a V4 pact that uses the
protobuf
plugin but the
usingPlugin
call fails with
Err(error=Init call to plugin protobuf failed: io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.)
. Can I just start a mock server in some port and it will magically work, or will there be other roadblocks such as the generation of the pact at the end? My end goal is to generate a pact that I can feed to a provider test to validate that my client contract is compatible with the latest server.
Digging deeper into the stacktrace, it looks like some classpath issue:
Copy code
cause=java.lang.NoClassDefFoundError: Could not initialize class io.pact.plugin.Plugin
	at io.pact.plugin.Plugin$CatalogueEntry$ValuesDefaultEntryHolder.<clinit>(Plugin.java:1212)
	at io.pact.plugin.Plugin$CatalogueEntry$Builder.mergeFrom(Plugin.java:1696)
	at io.pact.plugin.Plugin$CatalogueEntry$1.parsePartialFrom(Plugin.java:2081)
	at io.pact.plugin.Plugin$CatalogueEntry$1.parsePartialFrom(Plugin.java:2073)
	at com.google.protobuf.CodedInputStream$ArrayDecoder.readMessage(CodedInputStream.java:889)
	at io.pact.plugin.Plugin$InitPluginResponse$Builder.mergeFrom(Plugin.java:2612)
	at io.pact.plugin.Plugin$InitPluginResponse$1.parsePartialFrom(Plugin.java:2986)
	at io.pact.plugin.Plugin$InitPluginResponse$1.parsePartialFrom(Plugin.java:2978)
	at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:86)
	at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:48)
	at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parseFrom(ProtoLiteUtils.java:223)
	at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:215)
	at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:118)
	at io.grpc.MethodDescriptor.parseResponse(MethodDescriptor.java:284)
Ah shoot, looks like it is trying to initialize a
MapEntry
with the protobuf library, but our project uses protobuf-lite 😕
u
I don't think anyone has tested JUnit4 support, and we will need to investigate protobuf-lite.