-
Notifications
You must be signed in to change notification settings - Fork 20
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
a6dceb6
commit 1b83d0b
Showing
14 changed files
with
94 additions
and
26 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
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
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
9 changes: 5 additions & 4 deletions
9
...cc/platform/PlatformApplicationTests.java → ...rationtests/PlatformApplicationTests.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 |
---|---|---|
@@ -1,19 +1,20 @@ | ||
package com.wcc.platform; | ||
package com.wcc.platform.integrationtests; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||
import org.springframework.context.ApplicationContext; | ||
|
||
@SpringBootTest | ||
class PlatformApplicationTests { | ||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||
class PlatformApplicationTests extends SurrealDbIntegrationTest { | ||
|
||
@Autowired private ApplicationContext context; | ||
|
||
@Test | ||
void contextLoads() { | ||
assertNotNull(context, "The application context should have loaded."); | ||
assertNotNull(context, "The application context should have loaded"); | ||
} | ||
} |
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
54 changes: 54 additions & 0 deletions
54
src/test/java/com/wcc/platform/integrationtests/SurrealDbIntegrationTest.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,54 @@ | ||
package com.wcc.platform.integrationtests; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.springframework.test.context.DynamicPropertySource; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
@Testcontainers | ||
class SurrealDbIntegrationTest { | ||
|
||
private static final GenericContainer<?> surrealDbContainer = | ||
new GenericContainer<>(DockerImageName.parse("surrealdb/surrealdb:latest")) | ||
.withExposedPorts(8000) | ||
.withCommand("start --user root --pass root"); | ||
|
||
@DynamicPropertySource | ||
static void registerSurrealDbProperties(DynamicPropertyRegistry registry) { | ||
surrealDbContainer.start(); | ||
String host = surrealDbContainer.getHost(); | ||
Integer port = surrealDbContainer.getMappedPort(8000); | ||
registry.add("surrealdb.host", () -> host); | ||
registry.add("surrealdb.port", port::toString); | ||
registry.add("surrealdb.username", () -> "root"); | ||
registry.add("surrealdb.password", () -> "root"); | ||
registry.add("surrealdb.namespace", () -> "test_namespace"); | ||
registry.add("surrealdb.database", () -> "test_db"); | ||
} | ||
|
||
@BeforeAll | ||
static void setUp() { | ||
surrealDbContainer.start(); | ||
} | ||
|
||
@AfterAll | ||
static void tearDown() { | ||
surrealDbContainer.stop(); | ||
} | ||
|
||
@Test | ||
@DisplayName("Should create and retrieve a ResourceContent entity") | ||
void testSurrealDbConnection() { | ||
assertTrue(surrealDbContainer.isCreated()); | ||
assertTrue(surrealDbContainer.isRunning()); | ||
} | ||
} |
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