Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bughue committed Nov 19, 2024
1 parent f75043f commit 628c965
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.seata.core.protocol.ProtocolConstants;
import org.apache.seata.core.protocol.RpcMessage;
import org.apache.seata.core.protocol.Version;
import org.apache.seata.core.protocol.VersionNotSupportMessage;
import org.apache.seata.core.protocol.transaction.UndoLogDeleteRequest;
import org.apache.seata.core.rpc.MsgVersionHelper;
import org.apache.seata.server.coordinator.DefaultCoordinator;
Expand Down Expand Up @@ -83,9 +84,16 @@ public void testSendMsgWithResponse() throws Exception {
String serverAddress = "0.0.0.0:8091";
Channel channel = TmNettyRemotingClient.getInstance().getClientChannelManager().acquireChannel(serverAddress);

Assertions.assertFalse(MsgVersionHelper.versionNotSupport(channel, buildUndoLogDeleteMsg(ProtocolConstants.MSGTYPE_RESQUEST_ONEWAY)));
RpcMessage rpcMessage = buildUndoLogDeleteMsg(ProtocolConstants.MSGTYPE_RESQUEST_ONEWAY);
Assertions.assertFalse(MsgVersionHelper.versionNotSupport(channel, rpcMessage));
TmNettyRemotingClient.getInstance().sendAsync(channel,rpcMessage);


Version.putChannelVersion(channel,"0.7.0");
Assertions.assertTrue(MsgVersionHelper.versionNotSupport(channel, buildUndoLogDeleteMsg(ProtocolConstants.MSGTYPE_RESQUEST_ONEWAY)));
Assertions.assertTrue(MsgVersionHelper.versionNotSupport(channel, rpcMessage));
TmNettyRemotingClient.getInstance().sendAsync(channel,rpcMessage);
Object response = TmNettyRemotingClient.getInstance().sendSync(channel, rpcMessage, 100);
Assertions.assertTrue(response instanceof VersionNotSupportMessage);

nettyRemotingServer.destroy();
tmNettyRemotingClient.destroy();
Expand Down

0 comments on commit 628c965

Please sign in to comment.