Skip to content

Commit

Permalink
fix junit test and javadoc error (#251)
Browse files Browse the repository at this point in the history
* fix junit test and javadoc error

Co-authored-by: liuruisen <liuruisen@macdeMacBook-Pro.local>
  • Loading branch information
Reason94 and liuruisen committed Oct 8, 2022
1 parent ce77fb3 commit 8a87a60
Show file tree
Hide file tree
Showing 111 changed files with 118 additions and 6,384 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public static void main(String[] args) {
clientConfig.setProtocol("brpc");
// clientConfig.setSerializeMode("pb2-java");
// clientConfig.setServiceId("com.baidu.cloud.rpc.benchmarks.service.EchoService");
starlightClient.refer(UserService.class, clientConfig);

// 生成代理
JDKProxyFactory proxyFactory = new JDKProxyFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public void getMinIdleConnections() {
@Test
public void getProtocol() {
StarlightClientProperties properties = new StarlightClientProperties();
assertNull(properties.getProtocol("Test"));
assertEquals(Constants.BRPC_VALUE, properties.getProtocol("Test"));

Map<String, ClientConfig> clientConfigMap = new HashMap<>();
properties.setConfig(clientConfigMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public void choose() {
assertEquals(10 * 10000, sumCount(hostCount));
System.out.println(hostCount);
System.out.println(hostCount.size());
assertTrue(hostCount.get("localhost:0") > hostCount.get("localhost:100"));
assertTrue(hostCount.get("localhost:100") > hostCount.get("localhost:500"));
assertTrue(hostCount.get("localhost:0") > hostCount.get("localhost:200"));
assertTrue(hostCount.get("localhost:200") > hostCount.get("localhost:500"));
assertTrue(hostCount.get("localhost:500") > hostCount.get("localhost:900"));
}

Expand Down
103 changes: 51 additions & 52 deletions starlight/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.baidu.cloud</groupId>
<artifactId>starlight</artifactId>
<version>2022.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>starlight</name>
<description>Starlight: simple fast rpc framework</description>

<modules>
<module>starlight-api</module>
<module>starlight-protocol</module>
Expand All @@ -19,45 +19,45 @@
<module>starlight-all</module>
<!--<module>starlight-benchmark</module>-->
</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<!-- plugin versions -->
<git-commit-id-plugin.version>2.2.5</git-commit-id-plugin.version>
<powermock.version>2.0.2</powermock.version>
<skip_maven_deploy>false</skip_maven_deploy>

</properties>

<dependencyManagement>
<dependencies>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.github.stefanbirkner/system-rules -->
<!-- For System.getEnv test -->
<dependency>
Expand All @@ -67,7 +67,7 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
Expand All @@ -85,7 +85,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>

<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
Expand All @@ -94,8 +94,7 @@
<verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
</configuration>
<executions>
<execution>
Expand All @@ -105,7 +104,7 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
Expand Down Expand Up @@ -145,28 +144,28 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
</plugin>

</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -180,7 +179,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -190,11 +189,11 @@
<argLine>-Dfile.encoding=UTF-8 -Xms512m -Xmx1024m -XX:MaxPermSize=512m</argLine>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>

<configuration>
<instrumentation>
<excludes>
Expand All @@ -209,7 +208,7 @@
<format>xml</format>
<format>html</format>
</formats>
<check/>
<check />
<aggregate>true</aggregate>
</configuration>
</plugin>
Expand Down Expand Up @@ -251,7 +250,7 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
Expand All @@ -260,7 +259,7 @@
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand All @@ -274,19 +273,19 @@
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-javadoc-plugin</artifactId>-->
<!-- <version>2.9.1</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>attach-javadocs</id>-->
<!-- <goals>-->
<!-- <goal>jar</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<licenses>
Expand All @@ -302,6 +301,18 @@
<url>https://github.com/baidu/starlight.git</url>
<tag>HEAD</tag>
</scm>
<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>ossrh</id>
Expand All @@ -312,18 +323,6 @@
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<profiles>
<profile>
<id>deploy</id>
Expand Down Expand Up @@ -365,5 +364,5 @@
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,12 @@ public class Constants {
public static final String LOCALHOST_VALUE = "127.0.0.1";

/**
* Generic Key, used in stargate protocol support Starlight Client ---> generic call ----> stargate server
* Generic Key, support Starlight Client to generic call to stargate server
*/
public static final String GENERIC_KEY = "generic";

/**
* Stargate uuid, used in stargate protocol support stargate Client ---> call ----> starlight server
* Stargate uuid, used in stargate protocol support stargate Client call to starlight server
*/
public static final String STARGATE_UUID = "stargate.id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ public interface MsgBase {
void setCompressType(int compressType);

/**
* Get Protocol name, used to decode <1>Get when decoding</1>
* Get Protocol name, when decoding
*
* @return
*/
String getProtocolName();

/**
* Set Protocol name, used to encode <1>Set when making a request</1> <2>Set when decoding</2>
* Set Protocol name, used to encode Then value may set when making a request or call decode
*
* @param protocolName
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ public abstract class Request extends AbstractMsgBase {
public abstract void setRemoteURI(URI remoteURI);

/**
* Service name of provider service, the value could be <1> ServiceId (brpc crossing-language or generic call) </1>
* <2> interfaceName (default) </2> In order to support multi protocol, we unified the data model of serviceName as
* group:interfaceName:version.
* Service name of provider service, the value could be
* <ul>
* <li>ServiceId (brpc crossing-language or generic call)</li>
* <li>interfaceName (default)</li>
* </ul>
* In order to support multi protocol, we unified the data model of serviceName as group:interfaceName:version.
*
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
public interface ProtocolDecoder {

/**
* Decode byte of the Protocol to MsgBase. Parsing protocol only, not parsing body. Execute in io thread.
* <1>Determine the data type: Request or Response</1> <2>Decode the byte to MsgBase</2> <3>Throw CodecException</3>
* Decode byte of the Protocol to MsgBase. Parsing protocol only, not parsing body. Execute in io thread. 1.
* Determine the data type: Request or Response 2. Decode the byte to MsgBase 3. Throw CodecException
*
* @param input
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public interface ProtocolEncoder {

/**
* Encoding MsgBase into binary data for the protocol. Body encoding will be handed over to method
* {@link #encodeBody(MsgBase)} <1>Determine the data type: Request or Response</1> <2>Encode the MsgBase to
* ByteBuf</2> <3>Throw CodecException</3>
* {@link #encodeBody(MsgBase)} 1.Determine the data type: Request or Response 2.Encode the MsgBase to ByteBuf
* 3.Throw CodecException
*
* @param input
* @return
Expand All @@ -58,7 +58,6 @@ public interface ProtocolEncoder {
* Starlight用于满足各种功能,额外向response kv中添加的内容
*
* @param response
* @return
*/
default void addAdditionalRespKv(Response response) {
Map<String, Object> respExtKv = response.getAttachmentKv();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public interface ClientInvoker extends Invoker {
/**
* Network communication using ClientPeer: default is NettyClient
*
* @@return
* @return ClientPeer
*/
ClientPeer getClientPeer();

/**
* Target interface information represented by ClientInvoker
*
* @return
* @return ServiceConfig
*/
ServiceConfig getServiceConfig();
}

0 comments on commit 8a87a60

Please sign in to comment.