Skip to content

Commit

Permalink
branch type & default port
Browse files Browse the repository at this point in the history
  • Loading branch information
Bughue committed Feb 6, 2024
1 parent 3e883aa commit c0de496
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class MockServer {

private static volatile boolean inited = false;

public static final int DEFAULT_PORT = 8099;
public static final int DEFAULT_PORT = 8091;

/**
* The entry point of application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class CallRm {
public static BranchStatus branchCommit(RemotingServer remotingServer, BranchSession branchSession) {
BranchCommitRequest request = new BranchCommitRequest();
setReq(request, branchSession);

try {
BranchCommitResponse response = (BranchCommitResponse) remotingServer.sendSyncRequest(
branchSession.getResourceId(), branchSession.getClientId(), request, false);
Expand Down Expand Up @@ -99,7 +98,6 @@ private static void setReq(AbstractBranchEndRequest request, BranchSession branc
request.setBranchId(branchSession.getBranchId());
request.setResourceId(branchSession.getResourceId());
request.setApplicationData("{\"actionContext\":{\"mock\":\"mock\"}}");
request.setBranchType(BranchType.TCC);
// todo AT SAGA
request.setBranchType(branchSession.getBranchType());
}
}
2 changes: 1 addition & 1 deletion test-mock-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
server:
port: 7091
servicePort: 8099
servicePort: 8091

spring:
application:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static ConcurrentMap<String, Channel> getChannelConcurrentMap(AbstractNet

public static Channel getChannel(TmNettyRemotingClient client) {
return getChannelManager(client)
.acquireChannel(ProtocolTestConstants.SERVER_ADDRESS);
.acquireChannel(ProtocolTestConstants.MOCK_SERVER_ADDRESS);
}
private static NettyClientChannelManager getChannelManager(AbstractNettyRemotingClient remotingClient) {
return remotingClient.getClientChannelManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class MockServerTest {

@BeforeAll
public static void before() {
ConfigurationTestHelper.putConfig(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL, String.valueOf(ProtocolTestConstants.SERVER_PORT));
MockServer.start(ProtocolTestConstants.SERVER_PORT);
ConfigurationTestHelper.putConfig(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL, String.valueOf(ProtocolTestConstants.MOCK_SERVER_PORT));
MockServer.start(ProtocolTestConstants.MOCK_SERVER_PORT);
}

@AfterAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
*/
package org.apache.seata.core.rpc.netty.mockserver;

import org.apache.seata.mockserver.MockServer;

/**
* Mock Constants
**/
public class ProtocolTestConstants {
public static final String APPLICATION_ID = "my_app_test";
public static final String SERVICE_GROUP = "mock_tx_group";
public static final int SERVER_PORT = MockServer.DEFAULT_PORT;
public static final String SERVER_ADDRESS = "0.0.0.0:" + SERVER_PORT;
public static final int MOCK_SERVER_PORT = 8099;
public static final String MOCK_SERVER_ADDRESS = "0.0.0.0:" + MOCK_SERVER_PORT;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public class RmClientTest {

@BeforeAll
public static void before() {
ConfigurationTestHelper.putConfig(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL, String.valueOf(ProtocolTestConstants.SERVER_PORT));
MockServer.start(ProtocolTestConstants.SERVER_PORT);
ConfigurationTestHelper.putConfig(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL, String.valueOf(ProtocolTestConstants.MOCK_SERVER_PORT));
MockServer.start(ProtocolTestConstants.MOCK_SERVER_PORT);
}

@AfterAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public class TmClientTest {

@BeforeAll
public static void before() {
ConfigurationTestHelper.putConfig(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL, String.valueOf(ProtocolTestConstants.SERVER_PORT));
MockServer.start(ProtocolTestConstants.SERVER_PORT);
ConfigurationTestHelper.putConfig(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL, String.valueOf(ProtocolTestConstants.MOCK_SERVER_PORT));
MockServer.start(ProtocolTestConstants.MOCK_SERVER_PORT);
}

@AfterAll
Expand Down

0 comments on commit c0de496

Please sign in to comment.