Skip to content

Commit

Permalink
feat: support adaptation ros in grpc e2e test (#8)
Browse files Browse the repository at this point in the history
* feat: support ros e2e test

Signed-off-by: wangxye <[email protected]>

* fix: fix the dependecy of proto

Signed-off-by: wangxye <[email protected]>

* fix: fix the config in e2e remoting

Signed-off-by: wangxye <[email protected]>

* fix: fix the setMaxRetryAttempt

Signed-off-by: wangxye <[email protected]>

---------

Signed-off-by: wangxye <[email protected]>
  • Loading branch information
wangxye authored Oct 31, 2023
1 parent 0c36095 commit e507ea9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 22 deletions.
16 changes: 8 additions & 8 deletions java/e2e-v4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.0-beta1</version>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down Expand Up @@ -142,10 +142,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.1.2</version>
<configuration>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<rerunFailingTestsCount>1</rerunFailingTestsCount>
<skipAfterFailureCount>1</skipAfterFailureCount>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxMetaspaceSize=256m</argLine>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
Expand All @@ -157,11 +159,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
<plugin>
Expand Down
10 changes: 10 additions & 0 deletions java/e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@
<artifactId>rocketmq-controller</artifactId>
<version>5.1.3-automq-0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.automq.rocketmq</groupId>
<artifactId>rocketmq-cli</artifactId>
<version>5.1.3-automq-0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.automq.rocketmq</groupId>
<artifactId>rocketmq-proto</artifactId>
<version>5.1.3-automq-0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
package org.apache.rocketmq.factory;

import com.automq.rocketmq.controller.metadata.GrpcControllerClient;
import com.automq.rocketmq.cli.CliClientConfig;
import org.apache.rocketmq.client.apis.ClientServiceProvider;

public class BaseFactory {

protected static ClientServiceProvider provider = ClientServiceProvider.loadService();
protected static GrpcControllerClient client = new GrpcControllerClient();
protected static GrpcControllerClient client = new GrpcControllerClient(new CliClientConfig());
}
22 changes: 12 additions & 10 deletions java/e2e/src/main/java/org/apache/rocketmq/frame/BaseOperate.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import apache.rocketmq.controller.v1.CreateTopicRequest;
import apache.rocketmq.controller.v1.GroupType;
import apache.rocketmq.controller.v1.MessageType;
import apache.rocketmq.controller.v1.AcceptTypes;
import com.automq.rocketmq.controller.metadata.GrpcControllerClient;
import com.automq.rocketmq.cli.CliClientConfig;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import org.apache.rocketmq.client.apis.ClientServiceProvider;
Expand Down Expand Up @@ -53,7 +55,7 @@ public void run() {
log.info("Shutdown Hook is running !");
}
});
client = new GrpcControllerClient();
client = new GrpcControllerClient(new CliClientConfig());
}

// //
Expand Down Expand Up @@ -84,7 +86,7 @@ protected static String getTopic(String messageType, String methodName) {
CreateTopicRequest request = CreateTopicRequest.newBuilder()
.setTopic(topic)
.setCount(8)
.addAcceptMessageTypes(convertMessageType(messageType))
.setAcceptTypes(convertAcceptTypes(messageType))
.build();
Long topicId = client.createTopic(endPoint, request).join();
log.info("create topic: {} , topicId:{}", topic, topicId);
Expand All @@ -95,18 +97,18 @@ protected static String getTopic(String messageType, String methodName) {
return null;
}

private static MessageType convertMessageType(String typeStr) {
private static AcceptTypes convertAcceptTypes(String typeStr) {
switch (typeStr) {
case "NORMAL":
return MessageType.NORMAL;
return AcceptTypes.newBuilder().addTypes(MessageType.NORMAL).build();
case "FIFO":
return MessageType.FIFO;
return AcceptTypes.newBuilder().addTypes(MessageType.FIFO).build();
case "DELAY":
return MessageType.DELAY;
return AcceptTypes.newBuilder().addTypes(MessageType.DELAY).build();
case "TRANSACTION":
return MessageType.TRANSACTION;
return AcceptTypes.newBuilder().addTypes(MessageType.TRANSACTION).build();
default:
return MessageType.MESSAGE_TYPE_UNSPECIFIED;
return AcceptTypes.newBuilder().addTypes(MessageType.MESSAGE_TYPE_UNSPECIFIED).build();
}
}

Expand Down Expand Up @@ -146,7 +148,7 @@ protected static String getGroupId(String methodName) {
// prepare consumer group
CreateGroupRequest request = CreateGroupRequest.newBuilder()
.setName(groupId)
.setMaxRetryAttempt(16)
.setMaxDeliveryAttempt(16)
.setGroupType(GroupType.GROUP_TYPE_STANDARD)
.build();
CreateGroupReply reply = createConsumerGroup(request).join();
Expand All @@ -159,7 +161,7 @@ protected static String getOrderlyGroupId(String methodName) {
String groupId = String.format("GID_%s_%s", methodName, RandomUtils.getStringWithCharacter(6));
CreateGroupRequest request = CreateGroupRequest.newBuilder()
.setName(groupId)
.setMaxRetryAttempt(16)
.setMaxDeliveryAttempt(16)
.setGroupType(GroupType.GROUP_TYPE_FIFO)
.build();
CreateGroupReply reply = createConsumerGroup(request).join();
Expand Down
6 changes: 3 additions & 3 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
</modules>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<jdk.version>8</jdk.version>
Expand All @@ -43,7 +43,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<version>1.18.28</version>
</dependency>
</dependencies>

Expand Down

0 comments on commit e507ea9

Please sign in to comment.