Skip to content

Commit

Permalink
Merge pull request #2965 from ruansheng8/fix-2963
Browse files Browse the repository at this point in the history
Fix #2963 RocketMQ binder test NPE
  • Loading branch information
steverao authored Dec 13, 2022
2 parents fff58cc + 2210917 commit cb74bc3
Showing 1 changed file with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package com.alibaba.cloud.stream.binder.rocketmq;

import javax.annotation.Resource;

import com.alibaba.cloud.stream.binder.rocketmq.autoconfigurate.ExtendedBindingHandlerMappingsProviderConfiguration;
import com.alibaba.cloud.stream.binder.rocketmq.autoconfigurate.RocketMQBinderAutoConfiguration;
import com.alibaba.cloud.stream.binder.rocketmq.constant.RocketMQConst;
import com.alibaba.cloud.stream.binder.rocketmq.properties.RocketMQConsumerProperties;
import jakarta.annotation.Resource;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -56,28 +56,27 @@
public class RocketMQMessageChannelBinderTest {
@Resource
RocketMQMessageChannelBinder binder;

// todo spring boot 3.0 upgrade: fix spring cloud stream binder
// @Test
// public void createConsumerEndpoint() throws Exception {
// TestConsumerDestination destination = new TestConsumerDestination("test");
// MessageProducer consumerEndpoint = binder.createConsumerEndpoint(destination, "test",
// new ExtendedConsumerProperties<>(new RocketMQConsumerProperties()));
// Assertions.assertThat(consumerEndpoint).isNotNull();
// }
//
// @Test
// public void createAnymousConsumerEndpoint() throws Exception {
// ExtendedConsumerProperties<RocketMQConsumerProperties> extendedConsumerProperties
// = new ExtendedConsumerProperties<>(new RocketMQConsumerProperties());
//
// TestConsumerDestination destination = new TestConsumerDestination("test");
// MessageProducer consumerEndpoint = binder.createConsumerEndpoint(destination, null,
// extendedConsumerProperties);
// Assertions.assertThat(consumerEndpoint).isNotNull();
// Assertions.assertThat(extendedConsumerProperties.getExtension().getGroup())
// .isEqualTo(RocketMQConst.DEFAULT_GROUP + "_test");
// }

@Test
public void createConsumerEndpoint() throws Exception {
TestConsumerDestination destination = new TestConsumerDestination("test");
MessageProducer consumerEndpoint = binder.createConsumerEndpoint(destination, "test",
new ExtendedConsumerProperties<>(new RocketMQConsumerProperties()));
Assertions.assertThat(consumerEndpoint).isNotNull();
}

@Test
public void createAnymousConsumerEndpoint() throws Exception {
ExtendedConsumerProperties<RocketMQConsumerProperties> extendedConsumerProperties
= new ExtendedConsumerProperties<>(new RocketMQConsumerProperties());

TestConsumerDestination destination = new TestConsumerDestination("test");
MessageProducer consumerEndpoint = binder.createConsumerEndpoint(destination, null,
extendedConsumerProperties);
Assertions.assertThat(consumerEndpoint).isNotNull();
Assertions.assertThat(extendedConsumerProperties.getExtension().getGroup())
.isEqualTo(RocketMQConst.DEFAULT_GROUP + "_test");
}

@Test
public void createDLQAnymousConsumerEndpoint() throws Exception {
Expand Down

0 comments on commit cb74bc3

Please sign in to comment.