Skip to content

Commit 79be5a9

Browse files
author
Alexander Furer
committed
cleanups
1 parent d79cedc commit 79be5a9

File tree

5 files changed

+5
-28
lines changed

5 files changed

+5
-28
lines changed

grpc-spring-boot-starter-demo/src/test/java/org/lognet/springboot/grpc/GrpcServerTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public abstract class GrpcServerTestBase {
3636
protected ManagedChannel inProcChannel;
3737

3838
@LocalRunningGrpcPort
39-
int runningPort;
39+
protected int runningPort;
4040

4141
@Autowired
4242
protected ApplicationContext context;

grpc-spring-boot2-starter-demo/src/test/java/org/lognet/springboot/grpc/ConfigServerEnvironmentBaseTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public abstract class ConfigServerEnvironmentBaseTest extends GrpcServerTestBase
3939
protected Environment environment;
4040

4141

42+
4243
public static void startConfigServer(Properties properties) throws IOException, URISyntaxException {
4344

4445
File cfgFile = temporaryFolder.newFile("grpc-demo.properties");

grpc-spring-boot2-starter-demo/src/test/java/org/lognet/springboot/grpc/ConfigServerEnvironmentTest2.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import org.junit.BeforeClass;
44
import org.junit.Test;
55
import org.lognet.springboot.grpc.autoconfigure.GRpcServerProperties;
6-
import org.lognet.springboot.grpc.context.LocalRunningGrpcPort;
7-
import org.springframework.beans.factory.annotation.Autowired;
8-
import org.springframework.beans.factory.annotation.Value;
96

107
import java.io.IOException;
118
import java.net.URISyntaxException;
@@ -17,18 +14,6 @@
1714

1815
public class ConfigServerEnvironmentTest2 extends ConfigServerEnvironmentBaseTest{
1916

20-
@LocalRunningGrpcPort
21-
private int runningPort;
22-
23-
@Value("#{environment.getProperty('local.grpc.port')}")
24-
Object localP;
25-
26-
@Value("#{environment.getProperty('grpc.port')}")
27-
Object p;
28-
29-
@Autowired
30-
GRpcServerProperties properties;
31-
3217

3318
@BeforeClass
3419
public static void startConfigServer() throws IOException, URISyntaxException {
@@ -44,9 +29,9 @@ public static void startConfigServer() throws IOException, URISyntaxException {
4429
@Test
4530
public void assertConfigServerConfiguredPort(){
4631

47-
assertNotEquals(runningPort,properties.getPort().intValue());
32+
assertNotEquals(runningPort,gRpcServerProperties.getPort().intValue());
4833
assertNotEquals(GRpcServerProperties.DEFAULT_GRPC_PORT,getPort());
49-
assertEquals(0,properties.getPort().intValue());
34+
assertEquals(0,gRpcServerProperties.getPort().intValue());
5035
}
5136

5237

grpc-spring-boot2-starter-demo/src/test/java/org/lognet/springboot/grpc/ConfigServerEnvironmentTest3.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import org.junit.BeforeClass;
55
import org.junit.Test;
66
import org.lognet.springboot.grpc.autoconfigure.GRpcServerProperties;
7-
import org.springframework.beans.factory.annotation.Autowired;
87

98
import java.io.IOException;
109
import java.net.URISyntaxException;
@@ -16,24 +15,16 @@
1615

1716
public class ConfigServerEnvironmentTest3 extends ConfigServerEnvironmentBaseTest{
1817

19-
20-
@Autowired
21-
GRpcServerProperties properties;
22-
23-
2418
@BeforeClass
2519
public static void startConfigServer() throws IOException, URISyntaxException {
2620
startConfigServer(new Properties());
2721

2822
}
2923

30-
31-
32-
3324
@Test
3425
public void assertConfigServerConfiguredPort(){
3526
assertEquals(GRpcServerProperties.DEFAULT_GRPC_PORT,getPort());
36-
assertThat(properties.getPort(),CoreMatchers.nullValue(Integer.class));
27+
assertThat(gRpcServerProperties.getPort(),CoreMatchers.nullValue(Integer.class));
3728
}
3829

3930

0 commit comments

Comments
 (0)