Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wj-datacenter-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
jinan
wj-datacenter-platform
Commits
280437db
Commit
280437db
authored
Jan 17, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单元测试
parent
07ec0e0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
pom.xml
wj-datacenter-service/pom.xml
+17
-0
KafkaTest.java
wj-datacenter-service/src/test/java/KafkaTest.java
+44
-0
No files found.
wj-datacenter-service/pom.xml
View file @
280437db
...
...
@@ -271,6 +271,23 @@
<groupId>
com.github.kokorin.jaffree
</groupId>
<artifactId>
jaffree
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<exclusions>
<exclusion>
<groupId>
com.vaadin.external.google
</groupId>
<artifactId>
android-json
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.13.2
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
...
...
wj-datacenter-service/src/test/java/KafkaTest.java
0 → 100644
View file @
280437db
/**
*
*/
import
com.alibaba.fastjson.JSONObject
;
import
net.wanji.common.gts.Tools
;
import
net.wanji.datacenter.DataCenterApplication
;
import
net.wanji.datacenter.kafka.KafkaProducerServiceHandler
;
import
org.junit.FixMethodOrder
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.MethodSorters
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
java.util.Date
;
/**
* @author fengyi
* @date 2019年1月19日
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
DataCenterApplication
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
public
class
KafkaTest
{
@Resource
private
KafkaProducerServiceHandler
kafkaProducerServiceHandler
;
@Test
public
void
testProducerTrack
()
{
//插入通知
JSONObject
insertNoticeJson
=
new
JSONObject
();
insertNoticeJson
.
put
(
"insertTime"
,
Tools
.
dateToStr
(
new
Date
()));
insertNoticeJson
.
put
(
"eventSerialNumber"
,
"sdsdsdsdsds"
);
kafkaProducerServiceHandler
.
send
(
"event.insert.notice.topic"
,
System
.
currentTimeMillis
()+
""
,
insertNoticeJson
.
toJSONString
());
System
.
out
.
println
();
}
}
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