Skip to content

Commit c66b028

Browse files
committed
test
0 parents  commit c66b028

15 files changed

Lines changed: 696 additions & 0 deletions

File tree

common/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>xf-base</artifactId>
7+
<groupId>com.xf</groupId>
8+
<version>1.0.0</version>
9+
</parent>
10+
<groupId>com.xf</groupId>
11+
<artifactId>common</artifactId>
12+
<version>1.0.0</version>
13+
<name>common</name>
14+
<url>http://maven.apache.org</url>
15+
<properties>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
</properties>
18+
<dependencies>
19+
</dependencies>
20+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.xf.common;
2+
3+
/**
4+
* Hello world!
5+
*
6+
*/
7+
public class App
8+
{
9+
public static void main( String[] args )
10+
{
11+
System.out.println( "Hello World!" );
12+
}
13+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.xf.common;
2+
3+
import junit.framework.Test;
4+
import junit.framework.TestCase;
5+
import junit.framework.TestSuite;
6+
7+
/**
8+
* Unit test for simple App.
9+
*/
10+
public class AppTest
11+
extends TestCase
12+
{
13+
/**
14+
* Create the test case
15+
*
16+
* @param testName name of the test case
17+
*/
18+
public AppTest( String testName )
19+
{
20+
super( testName );
21+
}
22+
23+
/**
24+
* @return the suite of tests being tested
25+
*/
26+
public static Test suite()
27+
{
28+
return new TestSuite( AppTest.class );
29+
}
30+
31+
/**
32+
* Rigourous Test :-)
33+
*/
34+
public void testApp()
35+
{
36+
assertTrue( true );
37+
}
38+
}

pom.xml

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.xf</groupId>
6+
<artifactId>xf-base</artifactId>
7+
<version>1.0.0</version>
8+
<packaging>pom</packaging>
9+
10+
<name>xf-base</name>
11+
<url>http://maven.apache.org</url>
12+
<properties>
13+
<junit.version>4.11</junit.version>
14+
<rabbitmq.version>1.3.0</rabbitmq.version>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>junit</groupId>
21+
<artifactId>junit</artifactId>
22+
<version>${junit.version}</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>com.rabbitmq</groupId>
26+
<artifactId>rabbitmq-client</artifactId>
27+
<version>${rabbitmq.version}</version>
28+
</dependency>
29+
</dependencies>
30+
<!--<repositories>
31+
<repository>
32+
<id>nexus</id>
33+
<url>http://115.47.37.182:8081/nexus/content/groups/public/</url>
34+
<releases>
35+
<enabled>true</enabled>
36+
</releases>
37+
<snapshots>
38+
<enabled>true</enabled>
39+
</snapshots>
40+
</repository>
41+
42+
</repositories>
43+
<pluginRepositories>
44+
45+
<pluginRepository>
46+
<id>nexus</id>
47+
<url>http://115.47.37.182:8081/nexus/content/groups/public/</url>
48+
<releases>
49+
<enabled>true</enabled>
50+
</releases>
51+
<snapshots>
52+
<enabled>true</enabled>
53+
</snapshots>
54+
</pluginRepository>
55+
</pluginRepositories>-->
56+
<!-- 插件配置 -->
57+
<build>
58+
<pluginManagement>
59+
<plugins>
60+
<!-- compiler插件, 设定JDK版本 -->
61+
<plugin>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-compiler-plugin</artifactId>
64+
<version>3.1</version>
65+
<configuration>
66+
<source>${jdk.version}</source>
67+
<target>${jdk.version}</target>
68+
<showWarnings>true</showWarnings>
69+
</configuration>
70+
</plugin>
71+
72+
<!-- resource插件 -->
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-resources-plugin</artifactId>
76+
<version>2.6</version>
77+
</plugin>
78+
79+
<!-- test插件, 仅测试名称为*Test的类, 使用支持分组测试的surefire-junit47 driver -->
80+
<plugin>
81+
<groupId>org.apache.maven.plugins</groupId>
82+
<artifactId>maven-surefire-plugin</artifactId>
83+
<version>2.15</version>
84+
<configuration>
85+
<includes>
86+
<include>**/*Test.java</include>
87+
</includes>
88+
</configuration>
89+
<dependencies>
90+
<dependency>
91+
<groupId>org.apache.maven.surefire</groupId>
92+
<artifactId>surefire-junit47</artifactId>
93+
<version>2.15</version>
94+
</dependency>
95+
</dependencies>
96+
</plugin>
97+
98+
<!-- 增加更多的Source和Test Source目录插件 -->
99+
<plugin>
100+
<groupId>org.codehaus.mojo</groupId>
101+
<artifactId>build-helper-maven-plugin</artifactId>
102+
<version>1.8</version>
103+
</plugin>
104+
105+
<!-- cobertura 测试覆盖率统计插件 -->
106+
<plugin>
107+
<groupId>org.codehaus.mojo</groupId>
108+
<artifactId>cobertura-maven-plugin</artifactId>
109+
<version>2.5.2</version>
110+
</plugin>
111+
112+
<!-- war打包插件, 设定war包名称不带版本号 -->
113+
<plugin>
114+
<groupId>org.apache.maven.plugins</groupId>
115+
<artifactId>maven-war-plugin</artifactId>
116+
<version>2.4</version>
117+
<configuration>
118+
<warName>${project.artifactId}</warName>
119+
</configuration>
120+
</plugin>
121+
122+
<!-- jar打包相关插件 -->
123+
<plugin>
124+
<groupId>org.apache.maven.plugins</groupId>
125+
<artifactId>maven-jar-plugin</artifactId>
126+
<version>2.4</version>
127+
<configuration>
128+
<archive>
129+
<manifest>
130+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
131+
</manifest>
132+
</archive>
133+
</configuration>
134+
</plugin>
135+
<plugin>
136+
<groupId>org.apache.maven.plugins</groupId>
137+
<artifactId>maven-source-plugin</artifactId>
138+
<version>2.2.1</version>
139+
</plugin>
140+
141+
<!-- clean插件 -->
142+
<plugin>
143+
<groupId>org.apache.maven.plugins</groupId>
144+
<artifactId>maven-clean-plugin</artifactId>
145+
<version>2.5</version>
146+
</plugin>
147+
148+
<!-- install插件 -->
149+
<plugin>
150+
<groupId>org.apache.maven.plugins</groupId>
151+
<artifactId>maven-install-plugin</artifactId>
152+
<version>2.4</version>
153+
</plugin>
154+
155+
<!-- enforcer插件, 避免被依赖的依赖引入过期的jar包 -->
156+
<plugin>
157+
<groupId>org.apache.maven.plugins</groupId>
158+
<artifactId>maven-enforcer-plugin</artifactId>
159+
<version>1.3</version>
160+
<executions>
161+
<execution>
162+
<id>enforce-banned-dependencies</id>
163+
<goals>
164+
<goal>enforce</goal>
165+
</goals>
166+
<configuration>
167+
<rules>
168+
<requireMavenVersion>
169+
<version>3.0.3</version>
170+
</requireMavenVersion>
171+
<requireJavaVersion>
172+
<version>1.6</version>
173+
</requireJavaVersion>
174+
<bannedDependencies>
175+
<searchTransitive>true</searchTransitive>
176+
<excludes>
177+
<exclude>commons-logging</exclude>
178+
<exclude>aspectj:aspectj*</exclude>
179+
<exclude>org.springframework:2.*</exclude>
180+
<exclude>org.springframework:3.0.*</exclude>
181+
</excludes>
182+
</bannedDependencies>
183+
</rules>
184+
<fail>true</fail>
185+
</configuration>
186+
</execution>
187+
</executions>
188+
</plugin>
189+
190+
<!-- jetty插件 -->
191+
<plugin>
192+
<groupId>org.mortbay.jetty</groupId>
193+
<artifactId>jetty-maven-plugin</artifactId>
194+
<version>${jetty.version}</version>
195+
</plugin>
196+
197+
<!-- assembly插件 -->
198+
<plugin>
199+
<groupId>org.apache.maven.plugins</groupId>
200+
<artifactId>maven-assembly-plugin</artifactId>
201+
<version>2.4</version>
202+
</plugin>
203+
204+
<!-- dependency相关插件 -->
205+
<plugin>
206+
<groupId>org.apache.maven.plugins</groupId>
207+
<artifactId>maven-dependency-plugin</artifactId>
208+
<version>2.8</version>
209+
</plugin>
210+
<plugin>
211+
<groupId>org.codehaus.mojo</groupId>
212+
<artifactId>versions-maven-plugin</artifactId>
213+
<version>2.1</version>
214+
</plugin>
215+
216+
<!-- ant插件 -->
217+
<plugin>
218+
<groupId>org.apache.maven.plugins</groupId>
219+
<artifactId>maven-antrun-plugin</artifactId>
220+
<version>1.7</version>
221+
</plugin>
222+
223+
<!-- exec java 插件 -->
224+
<plugin>
225+
<groupId>org.codehaus.mojo</groupId>
226+
<artifactId>exec-maven-plugin</artifactId>
227+
<version>1.2.1</version>
228+
</plugin>
229+
</plugins>
230+
</pluginManagement>
231+
</build>
232+
<modules>
233+
<module>rabbitmq</module>
234+
<module>common</module>
235+
</modules>
236+
</project>

rabbitmq/pom.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0"?>
2+
<project
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<artifactId>xf-base</artifactId>
8+
<groupId>com.xf</groupId>
9+
<version>1.0.0</version>
10+
</parent>
11+
<groupId>com.xf</groupId>
12+
<artifactId>rabbitmq</artifactId>
13+
<version>1.0.0</version>
14+
<name>rabbitmq</name>
15+
<url>http://maven.apache.org</url>
16+
<properties>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<junit.version>4.11</junit.version>
19+
<rabbitmq.version>1.3.0</rabbitmq.version>
20+
<amqp.version>3.0.4</amqp.version>
21+
</properties>
22+
<dependencies>
23+
<dependency>
24+
<groupId>junit</groupId>
25+
<artifactId>junit</artifactId>
26+
<version>${junit.version}</version>
27+
</dependency>
28+
<!-- <dependency>
29+
<groupId>com.rabbitmq</groupId>
30+
<artifactId>rabbitmq-client</artifactId>
31+
<version>${rabbitmq.version}</version>
32+
</dependency>-->
33+
<dependency>
34+
<groupId>com.rabbitmq</groupId>
35+
<artifactId>amqp-client</artifactId>
36+
<version>${amqp.version}</version>
37+
</dependency>
38+
</dependencies>
39+
40+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.xf.rabbitmq.official.demo;
2+
3+
import com.rabbitmq.client.Channel;
4+
import com.rabbitmq.client.Connection;
5+
import com.rabbitmq.client.ConnectionFactory;
6+
7+
public class EmitLogDirect {
8+
9+
private static final String EXCHANGE_NAME = "direct_logs";
10+
11+
public static void main(String[] argv)
12+
throws java.io.IOException {
13+
14+
ConnectionFactory factory = new ConnectionFactory();
15+
factory.setHost("115.47.37.182");
16+
Connection connection = factory.newConnection();
17+
Channel channel = connection.createChannel();
18+
19+
channel.exchangeDeclare(EXCHANGE_NAME, "direct");
20+
21+
String severity = "A";
22+
String message = "B";
23+
24+
channel.basicPublish(EXCHANGE_NAME, severity, null, message.getBytes());
25+
System.out.println(" [x] Sent '" + severity + "':'" + message + "'");
26+
27+
channel.close();
28+
connection.close();
29+
}
30+
//..
31+
}

0 commit comments

Comments
 (0)