Skip to content
Permalink
Browse files
add bootstrap stop on after class
  • Loading branch information
EarthChen committed Sep 16, 2021
1 parent 3e9a32c commit 2dc6a149c34a0d1a0ec9914973e10be097b18379
Showing 12 changed files with 31 additions and 6 deletions.
@@ -23,6 +23,8 @@ public abstract class BasePbConsumerTest {

protected static PbGreeterManual delegateManual;

protected static DubboBootstrap appDubboBootstrap;

@Test
public void serverStream() throws InterruptedException {
int n = 10;
@@ -128,6 +130,7 @@ public void methodNotFound() {

@AfterClass
public static void alterTest() {
appDubboBootstrap.stop();
DubboBootstrap.reset();
}

@@ -17,6 +17,9 @@ public class BaseTriWrapConsumerTest {

protected static WrapGreeter delegate;

protected static DubboBootstrap appDubboBootstrap;


@Test
public void sayHelloUnaryRequestVoid() {
Assert.assertEquals("hello!void", delegate.sayHelloRequestVoid());
@@ -16,12 +16,16 @@
public class TriGenericTest {
private static GenericService generic;


protected static DubboBootstrap appDubboBootstrap;


@BeforeClass
public static void init() {
ReferenceConfig<GenericService> ref = new ReferenceConfig<>();
ref.setInterface("org.apache.dubbo.sample.tri.service.WrapGreeter");
ref.setCheck(false);
ref.setTimeout(3000);
ref.setTimeout(10000);
ref.setProtocol(CommonConstants.TRIPLE);
ref.setGeneric("true");
ref.setLazy(true);
@@ -33,6 +37,8 @@ public static void init() {
.reference(ref)
.start();
generic = ref.get();

appDubboBootstrap = bootstrap;
}

@Test
@@ -64,14 +70,15 @@ public void notFoundMethod() {

@Test
public void sayHelloLong() {
int len = 2 << 24;
int len = 2 << 12;
final String resp = (String) generic.$invoke("sayHelloLong", new String[]{int.class.getName()}, new Object[]{len});
Assert.assertEquals(len, resp.length());
}


@AfterClass
public static void alterTest() {
appDubboBootstrap.stop();
DubboBootstrap.reset();
}
}
@@ -38,5 +38,6 @@ public static void init() {

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

private static WrapGreeter delegate;

protected static DubboBootstrap appDubboBootstrap;


@BeforeClass
public static void initStub() {
ReferenceConfig<WrapGreeter> ref = new ReferenceConfig<>();
@@ -39,6 +42,8 @@ public static void initStub() {
.reference(ref)
.start();
delegate = ref.get();
appDubboBootstrap = bootstrap;

}

@Test
@@ -148,6 +153,7 @@ public void sayHelloLong() {

@AfterClass
public static void alterTest() {
appDubboBootstrap.stop();
DubboBootstrap.reset();
}
}
@@ -40,5 +40,6 @@ public static void init() {
.start();
delegate = ref.get();
delegateManual = ref2.get();
appDubboBootstrap=bootstrap;
}
}
@@ -7,9 +7,7 @@
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.sample.tri.BaseTriWrapConsumerTest;
import org.apache.dubbo.sample.tri.TriSampleConstants;
import org.apache.dubbo.sample.tri.direct.TriDirectWrapConsumerTest;
import org.apache.dubbo.sample.tri.service.WrapGreeter;

import org.junit.BeforeClass;

public class TriAppWrapConsumerTest extends BaseTriWrapConsumerTest {
@@ -31,6 +29,8 @@ public static void initStub() {
.reference(ref)
.start();
delegate = ref.get();
appDubboBootstrap = bootstrap;

}

}
@@ -39,5 +39,6 @@ public static void init() {
.start();
delegate = ref.get();
delegateManual = ref2.get();
appDubboBootstrap = bootstrap;
}
}
@@ -29,6 +29,7 @@ public static void initStub() {
.reference(ref)
.start();
delegate = ref.get();
appDubboBootstrap = bootstrap;
}

}
@@ -39,5 +39,6 @@ public static void init() {
.start();
delegate = ref.get();
delegateManual = ref2.get();
appDubboBootstrap=bootstrap;
}
}
@@ -8,9 +8,7 @@
import org.apache.dubbo.sample.tri.BasePbConsumerTest;
import org.apache.dubbo.sample.tri.PbGreeter;
import org.apache.dubbo.sample.tri.TriSampleConstants;
import org.apache.dubbo.sample.tri.application.TriAppWrapConsumerTest;
import org.apache.dubbo.sample.tri.service.PbGreeterManual;

import org.junit.BeforeClass;

public class TriInterfacePbConsumerTest extends BasePbConsumerTest {
@@ -41,5 +39,6 @@ public static void init() {
.start();
delegate = ref.get();
delegateManual = ref2.get();
appDubboBootstrap=bootstrap;
}
}
@@ -31,6 +31,8 @@ public static void initStub() {
.reference(ref)
.start();
delegate = ref.get();

appDubboBootstrap = bootstrap;
}

}

0 comments on commit 2dc6a14

Please sign in to comment.