org.apache.rocketmq.store.AppendMessageResult Java Examples
The following examples show how to use
org.apache.rocketmq.store.AppendMessageResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransactionalMessageServiceImplTest.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testCheck_withCheck() { when(bridge.fetchMessageQueues(TopicValidator.RMQ_SYS_TRANS_HALF_TOPIC)).thenReturn(createMessageQueueSet(TopicValidator.RMQ_SYS_TRANS_HALF_TOPIC)); when(bridge.getHalfMessage(0, 0, 1)).thenReturn(createPullResult(TopicValidator.RMQ_SYS_TRANS_HALF_TOPIC, 5, "hello", 1)); when(bridge.getHalfMessage(0, 1, 1)).thenReturn(createPullResult(TopicValidator.RMQ_SYS_TRANS_HALF_TOPIC, 6, "hellp", 0)); when(bridge.getOpMessage(anyInt(), anyLong(), anyInt())).thenReturn(createPullResult(TopicValidator.RMQ_SYS_TRANS_OP_HALF_TOPIC, 1, "5", 0)); when(bridge.getBrokerController()).thenReturn(this.brokerController); when(bridge.renewHalfMessageInner(any(MessageExtBrokerInner.class))).thenReturn(createMessageBrokerInner()); when(bridge.putMessageReturnResult(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); long timeOut = this.brokerController.getBrokerConfig().getTransactionTimeOut(); final int checkMax = this.brokerController.getBrokerConfig().getTransactionCheckMax(); final AtomicInteger checkMessage = new AtomicInteger(0); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { checkMessage.addAndGet(1); return checkMessage; } }).when(listener).resolveHalfMsg(any(MessageExt.class)); queueTransactionMsgService.check(timeOut, checkMax, listener); assertThat(checkMessage.get()).isEqualTo(1); }
Example #2
Source File: SendMessageProcessorTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_Transaction() throws RemotingCommandException { brokerController.setTransactionalMessageService(transactionMsgService); when(brokerController.getTransactionalMessageService().prepareMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand request = createSendTransactionMsgCommand(RequestCode.SEND_MESSAGE); final RemotingCommand[] response = new RemotingCommand[1]; doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { response[0] = invocation.getArgument(0); return null; } }).when(handlerContext).writeAndFlush(any(Object.class)); RemotingCommand responseToReturn = sendMessageProcessor.processRequest(handlerContext, request); if (responseToReturn != null) { assertThat(response[0]).isNull(); response[0] = responseToReturn; } assertThat(response[0].getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #3
Source File: TransactionalMessageServiceImplTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@Test public void testCheck_withCheck() { when(bridge.fetchMessageQueues(MixAll.RMQ_SYS_TRANS_HALF_TOPIC)).thenReturn(createMessageQueueSet(MixAll.RMQ_SYS_TRANS_HALF_TOPIC)); when(bridge.getHalfMessage(0, 0, 1)).thenReturn(createPullResult(MixAll.RMQ_SYS_TRANS_HALF_TOPIC, 5, "hello", 1)); when(bridge.getHalfMessage(0, 1, 1)).thenReturn(createPullResult(MixAll.RMQ_SYS_TRANS_HALF_TOPIC, 6, "hellp", 0)); when(bridge.getOpMessage(anyInt(), anyLong(), anyInt())).thenReturn(createPullResult(MixAll.RMQ_SYS_TRANS_OP_HALF_TOPIC, 1, "5", 0)); when(bridge.getBrokerController()).thenReturn(this.brokerController); when(bridge.renewHalfMessageInner(any(MessageExtBrokerInner.class))).thenReturn(createMessageBrokerInner()); when(bridge.putMessageReturnResult(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); long timeOut = this.brokerController.getBrokerConfig().getTransactionTimeOut(); final int checkMax = this.brokerController.getBrokerConfig().getTransactionCheckMax(); final AtomicInteger checkMessage = new AtomicInteger(0); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { checkMessage.addAndGet(1); return checkMessage; } }).when(listener).resolveHalfMsg(any(MessageExt.class)); queueTransactionMsgService.check(timeOut, checkMax, listener); assertThat(checkMessage.get()).isEqualTo(1); }
Example #4
Source File: SendMessageProcessorTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_Transaction() throws RemotingCommandException { brokerController.setTransactionalMessageService(transactionMsgService); when(brokerController.getTransactionalMessageService().prepareMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand request = createSendTransactionMsgCommand(RequestCode.SEND_MESSAGE); final RemotingCommand[] response = new RemotingCommand[1]; doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { response[0] = invocation.getArgument(0); return null; } }).when(handlerContext).writeAndFlush(any(Object.class)); RemotingCommand responseToReturn = sendMessageProcessor.processRequest(handlerContext, request); if (responseToReturn != null) { assertThat(response[0]).isNull(); response[0] = responseToReturn; } assertThat(response[0].getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #5
Source File: DeFiReplyMessageProcessorTest.java From DeFiBus with Apache License 2.0 | 6 votes |
@Before public void init() { deFiBrokerController = spy(new DeFiBrokerController(new BrokerConfig(), new NettyServerConfig(), new NettyClientConfig(), new MessageStoreConfig(), deFiBusBrokerConfig)); channelHandlerContext = mock(ChannelHandlerContext.class); messageStore = mock(MessageStore.class); DeFiBusBroker2Client broker2Client = mock(DeFiBusBroker2Client.class); when(this.deFiBrokerController.getDeFiBusBroker2Client()).thenReturn(broker2Client); when(broker2Client.pushRRReplyMessageToClient(any(), any(), any())).thenReturn(true); Channel channel = mock(Channel.class); when(channel.isActive()).thenReturn(true); ClientChannelInfo channelInfo = mock(ClientChannelInfo.class); when(channelInfo.getChannel()).thenReturn(channel); DeFiProducerManager mockProducer = mock(DeFiProducerManager.class); when(mockProducer.getClientChannel(anyString())).thenReturn(channelInfo); when(this.deFiBrokerController.getProducerManager()).thenReturn(mockProducer); this.deFiBrokerController.setMessageStore(this.messageStore); when(this.messageStore.now()).thenReturn(System.currentTimeMillis()); AppendMessageResult appendMessageResult = new AppendMessageResult(AppendMessageStatus.PUT_OK, 0, 0, "00000000000000000000000000000000", messageStore.now(), 0L, 0); when(this.messageStore.putMessage(any())).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, appendMessageResult)); when(channel.remoteAddress()).thenReturn(new InetSocketAddress(1024)); when(channelHandlerContext.channel()).thenReturn(channel); deFiReplyMessageProcessor = new DeFiReplyMessageProcessor(this.deFiBrokerController); }
Example #6
Source File: TransactionalMessageServiceImplTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Test public void testCheck_withCheck() { when(bridge.fetchMessageQueues(MixAll.RMQ_SYS_TRANS_HALF_TOPIC)).thenReturn(createMessageQueueSet(MixAll.RMQ_SYS_TRANS_HALF_TOPIC)); when(bridge.getHalfMessage(0, 0, 1)).thenReturn(createPullResult(MixAll.RMQ_SYS_TRANS_HALF_TOPIC, 5, "hello", 1)); when(bridge.getHalfMessage(0, 1, 1)).thenReturn(createPullResult(MixAll.RMQ_SYS_TRANS_HALF_TOPIC, 6, "hellp", 0)); when(bridge.getOpMessage(anyInt(), anyLong(), anyInt())).thenReturn(createPullResult(MixAll.RMQ_SYS_TRANS_OP_HALF_TOPIC, 1, "5", 0)); when(bridge.getBrokerController()).thenReturn(this.brokerController); when(bridge.renewHalfMessageInner(any(MessageExtBrokerInner.class))).thenReturn(createMessageBrokerInner()); when(bridge.putMessageReturnResult(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); long timeOut = this.brokerController.getBrokerConfig().getTransactionTimeOut(); final int checkMax = this.brokerController.getBrokerConfig().getTransactionCheckMax(); final AtomicInteger checkMessage = new AtomicInteger(0); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { checkMessage.addAndGet(1); return checkMessage; } }).when(listener).resolveHalfMsg(any(MessageExt.class)); queueTransactionMsgService.check(timeOut, checkMax, listener); assertThat(checkMessage.get()).isEqualTo(1); }
Example #7
Source File: TransactionalMessageBridgeTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testAsyncPutHalfMessage() throws Exception { when(messageStore.asyncPutMessage(any(MessageExtBrokerInner.class))) .thenReturn(CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK)))); CompletableFuture<PutMessageResult> result = transactionBridge.asyncPutHalfMessage(createMessageBrokerInner()); assertThat(result.get().getPutMessageStatus()).isEqualTo(PutMessageStatus.PUT_OK); }
Example #8
Source File: TransactionalMessageBridgeTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
@Test public void testPutMessageReturnResult() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); PutMessageResult result = transactionBridge.putMessageReturnResult(createMessageBrokerInner()); assertThat(result.getPutMessageStatus()).isEqualTo(PutMessageStatus.PUT_OK); }
Example #9
Source File: TransactionalMessageBridgeTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testPutMessageReturnResult() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); PutMessageResult result = transactionBridge.putMessageReturnResult(createMessageBrokerInner()); assertThat(result.getPutMessageStatus()).isEqualTo(PutMessageStatus.PUT_OK); }
Example #10
Source File: SendMessageProcessorTest.java From DDMQ with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_WithMsgBack() throws RemotingCommandException { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); final RemotingCommand request = createSendMsgBackCommand(RequestCode.CONSUMER_SEND_MSG_BACK); sendMessageProcessor = new SendMessageProcessor(brokerController); final RemotingCommand response = sendMessageProcessor.processRequest(handlerContext, request); assertThat(response).isNotNull(); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #11
Source File: TransactionalMessageBridgeTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
@Test public void testPutMessage() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); Boolean success = transactionBridge.putMessage(createMessageBrokerInner()); assertThat(success).isEqualTo(true); }
Example #12
Source File: AdminBrokerProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_fail() throws RemotingCommandException, UnknownHostException { RemotingCommand request = createResumeCheckHalfMessageCommand(); when(messageStore.selectOneMessageByOffset(any(Long.class))).thenReturn(createSelectMappedBufferResult()); when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.UNKNOWN_ERROR, new AppendMessageResult(AppendMessageStatus.UNKNOWN_ERROR))); RemotingCommand response = adminBrokerProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SYSTEM_ERROR); }
Example #13
Source File: EndTransactionProcessorTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_CheckMessage() throws RemotingCommandException { when(transactionMsgService.commitMessage(any(EndTransactionRequestHeader.class))).thenReturn(createResponse(ResponseCode.SUCCESS)); when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand request = createEndTransactionMsgCommand(MessageSysFlag.TRANSACTION_COMMIT_TYPE, true); RemotingCommand response = endTransactionProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #14
Source File: TransactionalMessageBridgeTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
@Test public void testPutHalfMessage() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); PutMessageResult result = transactionBridge.putHalfMessage(createMessageBrokerInner()); assertThat(result.getPutMessageStatus()).isEqualTo(PutMessageStatus.PUT_OK); }
Example #15
Source File: DeFiPluginMessageStoreTest.java From DeFiBus with Apache License 2.0 | 5 votes |
@Test public void testPutMessage(){ MessageExtBrokerInner inner = new MessageExtBrokerInner(); when(messageStore.putMessage(inner)).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); PutMessageResult result = deFiPluginMessageStore.putMessage(inner); assertThat(result.getPutMessageStatus()).isEqualTo(PutMessageStatus.PUT_OK); assertTrue(result.getAppendMessageResult().isOk()); }
Example #16
Source File: TransactionalMessageBridgeTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
@Test public void testPutHalfMessage() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); PutMessageResult result = transactionBridge.putHalfMessage(createMessageBrokerInner()); assertThat(result.getPutMessageStatus()).isEqualTo(PutMessageStatus.PUT_OK); }
Example #17
Source File: AdminBrokerProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_success() throws RemotingCommandException, UnknownHostException { RemotingCommand request = createResumeCheckHalfMessageCommand(); when(messageStore.selectOneMessageByOffset(any(Long.class))).thenReturn(createSelectMappedBufferResult()); when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand response = adminBrokerProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #18
Source File: TransactionalMessageBridgeTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
@Test public void testPutMessage() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); Boolean success = transactionBridge.putMessage(createMessageBrokerInner()); assertThat(success).isEqualTo(true); }
Example #19
Source File: EndTransactionProcessorTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest() throws RemotingCommandException { when(transactionMsgService.commitMessage(any(EndTransactionRequestHeader.class))).thenReturn(createResponse(ResponseCode.SUCCESS)); when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand request = createEndTransactionMsgCommand(MessageSysFlag.TRANSACTION_COMMIT_TYPE, false); RemotingCommand response = endTransactionProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #20
Source File: EndTransactionProcessorTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_CheckMessage() throws RemotingCommandException { when(transactionMsgService.commitMessage(any(EndTransactionRequestHeader.class))).thenReturn(createResponse(ResponseCode.SUCCESS)); when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand request = createEndTransactionMsgCommand(MessageSysFlag.TRANSACTION_COMMIT_TYPE, true); RemotingCommand response = endTransactionProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #21
Source File: SendMessageProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_WithMsgBack() throws RemotingCommandException { when(messageStore.asyncPutMessage(any(MessageExtBrokerInner.class))) .thenReturn(CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK)))); final RemotingCommand request = createSendMsgBackCommand(RequestCode.CONSUMER_SEND_MSG_BACK); sendMessageProcessor = new SendMessageProcessor(brokerController); final RemotingCommand response = sendMessageProcessor.processRequest(handlerContext, request); assertThat(response).isNotNull(); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #22
Source File: TransactionalMessageBridgeTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testPutMessage() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); Boolean success = transactionBridge.putMessage(createMessageBrokerInner()); assertThat(success).isEqualTo(true); }
Example #23
Source File: SendMessageProcessorTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_WithMsgBack() throws RemotingCommandException { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); final RemotingCommand request = createSendMsgBackCommand(RequestCode.CONSUMER_SEND_MSG_BACK); sendMessageProcessor = new SendMessageProcessor(brokerController); final RemotingCommand response = sendMessageProcessor.processRequest(handlerContext, request); assertThat(response).isNotNull(); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #24
Source File: SendMessageProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_WithMsgBack() throws RemotingCommandException { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); final RemotingCommand request = createSendMsgBackCommand(RequestCode.CONSUMER_SEND_MSG_BACK); sendMessageProcessor = new SendMessageProcessor(brokerController); final RemotingCommand response = sendMessageProcessor.processRequest(handlerContext, request); assertThat(response).isNotNull(); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #25
Source File: EndTransactionProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_CheckMessage() throws RemotingCommandException { when(transactionMsgService.commitMessage(any(EndTransactionRequestHeader.class))).thenReturn(createResponse(ResponseCode.SUCCESS)); when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand request = createEndTransactionMsgCommand(MessageSysFlag.TRANSACTION_COMMIT_TYPE, true); RemotingCommand response = endTransactionProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #26
Source File: SendMessageProcessorTest.java From DDMQ with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_WithMsgBack() throws RemotingCommandException { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); final RemotingCommand request = createSendMsgBackCommand(RequestCode.CONSUMER_SEND_MSG_BACK); sendMessageProcessor = new SendMessageProcessor(brokerController); final RemotingCommand response = sendMessageProcessor.processRequest(handlerContext, request); assertThat(response).isNotNull(); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #27
Source File: SendMessageProcessorTest.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_WithMsgBack() throws RemotingCommandException { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); final RemotingCommand request = createSendMsgBackCommand(RequestCode.CONSUMER_SEND_MSG_BACK); sendMessageProcessor = new SendMessageProcessor(brokerController); final RemotingCommand response = sendMessageProcessor.processRequest(handlerContext, request); assertThat(response).isNotNull(); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #28
Source File: TransactionalMessageBridgeTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testPutHalfMessage() { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); PutMessageResult result = transactionBridge.putHalfMessage(createMessageBrokerInner()); assertThat(result.getPutMessageStatus()).isEqualTo(PutMessageStatus.PUT_OK); }
Example #29
Source File: EndTransactionProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest() throws RemotingCommandException { when(transactionMsgService.commitMessage(any(EndTransactionRequestHeader.class))).thenReturn(createResponse(ResponseCode.SUCCESS)); when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult (PutMessageStatus.PUT_OK, new AppendMessageResult(AppendMessageStatus.PUT_OK))); RemotingCommand request = createEndTransactionMsgCommand(MessageSysFlag.TRANSACTION_COMMIT_TYPE, false); RemotingCommand response = endTransactionProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); }
Example #30
Source File: SendMessageProcessorTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Test public void testProcessRequest_ServiceNotAvailable() throws RemotingCommandException { when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.SERVICE_NOT_AVAILABLE, new AppendMessageResult(AppendMessageStatus.UNKNOWN_ERROR))); assertPutResult(ResponseCode.SERVICE_NOT_AVAILABLE); }