package org.onetwo.boot.module.activemq;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onetwo.common.utils.LangOps;
import org.onetwo.common.utils.LangUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author wayshall
 * <br/>
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes=ActivemqTestApplication.class,
//				properties={"spring.activemq.in-memory=false", "spring.activemq.pool.enabled=false", "spring.activemq.broker-url=tcp://localhost:61616"},
				properties={
//							"spring.activemq.in-memory=true", "spring.activemq.pool.enabled=false", 
							"spring.activemq.in-memory=false", "spring.activemq.pool.enabled=false", "spring.activemq.broker-url=tcp://localhost:61616", 
//							"jfish.activemq.embedded.enabled=true", "jfish.activemq.jdbcStore.enabled=true"
							"jfish.mq.transactional.enabled=true",
							"jfish.mq.transactional.sendTask.enabled=true",
							"jfish.mq.transactional.deleteTask.enabled=true",
							"jfish.activemq.enabled=true"
							}
)
public class ActivemqTest {
	@Rule
	public OutputCapture outputCapture = new OutputCapture();

	@Autowired
	private ProducerTestBean producer;

	@Test
	public void sendSimpleMessage() throws InterruptedException {
//		LangOps.ntimesRun(10, (i)->this.producer.send2Topic("Test message " + i));
		Thread.sleep(1000L);
//		assertThat(this.outputCapture.toString().contains("Test message")).isTrue();
		

//		LangOps.ntimesRun(10, (i)->this.producer.send("Test message " + i));
//		String receiveMessage = this.producer.sendReplyQueue("Test message");
//		Thread.sleep(1000L);
//		assertThat(receiveMessage).isEqualTo("I got it!");
		
		LangUtils.CONSOLE.exitIf("exit");
	}

}

@@ -36,67 +36,17 @@
 vemq
-;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat
+.producer
 ;%0A%0Ai
@@ -127,48 +127,8 @@
 th;%0A
-import org.onetwo.common.utils.LangOps;%0A
 impo
@@ -506,20 +506,24 @@
 Activemq
-Test
+Producer
 Applicat
@@ -1225,16 +1225,24 @@
 Activemq
+Producer
 Test %7B%0A%09

fix activemq test