Authored by 胡古飞

添加test case

package com.yoho.message.test;
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.yoho.message.sdk.service.order.ISendOrderMessage;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath*:META-INF/spring/spring*.xml" })
public class TestSendOrderMessage {
@Resource
ISendOrderMessage sendOrderMessage;
@Test
public void orderSendOut() {
sendOrderMessage.orderSendOut("10971325", "1611776769", "611783471150");
}
}
... ...
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="mc-simpleMessageConverter" class="org.springframework.amqp.support.converter.SimpleMessageConverter"/>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:test.properties</value>
</property>
<property name="fileEncoding" value="utf-8" />
</bean>
<rabbit:connection-factory id="mc-rabbitmq-connectionFactory" addresses="${rabbit_message_center:rabbitmq-common-aws.yohoops.org:5672}"
username="${rabbit_message_center_user:yoho}" password="${rabbit_message_center_password:yoho}" virtual-host="${rabbit_message_center_vhost:yoho}" />
<rabbit:template id="mc-amqpTemplate" connection-factory="mc-rabbitmq-connectionFactory" message-converter="mc-simpleMessageConverter"/>
<!--消息中心发送消息的 producerTemplate-->
<bean id="mc-producerTemplate" class="com.yoho.core.message.YhProducerTemplate" primary="false">
<property name="amqpTemplate" ref="mc-amqpTemplate"/>
</bean>
</beans>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd">
<!-- Spring扫描目录,通过注解的方式注入bean,只扫描本工程的目录 -->
<context:component-scan base-package="com.yoho.*" />
<task:annotation-driven/>
<!-- 打开aop 注解 -->
<aop:aspectj-autoproxy proxy-target-class="true"/>
</beans>
\ No newline at end of file
... ...
#rabbit address
rabbit_host=192.168.102.216:5672
rabbit_user=admin1
rabbit_password=123qwe
rabbit_vhost=/yohosearch
rabbit_concurrent=8
#rabbit address
rabbit_message_center=192.168.102.211:5672
rabbit_message_center_user=yoho
rabbit_message_center_password=yoho
rabbit_message_center_vhost=yoho
zkAddress=192.168.102.216:2181
\ No newline at end of file
... ...