Skip to content

Commit

Permalink
mock test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bughue committed Mar 1, 2024
1 parent 345baad commit 30bef40
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,25 @@ public static void after() {
}

@Test
public void testSend() throws MQBrokerException, RemotingException, InterruptedException, MQClientException, TransactionException {
public void testSendCommit() throws MQBrokerException, RemotingException, InterruptedException, MQClientException, TransactionException {
TransactionManager tm = TmClientTest.getTm();

SeataMQProducer producer = SeataMQProducerFactory.createSingle("10.213.3.25:9876", "test");
producer.send(new Message("Topic--AA", "testMessage".getBytes(StandardCharsets.UTF_8)));
SeataMQProducer producer = SeataMQProducerFactory.createSingle("yourIp:9876", "test");
producer.send(new Message("yourTopic", "testMessage".getBytes(StandardCharsets.UTF_8)));

tm.commit(RootContext.getXID());
}

@Test
public void testSendRollback() throws MQBrokerException, RemotingException, InterruptedException, MQClientException, TransactionException {
TransactionManager tm = TmClientTest.getTm();

SeataMQProducer producer = SeataMQProducerFactory.createSingle("yourIp:9876", "test");
producer.send(new Message("yourTopic", "testMessage".getBytes(StandardCharsets.UTF_8)));

tm.rollback(RootContext.getXID());
}


private static TransactionManager getTmAndBegin() throws TransactionException {
String app = ProtocolTestConstants.APPLICATION_ID;
Expand Down

0 comments on commit 30bef40

Please sign in to comment.