-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eec94eb
commit 3be2716
Showing
11 changed files
with
390 additions
and
1 deletion.
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
114 changes: 114 additions & 0 deletions
114
docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test.adoc
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,114 @@ | ||
|
||
:summaryTableId: tkit-quarkus-test | ||
[.configuration-legend] | ||
icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime | ||
[.configuration-reference.searchable, cols="80,.^10,.^10"] | ||
|=== | ||
|
||
h|[[tkit-quarkus-test_configuration]]link:#tkit-quarkus-test_configuration[Configuration property] | ||
|
||
h|Type | ||
h|Default | ||
|
||
a| [[tkit-quarkus-test_tkit-test-integration-test-enabled]]`link:#tkit-quarkus-test_tkit-test-integration-test-enabled[tkit.test.integration-test-enabled]` | ||
|
||
|
||
[.description] | ||
-- | ||
Disable or enabled integration test flag | ||
|
||
ifdef::add-copy-button-to-env-var[] | ||
Environment variable: env_var_with_copy_button:+++TKIT_TEST_INTEGRATION_TEST_ENABLED+++[] | ||
endif::add-copy-button-to-env-var[] | ||
ifndef::add-copy-button-to-env-var[] | ||
Environment variable: `+++TKIT_TEST_INTEGRATION_TEST_ENABLED+++` | ||
endif::add-copy-button-to-env-var[] | ||
--|boolean | ||
|`false` | ||
|
||
|
||
a| [[tkit-quarkus-test_tkit-test-ci-enabled]]`link:#tkit-quarkus-test_tkit-test-ci-enabled[tkit.test.ci.enabled]` | ||
|
||
|
||
[.description] | ||
-- | ||
Disable or enabled for ci pipeline | ||
|
||
ifdef::add-copy-button-to-env-var[] | ||
Environment variable: env_var_with_copy_button:+++TKIT_TEST_CI_ENABLED+++[] | ||
endif::add-copy-button-to-env-var[] | ||
ifndef::add-copy-button-to-env-var[] | ||
Environment variable: `+++TKIT_TEST_CI_ENABLED+++` | ||
endif::add-copy-button-to-env-var[] | ||
--|boolean | ||
|`true` | ||
|
||
|
||
a| [[tkit-quarkus-test_tkit-test-ci-env-name]]`link:#tkit-quarkus-test_tkit-test-ci-env-name[tkit.test.ci.env-name]` | ||
|
||
|
||
[.description] | ||
-- | ||
The name of environment variable to check if we are running in the pipe. | ||
|
||
ifdef::add-copy-button-to-env-var[] | ||
Environment variable: env_var_with_copy_button:+++TKIT_TEST_CI_ENV_NAME+++[] | ||
endif::add-copy-button-to-env-var[] | ||
ifndef::add-copy-button-to-env-var[] | ||
Environment variable: `+++TKIT_TEST_CI_ENV_NAME+++` | ||
endif::add-copy-button-to-env-var[] | ||
--|string | ||
|`GITLAB_CI` | ||
|
||
|
||
a| [[tkit-quarkus-test_tkit-test-rest-assured-enabled]]`link:#tkit-quarkus-test_tkit-test-rest-assured-enabled[tkit.test.rest-assured.enabled]` | ||
|
||
|
||
[.description] | ||
-- | ||
Disable or enabled rest-assured config. | ||
|
||
ifdef::add-copy-button-to-env-var[] | ||
Environment variable: env_var_with_copy_button:+++TKIT_TEST_REST_ASSURED_ENABLED+++[] | ||
endif::add-copy-button-to-env-var[] | ||
ifndef::add-copy-button-to-env-var[] | ||
Environment variable: `+++TKIT_TEST_REST_ASSURED_ENABLED+++` | ||
endif::add-copy-button-to-env-var[] | ||
--|boolean | ||
|`true` | ||
|
||
|
||
a| [[tkit-quarkus-test_tkit-test-rest-assured-overwrite-uri-enabled]]`link:#tkit-quarkus-test_tkit-test-rest-assured-overwrite-uri-enabled[tkit.test.rest-assured.overwrite-uri.enabled]` | ||
|
||
|
||
[.description] | ||
-- | ||
Disable or enabled URI overwrite | ||
|
||
ifdef::add-copy-button-to-env-var[] | ||
Environment variable: env_var_with_copy_button:+++TKIT_TEST_REST_ASSURED_OVERWRITE_URI_ENABLED+++[] | ||
endif::add-copy-button-to-env-var[] | ||
ifndef::add-copy-button-to-env-var[] | ||
Environment variable: `+++TKIT_TEST_REST_ASSURED_OVERWRITE_URI_ENABLED+++` | ||
endif::add-copy-button-to-env-var[] | ||
--|boolean | ||
|`true` | ||
|
||
|
||
a| [[tkit-quarkus-test_tkit-test-rest-assured-overwrite-uri-uri]]`link:#tkit-quarkus-test_tkit-test-rest-assured-overwrite-uri-uri[tkit.test.rest-assured.overwrite-uri.uri]` | ||
|
||
|
||
[.description] | ||
-- | ||
Overwrite the RestAssured URI with a new value. | ||
|
||
ifdef::add-copy-button-to-env-var[] | ||
Environment variable: env_var_with_copy_button:+++TKIT_TEST_REST_ASSURED_OVERWRITE_URI_URI+++[] | ||
endif::add-copy-button-to-env-var[] | ||
ifndef::add-copy-button-to-env-var[] | ||
Environment variable: `+++TKIT_TEST_REST_ASSURED_OVERWRITE_URI_URI+++` | ||
endif::add-copy-button-to-env-var[] | ||
--|string | ||
|`http://docker` | ||
|
||
|=== |
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,52 @@ | ||
== tkit-quarkus-security-test | ||
|
||
include::./includes/attributes.adoc[] | ||
|
||
Enhanced test configuration | ||
|
||
=== Installation | ||
|
||
If you want to use this extension, you need to add the `org.tkit.quarkus.lib:tkit-quarkus-test` extension first to your build file. | ||
|
||
For instance, with Maven, add the following dependency to your POM file: | ||
|
||
[source,xml,subs=attributes+] | ||
---- | ||
<dependency> | ||
<groupId>org.tkit.quarkus.lib</groupId> | ||
<artifactId>tkit-quarkus-test</artifactId> | ||
<version>{project-version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
---- | ||
|
||
=== Usage | ||
|
||
==== Rest-Assured URI overwrite | ||
|
||
To enabled URI overwrite for integration test add `tkit.test.integration-test-enabled` system property to the `maven-failsafe-plugin` plugin. | ||
|
||
[source,xml,subs=attributes+] | ||
---- | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<tkit.test.integration-test-enabled>true</tkit.test.integration-test-enabled> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
---- | ||
|
||
=== Configuration | ||
|
||
include::includes/tkit-quarkus-test.adoc[leveloffset=+1, opts=optional] |
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
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
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,50 @@ | ||
<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> | ||
<groupId>org.tkit.quarkus.lib</groupId> | ||
<artifactId>tkit-quarkus-extensions-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>tkit-quarkus-test</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-jackson</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
96 changes: 96 additions & 0 deletions
96
extensions/test/src/main/java/org/tkit/quarkus/test/TestConfig.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,96 @@ | ||
package org.tkit.quarkus.test; | ||
|
||
import io.quarkus.runtime.annotations.ConfigDocFilename; | ||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.quarkus.runtime.annotations.StaticInitSafe; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
import io.smallrye.config.WithName; | ||
|
||
@StaticInitSafe | ||
@ConfigDocFilename("tkit-quarkus-test.adoc") | ||
@ConfigMapping(prefix = "tkit.test") | ||
@ConfigRoot(phase = ConfigPhase.RUN_TIME) | ||
public interface TestConfig { | ||
|
||
/** | ||
* Disable or enabled integration test flag | ||
*/ | ||
@WithName("integration-test-enabled") | ||
@WithDefault("false") | ||
boolean integrationTestEnabled(); | ||
|
||
/** | ||
* CI pipe configuration. | ||
*/ | ||
@WithName("ci") | ||
CiConfig ciConfig(); | ||
|
||
/** | ||
* CI pipe configuration. | ||
*/ | ||
interface CiConfig { | ||
|
||
/** | ||
* Disable or enabled for ci pipeline | ||
*/ | ||
@WithName("enabled") | ||
@WithDefault("true") | ||
boolean enabled(); | ||
|
||
/** | ||
* The name of environment variable to check if we are running in the pipe. | ||
*/ | ||
@WithName("env-name") | ||
@WithDefault("GITLAB_CI") | ||
String envName(); | ||
|
||
} | ||
|
||
/** | ||
* Rest assured configuration. | ||
*/ | ||
@WithName("rest-assured") | ||
RestAssuredConfig restAssuredConfig(); | ||
|
||
/** | ||
* Rest assured configuration. | ||
*/ | ||
interface RestAssuredConfig { | ||
|
||
/** | ||
* Disable or enabled rest-assured config. | ||
*/ | ||
@WithName("enabled") | ||
@WithDefault("true") | ||
boolean enabled(); | ||
|
||
/** | ||
* Rest assured overwrite URI configuration. | ||
*/ | ||
@WithName("overwrite-uri") | ||
RestAssuredOverwriteUriConfig uriOverwrite(); | ||
|
||
} | ||
|
||
/** | ||
* Rest assured overwrite URI configuration. | ||
*/ | ||
interface RestAssuredOverwriteUriConfig { | ||
/** | ||
* Disable or enabled URI overwrite | ||
*/ | ||
@WithName("enabled") | ||
@WithDefault("true") | ||
boolean enabled(); | ||
|
||
/** | ||
* Overwrite the RestAssured URI with a new value. | ||
*/ | ||
@WithName("uri") | ||
@WithDefault("http://docker") | ||
String uri(); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
extensions/test/src/main/java/org/tkit/quarkus/test/TestConfigUtil.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,20 @@ | ||
package org.tkit.quarkus.test; | ||
|
||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
|
||
public final class TestConfigUtil { | ||
|
||
private final static TestConfig TEST_CONFIG; | ||
|
||
static { | ||
TEST_CONFIG = new SmallRyeConfigBuilder() | ||
.addDefaultSources() | ||
.withMapping(TestConfig.class) | ||
.build() | ||
.getConfigMapping(TestConfig.class); | ||
} | ||
|
||
static public TestConfig config() { | ||
return TEST_CONFIG; | ||
} | ||
} |
Oops, something went wrong.