package com.iailab.module.data.controller; import com.alibaba.fastjson.JSONObject; import com.iailab.framework.common.util.date.DateUtils; import com.iailab.framework.test.core.ut.BaseMockitoUnitTest; import com.iailab.module.shasteel.ShasteelServerApplication; import com.iailab.module.shasteel.mq.consumer.PredictFinishMessage; import org.junit.jupiter.api.Test; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; import java.util.Date; /** * @author lirm * @Description * @createTime 2024年11月27日 */ @SpringBootTest(classes = ShasteelServerApplication.class) public class RabbitMQTest extends BaseMockitoUnitTest { @Resource private RabbitTemplate rabbitTemplate; @Test public void testProducer() { JSONObject content = new JSONObject(); content.put("moduleType", "NET_LDG"); content.put("predictTime", "2024-12-04 06:30:00"); rabbitTemplate.convertAndSend(PredictFinishMessage.EXCHANGE, PredictFinishMessage.PREDICTFINISH_ROUTING_KEY, content); } }