Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Data Flow
Real Time
Streams
Stream Admin Service
Commits
a52e759b
Commit
a52e759b
authored
Oct 01, 2021
by
Stephen Nimmo
Browse files
Added TopicAdminServiceTest to test topic creation with testcontainers
parent
a2763692
Pipeline
#69455
failed with stages
in 3 minutes and 19 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
a52e759b
...
...
@@ -113,6 +113,11 @@
<version>
${junit-version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.assertj
</groupId>
<artifactId>
assertj-core
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.kafka
</groupId>
<artifactId>
spring-kafka-test
</artifactId>
...
...
src/main/java/org/opengroup/osdu/streaming/di/StorageClientFactory.java
View file @
a52e759b
...
...
@@ -27,7 +27,6 @@ import org.springframework.beans.factory.config.AbstractFactoryBean;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
javax.inject.Inject
;
@Component
public
class
StorageClientFactory
extends
AbstractFactoryBean
<
IStorageFactory
>
{
...
...
src/test/java/org/opengroup/osdu/streaming/service/TopicAdminServiceTest.java
0 → 100644
View file @
a52e759b
package
org.opengroup.osdu.streaming.service
;
import
org.apache.kafka.clients.admin.NewTopic
;
import
org.junit.ClassRule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.opengroup.osdu.streaming.model.StreamRecord
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.testcontainers.containers.KafkaContainer
;
import
org.testcontainers.utility.DockerImageName
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
TopicAdminServiceTest
{
@ClassRule
public
static
KafkaContainer
kafka
=
new
KafkaContainer
(
DockerImageName
.
parse
(
"confluentinc/cp-kafka:5.4.3"
));
@Autowired
private
TopicAdminService
topicAdminService
;
@Test
public
void
topicCreation
()
{
StreamRecord
streamRecord
=
new
StreamRecord
();
streamRecord
.
setKind
(
"test"
);
NewTopic
newTopic
=
topicAdminService
.
createTopic
(
streamRecord
);
assertThat
(
newTopic
).
isNotNull
();
assertThat
(
newTopic
.
name
()).
isEqualTo
(
"test"
);
}
}
Write
Preview
Supports
Markdown
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