Skip to content

Commit 4a782ee

Browse files
authored
Merge pull request #34085 from mswatosh/nosql-upgrade
Adding jNoSQL data integration tests
2 parents 487b21d + f9f4976 commit 4a782ee

File tree

16 files changed

+497
-3
lines changed

16 files changed

+497
-3
lines changed

dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,6 +3066,11 @@
30663066
<artifactId>jnosql-communication-semistructured</artifactId>
30673067
<version>1.1.12</version>
30683068
</dependency>
3069+
<dependency>
3070+
<groupId>org.eclipse.jnosql.mapping</groupId>
3071+
<artifactId>jnosql-mapping-document</artifactId>
3072+
<version>1.1.12</version>
3073+
</dependency>
30693074
<dependency>
30703075
<groupId>org.eclipse.jnosql.mapping</groupId>
30713076
<artifactId>jnosql-mapping-semistructured</artifactId>

dev/cnf/oss_dependencies.maven

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ org.eclipse.jetty:jetty-util:9.4.39.v20210325
609609
org.eclipse.jetty:jetty-util:9.4.7.RC0
610610
org.eclipse.jetty:jetty-websocket:8.2.0.v20160908
611611
org.eclipse.jnosql.communication:jnosql-communication-semistructured:1.1.12
612+
org.eclipse.jnosql.mapping:jnosql-mapping-document:1.1.12
612613
org.eclipse.jnosql.mapping:jnosql-mapping-semistructured:1.1.12
613614
org.eclipse.microprofile.config:microprofile-config-api:1.1
614615
org.eclipse.microprofile.config:microprofile-config-api:1.2.1

dev/io.openliberty.data.internal_fat_nosql/.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<classpathentry kind="src" path="fat/src"/>
44
<classpathentry kind="src" path="generated-src"/>
55
<classpathentry kind="src" path="test-applications/DataNoSQLApp/src"/>
6+
<classpathentry kind="src" path="test-applications/DataNoSQLIntegrationApp/src"/>
67
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
78
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
89
<attributes>

dev/io.openliberty.data.internal_fat_nosql/bnd.bnd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ bVersion=1.0
1515

1616
src: \
1717
fat/src,\
18-
test-applications/DataNoSQLApp/src
18+
test-applications/DataNoSQLApp/src,\
19+
test-applications/DataNoSQLIntegrationApp/src
1920

2021
javac.source: 17
2122
javac.target: 17
@@ -32,9 +33,11 @@ fat.test.container.images: public.ecr.aws/docker/library/mongo:8.0
3233
io.openliberty.jakarta.data.1.0,\
3334
io.openliberty.jakarta.interceptor.2.1,\
3435
io.openliberty.jakarta.nosql.1.0,\
36+
io.openliberty.jakarta.persistence.3.1,\
3537
io.openliberty.jakarta.servlet.6.0,\
3638
io.openliberty.jakarta.transaction.2.0,\
3739
io.openliberty.org.eclipse.microprofile.config.3.0,\
3840
io.openliberty.org.testcontainers;version=latest,\
3941
org.eclipse.jnosql.communication:jnosql-communication-semistructured;version=1.1.12,\
40-
org.eclipse.jnosql.mapping:jnosql-mapping-semistructured;version=1.1.12
42+
org.eclipse.jnosql.mapping:jnosql-mapping-semistructured;version=1.1.12,\
43+
org.eclipse.jnosql.mapping:jnosql-mapping-document;version=1.1.12

dev/io.openliberty.data.internal_fat_nosql/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ task addJNoSQL(type: Copy) {
5151

5252
addRequiredLibraries {
5353
dependsOn addJNoSQL
54+
dependsOn addDerbyJava17Plus
5455
dependsOn copyTestContainers
5556
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 IBM Corporation and others.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License 2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* IBM Corporation - initial API and implementation
12+
*******************************************************************************/
13+
package test.jakarta.data.nosql;
14+
15+
import org.jboss.shrinkwrap.api.spec.WebArchive;
16+
import org.junit.AfterClass;
17+
import org.junit.BeforeClass;
18+
import org.junit.runner.RunWith;
19+
import org.testcontainers.containers.MongoDBContainer;
20+
21+
import com.ibm.websphere.simplicity.ShrinkHelper;
22+
23+
import componenttest.annotation.MinimumJavaLevel;
24+
import componenttest.annotation.Server;
25+
import componenttest.annotation.TestServlet;
26+
import componenttest.custom.junit.runner.FATRunner;
27+
import componenttest.topology.impl.LibertyServer;
28+
import componenttest.topology.utils.FATServletClient;
29+
import test.jakarta.data.nosql.integration.web.DataNoSQLIntegrationServlet;
30+
31+
@RunWith(FATRunner.class)
32+
@MinimumJavaLevel(javaLevel = 17)
33+
public class DataNoSQLIntegrationTest extends FATServletClient {
34+
35+
public static MongoDBContainer mongoDBContainer = FATSuite.mongoDBContainer;
36+
37+
@Server("io.openliberty.data.internal.fat.nosql.integrate")
38+
@TestServlet(servlet = DataNoSQLIntegrationServlet.class, contextRoot = "DataNoSQLIntegrationApp")
39+
public static LibertyServer server;
40+
41+
@BeforeClass
42+
public static void setUp() throws Exception {
43+
WebArchive war = ShrinkHelper.buildDefaultApp("DataNoSQLIntegrationApp", "test.jakarta.data.nosql.integration.web");
44+
ShrinkHelper.exportAppToServer(server, war);
45+
46+
server.addEnvVar("MONGO_DBNAME", "testdb");
47+
server.addEnvVar("MONGO_HOST", mongoDBContainer.getHost() + ":" + String.valueOf(mongoDBContainer.getMappedPort(27017)));
48+
server.addEnvVar("JNOSQL_VERSION", FATSuite.JNOSQL_VERSION);
49+
50+
server.startServer();
51+
}
52+
53+
@AfterClass
54+
public static void tearDown() throws Exception {
55+
server.stopServer();
56+
}
57+
}

dev/io.openliberty.data.internal_fat_nosql/fat/src/test/jakarta/data/nosql/FATSuite.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
@SuiteClasses({
2929
AlwaysPassesTest.class,
3030
DataContainerNoSQLTest.class,
31-
DataNoSQLTest.class
31+
DataNoSQLTest.class,
32+
DataNoSQLIntegrationTest.class
3233
})
3334
public class FATSuite extends TestContainerSuite {
3435

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2023 Otávio Santana and others
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*
11+
* Contributors:
12+
*
13+
* Otavio Santana
14+
*/
15+
package test.jakarta.data.nosql.integration.web;
16+
17+
import jakarta.data.metamodel.StaticMetamodel;
18+
import javax.annotation.processing.Generated;
19+
import org.eclipse.jnosql.mapping.semistructured.metamodel.attributes.NoSQLAttribute;
20+
import org.eclipse.jnosql.mapping.semistructured.metamodel.attributes.StringAttribute;
21+
import org.eclipse.jnosql.mapping.semistructured.metamodel.attributes.CriteriaAttribute;
22+
//CHECKSTYLE:OFF
23+
@StaticMetamodel(County.class)
24+
@Generated(value = "The StaticMetamodel of the class County provider by Eclipse JNoSQL", date = "2026-01-05T12:00:00.000000")
25+
public interface _County {
26+
27+
String NAME = "_id";
28+
String POPULATION = "population";
29+
String ZIPCODES = "zipcodes";
30+
String COUNTYSEAT = "countySeat";
31+
32+
StringAttribute<County> name = new NoSQLAttribute<>(NAME);
33+
CriteriaAttribute<County> population = new NoSQLAttribute<>(POPULATION);
34+
CriteriaAttribute<County> zipcodes = new NoSQLAttribute<>(ZIPCODES);
35+
StringAttribute<County> countySeat = new NoSQLAttribute<>(COUNTYSEAT);
36+
37+
}
38+
//CHECKSTYLE:ON
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
###############################################################################
2+
# Copyright (c) 2026 IBM Corporation and others.
3+
# All rights reserved. This program and the accompanying materials
4+
# are made available under the terms of the Eclipse Public License 2.0
5+
# which accompanies this distribution, and is available at
6+
# http://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
# Contributors:
11+
# IBM Corporation - initial API and implementation
12+
###############################################################################
13+
bootstrap.include=../testports.properties
14+
com.ibm.ws.logging.trace.specification=*=info:data=all
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!--
2+
Copyright (c) 2026 IBM Corporation and others.
3+
All rights reserved. This program and the accompanying materials
4+
are made available under the terms of the Eclipse Public License 2.0
5+
which accompanies this distribution, and is available at
6+
http://www.eclipse.org/legal/epl-2.0/
7+
8+
SPDX-License-Identifier: EPL-2.0
9+
10+
Contributors:
11+
IBM Corporation - initial API and implementation
12+
-->
13+
<server>
14+
15+
<featureManager>
16+
<!-- Uses persistence to confirm Liberty's Data implementation is used in the integration tests -->
17+
<feature>componenttest-2.0</feature>
18+
<feature>data-1.0</feature>
19+
<feature>persistence-3.2</feature>
20+
<feature>nosql-1.0</feature>
21+
<feature>servlet-6.1</feature>
22+
<feature>mpConfig-3.1</feature>
23+
<feature>jsonb-3.0</feature>
24+
</featureManager>
25+
26+
<include location="../fatTestPorts.xml"/>
27+
28+
29+
<application location="DataNoSQLIntegrationApp.war">
30+
<classloader commonLibraryRef="jnosql, JDBCLibrary" />
31+
</application>
32+
33+
<dataSource id="LibertyDataSource" jndiName="jdbc/LibertyDataSource">
34+
<jdbcDriver libraryRef="JDBCLibrary"/>
35+
<properties.derby.embedded createDatabase="create" databaseName="memory:libertydb" user="dbuser1" password="dbpwd1"/>
36+
</dataSource>
37+
38+
<library id="jnosql">
39+
<fileset dir="${shared.resource.dir}/jnosql-${JNOSQL_VERSION}" includes="*.jar" />
40+
</library>
41+
42+
<library id="JDBCLibrary">
43+
<fileset dir="${shared.resource.dir}/derbyJava17Plus" includes="*.jar"/>
44+
</library>
45+
46+
<variable name="jnosql.document.database" value="${MONGO_DBNAME}"/>
47+
<variable name="jnosql.mongodb.host" value="${MONGO_HOST}"/>
48+
49+
</server>

0 commit comments

Comments
 (0)