Skip to content
Permalink
Browse files
ignore server send big header & change send multi frame timeout
  • Loading branch information
EarthChen committed Sep 17, 2021
1 parent ba0964f commit da5dd175760a999a8e2bd3d3782ad3aa2a31fe54
Showing 8 changed files with 73 additions and 12 deletions.
@@ -8,6 +8,7 @@
import org.apache.dubbo.sample.tri.service.PbGreeterManual;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import java.util.concurrent.CountDownLatch;
@@ -86,7 +87,7 @@ public void clientSendLargeSizeHeader() {


@Test(expected = RpcException.class)
// @Ignore
@Ignore
public void serverSendLargeSizeHeader() {
final String key = "user-attachment";
GreeterReply reply = delegateManual.greetReturnBigAttachment(GreeterRequest.newBuilder().setName("meta").build());
@@ -17,6 +17,8 @@ public class BaseTriWrapConsumerTest {

protected static WrapGreeter delegate;

protected static WrapGreeter longDelegate;

protected static DubboBootstrap appDubboBootstrap;


@@ -116,10 +118,10 @@ public void onNext(String data) {

@Test
public void sayHelloLong() {
int power = 5;
int power = 25;
for (int i = 0; i < power; i++) {
final int len = (1 << i);
final String response = delegate.sayHelloLong(len);
final String response = longDelegate.sayHelloLong(len);
System.out.println("Response len:" + response.length());
Assert.assertEquals(len, response.length());
}
@@ -17,6 +17,9 @@ public class TriGenericTest {
private static GenericService generic;


private static GenericService longGeneric;


protected static DubboBootstrap appDubboBootstrap;


@@ -25,18 +28,31 @@ public static void init() {
ReferenceConfig<GenericService> ref = new ReferenceConfig<>();
ref.setInterface("org.apache.dubbo.sample.tri.service.WrapGreeter");
ref.setCheck(false);
ref.setTimeout(10000);
ref.setTimeout(3000);
ref.setProtocol(CommonConstants.TRIPLE);
ref.setGeneric("true");
ref.setLazy(true);

ReferenceConfig<GenericService> ref2 = new ReferenceConfig<>();
ref2.setInterface("org.apache.dubbo.sample.tri.service.WrapGreeter");
ref2.setCheck(false);
ref2.setTimeout(15000);
ref2.setProtocol(CommonConstants.TRIPLE);
ref2.setGeneric("true");
ref2.setRetries(0);
ref2.setLazy(true);


DubboBootstrap bootstrap = DubboBootstrap.getInstance();
ApplicationConfig applicationConfig = new ApplicationConfig(TriGenericTest.class.getName());
applicationConfig.setMetadataServicePort(TriSampleConstants.CONSUMER_METADATA_SERVICE_PORT);
bootstrap.application(applicationConfig)
.registry(new RegistryConfig(TriSampleConstants.ZK_ADDRESS))
.reference(ref)
.reference(ref2)
.start();
generic = ref.get();
longGeneric = ref2.get();

appDubboBootstrap = bootstrap;
}
@@ -71,7 +87,8 @@ public void notFoundMethod() {
@Test
public void sayHelloLong() {
int len = 2 << 12;
final String resp = (String) generic.$invoke("sayHelloLong", new String[]{int.class.getName()}, new Object[]{len});
final String resp = (String) longGeneric.$invoke("sayHelloLong", new String[]{int.class.getName()},
new Object[]{len});
Assert.assertEquals(len, resp.length());
}

@@ -38,6 +38,6 @@ public static void init() {

delegate = ref.get();
delegateManual = ref2.get();
appDubboBootstrap=bootstrap;
appDubboBootstrap = bootstrap;
}
}
@@ -22,8 +22,9 @@ public class TriWrapConsumerTest {

private static WrapGreeter delegate;

protected static DubboBootstrap appDubboBootstrap;
protected static WrapGreeter longDelegate;

protected static DubboBootstrap appDubboBootstrap;

@BeforeClass
public static void initStub() {
@@ -34,14 +35,25 @@ public static void initStub() {
ref.setProtocol(CommonConstants.TRIPLE);
ref.setLazy(true);


ReferenceConfig<WrapGreeter> ref2 = new ReferenceConfig<>();
ref2.setInterface(WrapGreeter.class);
ref2.setCheck(false);
ref2.setTimeout(15000);
ref2.setRetries(0);
ref2.setProtocol(CommonConstants.TRIPLE);
ref2.setLazy(true);

DubboBootstrap bootstrap = DubboBootstrap.getInstance();
ApplicationConfig applicationConfig = new ApplicationConfig(TriWrapConsumerTest.class.getName());
applicationConfig.setMetadataServicePort(TriSampleConstants.CONSUMER_METADATA_SERVICE_PORT);
bootstrap.application(applicationConfig)
.registry(new RegistryConfig(TriSampleConstants.ZK_ADDRESS))
.reference(ref)
.reference(ref2)
.start();
delegate = ref.get();
longDelegate = ref2.get();
appDubboBootstrap = bootstrap;

}
@@ -126,7 +138,8 @@ public void onCompleted() {
public void sayHelloStream() throws InterruptedException {
int n = 10;
CountDownLatch latch = new CountDownLatch(n);
final StreamObserver<String> request = delegate.sayHelloStream(new StdoutStreamObserver<String>("sayHelloStream") {
final StreamObserver<String> request = delegate.sayHelloStream(new StdoutStreamObserver<String>(
"sayHelloStream") {
@Override
public void onNext(String data) {
super.onNext(data);
@@ -142,10 +155,10 @@ public void onNext(String data) {

@Test
public void sayHelloLong() {
int power = 5;
int power = 25;
for (int i = 0; i < power; i++) {
final int len = (1 << i);
final String response = delegate.sayHelloLong(len);
final String response = longDelegate.sayHelloLong(len);
System.out.println("Response len:" + response.length());
Assert.assertEquals(len, response.length());
}
@@ -21,16 +21,25 @@ public static void initStub() {
ref.setProtocol(CommonConstants.TRIPLE);
ref.setLazy(true);

ReferenceConfig<WrapGreeter> ref2 = new ReferenceConfig<>();
ref2.setInterface(WrapGreeter.class);
ref2.setCheck(false);
ref2.setTimeout(15000);
ref2.setRetries(0);
ref2.setProtocol(CommonConstants.TRIPLE);
ref2.setLazy(true);

DubboBootstrap bootstrap = DubboBootstrap.getInstance();
ApplicationConfig applicationConfig = new ApplicationConfig(TriAppWrapConsumerTest.class.getName());
applicationConfig.setMetadataServicePort(TriSampleConstants.CONSUMER_METADATA_SERVICE_PORT);
bootstrap.application(applicationConfig)
.registry(new RegistryConfig(TriSampleConstants.ZK_ADDRESS_MODE_INSTANCE))
.reference(ref)
.reference(ref2)
.start();
delegate = ref.get();
longDelegate = ref2.get();
appDubboBootstrap = bootstrap;

}

}
@@ -22,13 +22,22 @@ public static void initStub() {
ref.setProtocol(CommonConstants.TRIPLE);
ref.setLazy(true);

ReferenceConfig<WrapGreeter> ref2 = new ReferenceConfig<>();
ref2.setInterface(WrapGreeter.class);
ref2.setCheck(false);
ref2.setTimeout(15000);
ref2.setRetries(0);
ref2.setProtocol(CommonConstants.TRIPLE);
ref2.setLazy(true);

DubboBootstrap bootstrap = DubboBootstrap.getInstance();
ApplicationConfig applicationConfig = new ApplicationConfig(TriDirectWrapConsumerTest.class.getName());
applicationConfig.setMetadataServicePort(TriSampleConstants.CONSUMER_METADATA_SERVICE_PORT);
bootstrap.application(applicationConfig)
.reference(ref)
.start();
delegate = ref.get();
longDelegate = ref2.get();
appDubboBootstrap = bootstrap;
}

@@ -23,15 +23,25 @@ public static void initStub() {
ref.setProtocol(CommonConstants.TRIPLE);
ref.setLazy(true);


ReferenceConfig<WrapGreeter> ref2 = new ReferenceConfig<>();
ref2.setInterface(WrapGreeter.class);
ref2.setCheck(false);
ref2.setTimeout(15000);
ref2.setRetries(0);
ref2.setProtocol(CommonConstants.TRIPLE);
ref2.setLazy(true);

DubboBootstrap bootstrap = DubboBootstrap.getInstance();
ApplicationConfig applicationConfig = new ApplicationConfig(TriInterfaceWrapConsumerTest.class.getName());
applicationConfig.setMetadataServicePort(TriSampleConstants.CONSUMER_METADATA_SERVICE_PORT);
bootstrap.application(applicationConfig)
.registry(new RegistryConfig(TriSampleConstants.ZK_ADDRESS_MODE_INTERFACE))
.reference(ref)
.reference(ref2)
.start();
delegate = ref.get();

longDelegate = ref2.get();
appDubboBootstrap = bootstrap;
}

0 comments on commit da5dd17

Please sign in to comment.