-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a spring boot 2 test. At the moment, it only tests successfull…
… startup. Let's see what comes next.
- Loading branch information
Showing
8 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>nakadi-producer-starter-spring-boot-2-test</artifactId> | ||
<groupId>org.zalando</groupId> | ||
|
||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.0.3.RELEASE</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.zalando</groupId> | ||
<artifactId>nakadi-producer-spring-boot-starter</artifactId> | ||
<version>4.1.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.zalando.stups</groupId> | ||
<artifactId>tokens</artifactId> | ||
<version>0.12.0-beta-2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
<version>2.0.3.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.opentable.components</groupId> | ||
<artifactId>otj-pg-embedded</artifactId> | ||
<version>0.12.0</version> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>postgresql</artifactId> | ||
<groupId>postgresql</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.stefanbirkner</groupId> | ||
<artifactId>system-rules</artifactId> | ||
<version>1.18.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>2.22.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
32 changes: 32 additions & 0 deletions
32
...tarter-spring-boot-2-test/src/main/java/org/zalando/nakadiproducer/tests/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.zalando.nakadiproducer.tests; | ||
|
||
import com.opentable.db.postgres.embedded.EmbeddedPostgres; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Primary; | ||
import org.zalando.nakadiproducer.EnableNakadiProducer; | ||
|
||
import javax.sql.DataSource; | ||
|
||
import java.io.IOException; | ||
|
||
@EnableAutoConfiguration | ||
@EnableNakadiProducer | ||
public class Application { | ||
|
||
public static void main(String[] args) throws Exception { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
|
||
@Bean | ||
@Primary | ||
public DataSource dataSource() throws IOException { | ||
return embeddedPostgres().getPostgresDatabase(); | ||
} | ||
|
||
@Bean | ||
public EmbeddedPostgres embeddedPostgres() throws IOException { | ||
return EmbeddedPostgres.start(); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
nakadi-producer-starter-spring-boot-2-test/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nakadi-producer.access-token-uri: http://localhost:1234 | ||
nakadi-producer.nakadi-base-uri: https://nakadi.example.org:5432 |
Empty file.
34 changes: 34 additions & 0 deletions
34
...rter-spring-boot-2-test/src/test/java/org/zalando/nakadiproducer/tests/ApplicationIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.zalando.nakadiproducer.tests; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.junit.contrib.java.lang.system.EnvironmentVariables; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import java.io.File; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest( | ||
classes = Application.class, | ||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT | ||
) | ||
public class ApplicationIT { | ||
|
||
@ClassRule | ||
public static final EnvironmentVariables environmentVariables | ||
= new EnvironmentVariables(); | ||
|
||
@BeforeClass | ||
public static void fakeCredentialsDir() { | ||
environmentVariables.set("CREDENTIALS_DIR", new File("src/main/test/tokens").getAbsolutePath()); | ||
} | ||
|
||
@Test | ||
public void foo() { | ||
} | ||
|
||
|
||
} |
1 change: 1 addition & 0 deletions
1
nakadi-producer-starter-spring-boot-2-test/src/test/resources/tokens/nakadi-token-secret
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
my fake token |
1 change: 1 addition & 0 deletions
1
nakadi-producer-starter-spring-boot-2-test/src/test/resources/tokens/nakadi-token-type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Bearer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters