Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Jakarta Data TCK runner #123

Merged
merged 4 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/tck-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Run Jakarta Data TCK

on:
schedule:
- cron: '0 0 * * 1,3,5' #Monday, Wednesday, Friday at Midnight

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [17, 21]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
cache: maven
- name: Running Jakarta Data TCK tests
run: mvn test --file jnosql-data-tck-runner/pom.xml -Djakarta.tck.profile=standalone -Djnosql.document.database=jnosql -Djnosql.mongodb.host=localhost:27017
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version

== [Unreleased]

- Include Jakarta Data TCK Runner for Eclipse JNoSQL;

== [1.1.1] - 2023-05-25

=== Added
Expand Down
7 changes: 7 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,13 @@ The Criteria API can be used via CriteriaDocumentTemplate.
</dependency>
----

== TCK Runners

The Eclipse JNoSQL project provides Technology Compatibility Kit (TCK) runners for Jakarta Data. These runners allow you to run the TCK tests against the Eclipse JNoSQL implementation to verify its compatibility with the Jakarta Data specifications.

=== Jakarta Data TCK Runner

The Jakarta Data TCK Runner is a project that runs the Jakarta Data TCK tests against the Eclipse JNoSQL implementation. It provides a convenient way to verify the compatibility of a Jakarta Data implementation with the Jakarta Data specification. Learn more about it link:jnosql-data-tck-runner/README.adoc[here].


== Getting Help
Expand Down
24 changes: 24 additions & 0 deletions jnosql-data-tck-runner/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
= Jakarta Data TCK Eclipse JNoSQL Implementation
:toc: auto

This project runs the Jakarta Data Technology Compatibility Kit (TCK) on standalone mode with Eclipse JNoSQL. Before running this project it is recommended to read the documentation located in the base link:https://github.com/jakartaee/data/blob/main/tck-dist/src/main/asciidoc/data-tck-reference-guide.adoc[TCK distribution project, _target=_blank].

== Overview

In order to aid in the development of the `data-1.0` feature, this project is configured specifically to allow the feature developers to run the TCK against the Eclipse JNoSQL implementation.

== Running the TCK for Verification

First start up a Mongo DB instance. You can do this by running the following command:

[source,shell]
----
docker run -d -p 27017:27017 --name mongodb mongo
----

Then, run the following command to execute the TCK:

[source,shell]
----
mvn clean test -B -Djakarta.tck.profile=standalone -Djnosql.document.database=jnosql -Djnosql.mongodb.host=localhost:27017
----
41 changes: 41 additions & 0 deletions jnosql-data-tck-runner/logging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#Handlers we plan to use
handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler

#Global logger - By default only log warnings
.level=WARNING

#Jakarta Data TCK logger - By default log everything for ee.jakarta.tck.data
ee.jakarta.tck.data.level=ALL

# Arquillian and JNoSQL - By default log everything, might reduce after development is complete.
org.jbossl=ALL
org.eclipse.jnosql=all

#Formatting for the simple formatter
java.util.logging.SimpleFormatter.class.log=true
java.util.logging.SimpleFormatter.class.full=false
java.util.logging.SimpleFormatter.class.length=10

java.util.logging.SimpleFormatter.level.log=true

java.util.logging.SimpleFormatter.method.log=true
java.util.logging.SimpleFormatter.method.length=30

java.util.logging.SimpleFormatter.thread.log=true
java.util.logging.SimpleFormatter.thread.length=3

java.util.logging.SimpleFormatter.time.log=true
java.util.logging.SimpleFormatter.time.format=[MM/dd/yyyy HH:mm:ss:SSS z]

java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %4$.1s %3$s %5$s %n

# Log warnings to console
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.level=WARNING

# Log everything else to file
java.util.logging.FileHandler.pattern=target/DataTCK%g%u.log
java.util.logging.FileHandler.limit = 500000
java.util.logging.FileHandler.count = 5
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level=CONFIG
170 changes: 170 additions & 0 deletions jnosql-data-tck-runner/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2024 Contributors to the Eclipse Foundation
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the Eclipse Public License v1.0
~ and Apache License v2.0 which accompanies this distribution.
~ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
~ and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
~
~ You may elect to redistribute this code under either of these licenses.
~
~ Contributors:
~
~ Kyle Aure
~ Maximillian Arruda
~
-->
<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.eclipse.jnosql.mapping</groupId>
<artifactId>jnosql-mapping-extensions</artifactId>
<version>1.1.2-SNAPSHOT</version>
</parent>

<artifactId>jnosql-data-tck-runner</artifactId>
<name>Jakarta Data TCK Runner for Eclipse JNoSQL</name>

<repositories>
<!-- For artifacts not yet in Maven Central -->
<repository>
<id>sonatype-nexus-staging</id>
<name>Sonatype Nexus Staging</name>
<url>https://jakarta.oss.sonatype.org/content/repositories/staging/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<properties>
<targetDirectory>${project.basedir}/target</targetDirectory>

<!-- Dependency versions -->
<jakarta.data.tck.version>1.0.0-M4</jakarta.data.tck.version>
<sigtest.version>1.6</sigtest.version>
<arquillian.version>1.7.0.Final</arquillian.version>

<!-- TCK settings -->
<included.groups><![CDATA[standalone & nosql]]></included.groups>
</properties>

<dependencies>
<!-- tck - data - external TCK -->
<dependency>
<groupId>jakarta.data</groupId>
<artifactId>jakarta.data-tck</artifactId>
<version>${jakarta.data.tck.version}</version>
</dependency>
<!-- api - data -->
<dependency>
<groupId>jakarta.data</groupId>
<artifactId>jakarta.data-api</artifactId>
<version>${jakarta.data.api.version}</version>
</dependency>
<!-- impl - data -->
<!-- TODO figure out how to start a MongoDB instance, and configure it -->
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-mongodb</artifactId>
<version>${project.version}</version>
</dependency>
<!-- test frameworks -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.tools</groupId>
<artifactId>sigtest-maven-plugin</artifactId>
<version>${sigtest.version}</version>
</dependency>
<!-- CDI for resource injection -->
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>5.1.0.Final</version>
<scope>test</scope>
</dependency>
<!-- APIs referenced by TCK that do not require implementations for standalone tests -->
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-api</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-core</artifactId>
<version>${arquillian.version}</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jboss.arquillian.container/arquillian-weld-embedded -->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-weld-embedded</artifactId>
<version>4.0.0.Final</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<directory>data-tck-runner/target</directory>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<failIfNoTests>true</failIfNoTests>
<dependenciesToScan>jakarta.data:jakarta.data-tck</dependenciesToScan>
<statelessTestsetReporter
implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
<usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
<usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
</statelessTestsetReporter>
<systemPropertyVariables>
<java.util.logging.config.file>logging.properties</java.util.logging.config.file>
<jimage.dir>${project.build.directory}/jdk17-bundle</jimage.dir>
<signature.sigTestClasspath>
${project.build.directory}/dependency/jakarta.data-api-${jakarta.data.api.version}.jar:${project.build.directory}/jdk11-bundle/java.base:${project.build.directory}/jdk11-bundle/java.rmi:${project.build.directory}/jdk11-bundle/java.sql:${project.build.directory}/jdk11-bundle/java.naming</signature.sigTestClasspath>
<jakarta.tck.skip.deployment>true</jakarta.tck.skip.deployment>
</systemPropertyVariables>
<groups>${included.groups}</groups>
<reportNameSuffix>standalone</reportNameSuffix>
<testSourceDirectory>
${basedir}${file.separarator}src${file.separarator}main${file.separarator}java${file.separarator}</testSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Maximillian Arruda
*/
package ee.jakarta.tck.data.example.extension;

import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.shrinkwrap.api.Archive;

//tag::applicationProcessor[]
public class MyApplicationArchiveProcessor implements ApplicationArchiveProcessor {

//List of test classes that deploy application that you need to customize
// List<String> testClasses;

@Override
public void process(Archive<?> archive, TestClass testClass) {
// if(testClasses.contains(testClass.getClass().getCanonicalName())){
// ((WebArchive) archive).addAsWebInfResource("my-custom-sun-web.xml", "sun-web.xml");
// }
}
}
//end::applicationProcessor[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Maximillian Arruda
*/
package ee.jakarta.tck.data.example.extension;

import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;

//tag::loadableExtension[]
public class MyLoadableExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder extensionBuilder) {
extensionBuilder.service(ApplicationArchiveProcessor.class, MyApplicationArchiveProcessor.class);
}
}
//end::loadableExtension[]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ee.jakarta.tck.data.example.extension.MyLoadableExtension
31 changes: 31 additions & 0 deletions jnosql-data-tck-runner/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~
~ Copyright (c) 2017 Otávio Santana and others
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the Eclipse Public License v1.0
~ and Apache License v2.0 which accompanies this distribution.
~ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
~ and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
~
~ You may elect to redistribute this code under either of these licenses.
~
~ Contributors:
~
~ Maximillian Arruda
~
-->
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

<engine>
<property name="deploymentExportPath">target/</property>
</engine>
<container qualifier="arq-weld" default="true">
<configuration>
<property name="enableConversationScope">true</property>
<property name="environment">SE</property>
</configuration>
</container>
</arquillian>
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,10 @@ public Set<Class<?>> embeddables() {
public Set<Class<?>> repositoriesStandard() {
return Collections.emptySet();
}

@Override
public Set<Class<?>> customRepositories() {
return Collections.emptySet();
}

}