-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1070 from eclipse-tractusx/feat/bpdm-system-teste…
…r-wip feat(bpdm-system-test): golden record tester module.
- Loading branch information
Showing
18 changed files
with
950 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
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,17 @@ | ||
# System Tester | ||
|
||
This application performs automated end-to-end tests on an existing golden record process. | ||
For this it needs access to a BPDM Gate application in order to share business partner data and compare the resulting golden records with the expected result. | ||
|
||
In order to use this application you first need to [install the BPDM applications](../INSTALL.md). | ||
For a local execution you can follow the following steps: | ||
|
||
1. Create a JAR file of the bpdm system tester (Execute from project root) | ||
```bash | ||
mvn -B -U clean package -pl bpdm-system-tester -am -DskipTests | ||
``` | ||
2. Install and run the BPDM applications locally without authentication | ||
3. Run the JAR file so the tests will be executed: | ||
```bash | ||
java -jar bpdm-system-tester/target/bpdm-system-tester.jar | ||
``` |
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,103 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.eclipse.tractusx</groupId> | ||
<artifactId>bpdm-parent</artifactId> | ||
<version>${revision}</version> | ||
</parent> | ||
|
||
<artifactId>bpdm-system-tester</artifactId> | ||
<name>Business Partner Data Management System Tester</name> | ||
<description>Application to perform system tests for the BPDM system and golden record process</description> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<cucumber.version>7.18.1</cucumber.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlinx</groupId> | ||
<artifactId>kotlinx-coroutines-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-reflect</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>bpdm-pool-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>bpdm-gate-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.github.microutils</groupId> | ||
<artifactId>kotlin-logging-jvm</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-junit</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-spring</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>bpdm-common-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<exclusions> | ||
<!-- in kotlin, use mockk instead of mockito --> | ||
<exclusion> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<!-- Name jar without version to make it easier to reference it during CICD --> | ||
<finalName>bpdm-system-tester</finalName> | ||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
41 changes: 41 additions & 0 deletions
41
bpdm-system-tester/src/main/kotlin/org/eclipse/tractusx/bpdm/test/system/Application.kt
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,41 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
******************************************************************************/ | ||
|
||
package org.eclipse.tractusx.bpdm.test.system | ||
|
||
import io.cucumber.junit.Cucumber | ||
import org.junit.runner.RunWith | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration | ||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan | ||
|
||
@RunWith(Cucumber::class) | ||
class CucumberTestRunConfiguration | ||
|
||
@SpringBootApplication(exclude=[DataSourceAutoConfiguration::class]) | ||
@ConfigurationPropertiesScan | ||
class SpringApplicationConfiguration | ||
|
||
fun main(args: Array<String>) { | ||
//use parallel execution default if not overwritten | ||
//can't use cucumber.properties for this as the properties parser currently does not support it | ||
//see https://github.com/cucumber/cucumber-jvm/issues/2833 | ||
val cucumberArgs = if(!args.contains("--threads")) args.plus(listOf("--threads", "16")) else args | ||
io.cucumber.core.cli.Main.main(*cucumberArgs) | ||
} |
54 changes: 54 additions & 0 deletions
54
...m-tester/src/main/kotlin/org/eclipse/tractusx/bpdm/test/system/config/GateClientConfig.kt
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,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
******************************************************************************/ | ||
|
||
package org.eclipse.tractusx.bpdm.test.system.config | ||
|
||
import org.eclipse.tractusx.bpdm.common.util.BpdmClientProperties | ||
import org.eclipse.tractusx.bpdm.common.util.BpdmWebClientProvider | ||
import org.eclipse.tractusx.bpdm.common.util.ClientConfigurationProperties | ||
import org.eclipse.tractusx.bpdm.gate.api.client.GateClient | ||
import org.eclipse.tractusx.bpdm.gate.api.client.GateClientImpl | ||
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties | ||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@ConfigurationProperties(prefix = PoolClientConfigurationProperties.PREFIX) | ||
data class GateClientConfigProperties( | ||
override val baseUrl: String = "http://localhost:8081", | ||
val searchChangelogPageSize: Int = 100, | ||
override val securityEnabled: Boolean = false, | ||
override val registration: OAuth2ClientProperties.Registration, | ||
override val provider: OAuth2ClientProperties.Provider | ||
) : BpdmClientProperties { | ||
companion object { | ||
const val PREFIX = "${ClientConfigurationProperties.PREFIX}.gate" | ||
} | ||
|
||
override fun getId() = PREFIX | ||
} | ||
|
||
@Configuration | ||
class GateClientConfig{ | ||
|
||
@Bean | ||
fun gateClient(webClientProvider: BpdmWebClientProvider, properties: GateClientConfigProperties): GateClient { | ||
return GateClientImpl { webClientProvider.builder(properties).build() } | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...m-tester/src/main/kotlin/org/eclipse/tractusx/bpdm/test/system/config/PoolClientConfig.kt
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,56 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
******************************************************************************/ | ||
|
||
package org.eclipse.tractusx.bpdm.test.system.config | ||
|
||
import org.eclipse.tractusx.bpdm.common.util.BpdmClientProperties | ||
import org.eclipse.tractusx.bpdm.common.util.BpdmWebClientProvider | ||
import org.eclipse.tractusx.bpdm.common.util.ClientConfigurationProperties | ||
import org.eclipse.tractusx.bpdm.pool.api.client.PoolApiClient | ||
import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl | ||
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties | ||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
|
||
@ConfigurationProperties(prefix = PoolClientConfigurationProperties.PREFIX) | ||
data class PoolClientConfigurationProperties( | ||
override val baseUrl: String = "http://localhost:8080", | ||
val searchChangelogPageSize: Int = 100, | ||
override val securityEnabled: Boolean = false, | ||
override val registration: OAuth2ClientProperties.Registration, | ||
override val provider: OAuth2ClientProperties.Provider | ||
) : BpdmClientProperties { | ||
companion object { | ||
const val PREFIX = "${ClientConfigurationProperties.PREFIX}.pool" | ||
} | ||
|
||
override fun getId() = PREFIX | ||
} | ||
|
||
@Configuration | ||
class PoolClientConfiguration{ | ||
|
||
@Bean | ||
fun poolClient(webClientProvider: BpdmWebClientProvider, properties: PoolClientConfigurationProperties): PoolApiClient{ | ||
return PoolClientImpl { webClientProvider.builder(properties).build() } | ||
} | ||
} | ||
|
65 changes: 65 additions & 0 deletions
65
...ter/src/main/kotlin/org/eclipse/tractusx/bpdm/test/system/config/TestDataConfiguration.kt
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,65 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
******************************************************************************/ | ||
|
||
package org.eclipse.tractusx.bpdm.test.system.config | ||
|
||
import org.eclipse.tractusx.bpdm.gate.api.client.GateClient | ||
import org.eclipse.tractusx.bpdm.pool.api.client.PoolApiClient | ||
import org.eclipse.tractusx.bpdm.test.system.utils.GateInputFactory | ||
import org.eclipse.tractusx.bpdm.test.system.utils.GateOutputFactory | ||
import org.eclipse.tractusx.bpdm.test.system.utils.StepUtils | ||
import org.eclipse.tractusx.bpdm.test.system.utils.TestMetadata | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import java.time.Instant | ||
|
||
@Configuration | ||
class TestDataConfiguration { | ||
|
||
@Bean | ||
fun testMetadata(poolClient: PoolApiClient): TestMetadata { | ||
val testMetadata = TestMetadata( | ||
identifierTypes = listOf("EU_VAT_ID_DE", "DUNS_ID"), | ||
legalForms = listOf("SCE1", "SGST"), | ||
adminAreas = listOf("DE-BW", "DE-BY") | ||
) | ||
|
||
return testMetadata | ||
} | ||
|
||
@Bean | ||
fun gateTestDataFactory(testMetadata: TestMetadata, testRunData: TestRunData): GateInputFactory { | ||
return GateInputFactory(testMetadata, testRunData) | ||
} | ||
|
||
@Bean | ||
fun gateOutputFactory(gateInputDataFactory: GateInputFactory): GateOutputFactory { | ||
return GateOutputFactory(gateInputDataFactory) | ||
} | ||
|
||
@Bean | ||
fun testRunData(): TestRunData { | ||
return TestRunData(Instant.now()) | ||
} | ||
|
||
@Bean | ||
fun stepUtils(testRunData: TestRunData, gateClient: GateClient): StepUtils{ | ||
return StepUtils(gateClient) | ||
} | ||
} |
Oops, something went wrong.