Java源码示例:org.springframework.protobuf.SecondMsg
示例1
@Before
public void setup() {
this.registryInitializer = mock(ExtensionRegistryInitializer.class);
this.extensionRegistry = mock(ExtensionRegistry.class);
this.converter = new ProtobufHttpMessageConverter(this.registryInitializer);
this.testMsg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
}
示例2
@Before
public void setup() {
this.registryInitializer = mock(ExtensionRegistryInitializer.class);
this.extensionRegistry = mock(ExtensionRegistry.class);
this.converter = new ProtobufJsonFormatHttpMessageConverter(
JsonFormat.parser(), JsonFormat.printer(), this.registryInitializer);
this.testMsg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
}
示例3
@Test // gh-22543
public void cancelWithProtobufEncoder() {
ProtobufEncoder encoder = new ProtobufEncoder();
Msg msg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
Flux<DataBuffer> flux = encoder.encode(Mono.just(msg),
this.bufferFactory, ResolvableType.forClass(Msg.class),
new MimeType("application", "x-protobuf"), Collections.emptyMap());
BaseSubscriber<DataBuffer> subscriber = new ZeroDemandSubscriber();
flux.subscribe(subscriber); // Assume sync execution (e.g. encoding with Flux.just)..
subscriber.cancel();
}
示例4
@Before
public void setup() {
this.registryInitializer = mock(ExtensionRegistryInitializer.class);
this.extensionRegistry = mock(ExtensionRegistry.class);
this.converter = new ProtobufHttpMessageConverter(this.registryInitializer);
this.testMsg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
}
示例5
@Before
public void setup() {
this.registryInitializer = mock(ExtensionRegistryInitializer.class);
this.extensionRegistry = mock(ExtensionRegistry.class);
this.converter = new ProtobufJsonFormatHttpMessageConverter(
JsonFormat.parser(), JsonFormat.printer(), this.registryInitializer);
this.testMsg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
}
示例6
@Before
public void setUp() {
this.registryInitializer = mock(ExtensionRegistryInitializer.class);
this.converter = new ProtobufHttpMessageConverter(this.registryInitializer);
this.testMsg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
}