Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
53ca15b4
Commit
53ca15b4
authored
Mar 23, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish spring-boot-sample-activemq
parent
4dbf55ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
16 deletions
+23
-16
pom.xml
spring-boot-samples/spring-boot-sample-activemq/pom.xml
+10
-8
Producer.java
...mple-activemq/src/main/java/sample/activemq/Producer.java
+1
-1
SampleActiveMQApplication.java
.../main/java/sample/activemq/SampleActiveMQApplication.java
+2
-2
SampleActiveMqTests.java
...mq/src/test/java/sample/activemq/SampleActiveMqTests.java
+10
-5
No files found.
spring-boot-samples/spring-boot-sample-activemq/pom.xml
View file @
53ca15b4
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<artifactId>
spring-boot-samples
</artifactId>
<groupId>
org.springframework.boot
</groupId>
<version>
1.3.0.BUILD-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
spring-boot-sample-activemq
</artifactId>
<name>
Spring Boot ActiveMQ Sample
</name>
<description>
Spring Boot ActiveMQ Sample
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<name>
Pivotal Software, Inc.
</name>
<url>
http://www.spring.io
</url>
</organization>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -26,14 +31,12 @@
<groupId>
org.apache.activemq
</groupId>
<artifactId>
activemq-broker
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
...
...
@@ -42,5 +45,4 @@
</plugin>
</plugins>
</build>
</project>
spring-boot-samples/spring-boot-sample-activemq/src/main/java/sample/activemq/Producer.java
View file @
53ca15b4
...
...
@@ -39,7 +39,7 @@ public class Producer implements CommandLineRunner {
}
public
void
send
(
String
msg
)
{
jmsMessagingTemplate
.
convertAndSend
(
queue
,
msg
);
this
.
jmsMessagingTemplate
.
convertAndSend
(
this
.
queue
,
msg
);
}
}
spring-boot-samples/spring-boot-sample-activemq/src/main/java/sample/activemq/SampleActiveMQApplication.java
View file @
53ca15b4
...
...
@@ -16,14 +16,14 @@
package
sample
.
activemq
;
import
javax.jms.Queue
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.jms.annotation.EnableJms
;
import
javax.jms.Queue
;
@SpringBootApplication
@EnableJms
public
class
SampleActiveMQApplication
{
...
...
spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java
View file @
53ca15b4
...
...
@@ -16,6 +16,8 @@
package
sample
.
activemq
;
import
javax.jms.JMSException
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -24,12 +26,15 @@ import org.springframework.boot.test.OutputCapture;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
javax.jms.JMSException
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* Integration tests for demo application.
*
* @author Eddú Meléndez
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
{
SampleActiveMQApplication
.
class
})
@SpringApplicationConfiguration
(
classes
=
{
SampleActiveMQApplication
.
class
})
public
class
SampleActiveMqTests
{
@Rule
...
...
@@ -40,9 +45,9 @@ public class SampleActiveMqTests {
@Test
public
void
sendSimpleMessage
()
throws
InterruptedException
,
JMSException
{
producer
.
send
(
"Test message"
);
this
.
producer
.
send
(
"Test message"
);
Thread
.
sleep
(
1000L
);
assertTrue
(
outputCapture
.
toString
().
contains
(
"Test message"
));
assertTrue
(
this
.
outputCapture
.
toString
().
contains
(
"Test message"
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment