|
| 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 | +} |
0 commit comments