Skip to content

Commit

Permalink
发布前clean
Browse files Browse the repository at this point in the history
  • Loading branch information
pufang committed Jan 30, 2018
1 parent 20c92e1 commit ea249f4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void syncSendOrderly(Message message, String hashKey) throws MQException

/**
* 重写此方法处理发送后的逻辑
*
* @param message 发送消息体
* @param sendResult 发送结果
*/
public void doAfterSyncSend(Message message, SendResult sendResult) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class OnsTraceDataEncoder {
/**
* 从轨迹数据字符串中解析出traceContext列表
*
* @param traceData
* @return
* @param traceData trace数据
* @return trace列表
*/
public static List<OnsTraceContext> decoderFromTraceDataString(String traceData) {
List<OnsTraceContext> resList = new ArrayList<OnsTraceContext>();
Expand Down Expand Up @@ -88,8 +88,8 @@ else if (line[0].equals(OnsTraceType.SubAfter.name())) {
/**
* 将轨迹上下文编码成轨迹数据字符串以及keyset集合
*
* @param ctx
* @return
* @param ctx 上下文
* @return trace bean
*/
public static OnsTraceTransferBean encoderFromContextBean(OnsTraceContext ctx) {
if (ctx == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public abstract class AsyncAppender {
/**
*编码数据上下文到缓冲区
* @param context
* @param context 上下文
*/
public abstract void append(Object context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class AsyncDispatcher {

/**
* 强制调用写操作
* @throws IOException
* @throws IOException io异常
*/
public abstract void flush() throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ public class AsyncTraceAppender extends AsyncAppender {
/**
* 构造消息类型的轨迹数据发送器
*
* @param properties
* 参数属性
* @throws MQClientException
* @param properties 参数属性
* @throws MQClientException 消息异常
*/
public AsyncTraceAppender(Properties properties) throws MQClientException {
transDataList = new ArrayList<OnsTraceTransferBean>();
Expand Down Expand Up @@ -68,7 +67,7 @@ public AsyncTraceAppender(Properties properties) throws MQClientException {
/**
* 往消息缓冲区编码轨迹数据
*
* @param context
* @param context 上下文
*/
@Override
public void append(Object context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* 消息轨迹工具类
*
* @author: manhong.yqd<jodie.yqd@gmail.com>
* @since: 14-6-20
* author: manhong.yqd
* since: 14-6-20
*/
public class MixUtils {
public static String getLocalAddress() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ public class MQConsumerAutoConfigurationTest {

private void prepareApplicationContext() {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "rocketmq.name-server-address:127.0.0.1:9876");
EnvironmentTestUtils.addEnvironment(this.context, "spring.rocketmq.name-server-address:127.0.0.1:9876");
this.context.register(TestConsumer.class);
this.context.register(MQConsumerAutoConfiguration.class);
this.context.refresh();
}

private void prepareApplicationContextCMOrderly() {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "rocketmq.name-server-address:127.0.0.1:9876");
EnvironmentTestUtils.addEnvironment(this.context, "spring.rocketmq.name-server-address:127.0.0.1:9876");
this.context.register(TestConsumerOrderly.class);
this.context.register(MQConsumerAutoConfiguration.class);
this.context.refresh();
}

private void prepareApplicationContextCMError() {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "rocketmq.name-server-address:127.0.0.1:9876");
EnvironmentTestUtils.addEnvironment(this.context, "spring.rocketmq.name-server-address:127.0.0.1:9876");
this.context.register(TestConsumerErrorCM.class);
this.context.register(MQConsumerAutoConfiguration.class);
this.context.refresh();
Expand All @@ -51,7 +51,7 @@ private void prepareApplicationContextMissingNS() {

private void prepareApplicationContextMissingParent() {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "rocketmq.name-server-address:127.0.0.1:9876");
EnvironmentTestUtils.addEnvironment(this.context, "spring.rocketmq.name-server-address:127.0.0.1:9876");
this.context.register(TestConsumerMissingParent.class);
this.context.register(MQConsumerAutoConfiguration.class);
this.context.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

public class MQProducerAutoConfigurationTest {

Expand Down Expand Up @@ -63,11 +64,10 @@ public void close() {
}


@Test(expected = RuntimeException.class)
@Test
public void testEmpty() {
prepareApplicationContextEmpty();
// throws NoSuchBeanDefinitionException which is subclass of RuntimeException
context.getBean(DefaultMQProducer.class);
assertNull(context.getBean(DefaultMQProducer.class));
}

@Test(expected = RuntimeException.class)
Expand Down

0 comments on commit ea249f4

Please sign in to comment.