Skip to content

Commit e98542f

Browse files
committed
removed bitnami in drivers
1 parent 6e7b7dd commit e98542f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

jdk_11_gradle/em/embedded/rest/reservations-api/src/main/java/em/embedded/reservationsapi/EmbeddedEvoMasterController.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,17 @@ public static void main(String[] args) {
5858
// https://hub.docker.com/r/bitnami/mongodb
5959
// cannot use standard Mongo image, due ridiculous handling of transaction that requires a cluster...
6060

61-
private static final GenericContainer mongodbContainer = new GenericContainer("bitnami/mongodb:" + MONGODB_VERSION)
62-
.withTmpFs(Collections.singletonMap("/bitnami/mongodb", "rw"))
61+
// private static final GenericContainer mongodbContainer = new GenericContainer("bitnami/mongodb:" + MONGODB_VERSION)
62+
// .withTmpFs(Collections.singletonMap("/bitnami/mongodb", "rw"))
63+
// .withEnv("MONGODB_REPLICA_SET_MODE", "primary")
64+
// .withEnv("ALLOW_EMPTY_PASSWORD", "yes")
65+
// .withExposedPorts(MONGODB_PORT);
66+
67+
private static final GenericContainer mongodbContainer = new GenericContainer("mongo:" + MONGODB_VERSION)
68+
.withTmpFs(Collections.singletonMap("/data/db", "rw"))
6369
.withEnv("MONGODB_REPLICA_SET_MODE", "primary")
6470
.withEnv("ALLOW_EMPTY_PASSWORD", "yes")
71+
.withCommand("--replSet rs0")
6572
.withExposedPorts(MONGODB_PORT);
6673

6774

@@ -88,6 +95,9 @@ public String startSut() {
8895
mongoDbUrl = "mongodb://" + mongodbContainer.getContainerIpAddress() + ":" + mongodbContainer.getMappedPort(MONGODB_PORT) + "/" + MONGODB_DATABASE_NAME;
8996
mongoClient = MongoClients.create(mongoDbUrl);
9097

98+
mongoClient.getDatabase("admin")
99+
.runCommand(new Document("replSetInitiate", new Document()));
100+
91101
/*
92102
This parameter is related to "cs/rest/reservations-api/src/main/java/sk/cyrilgavala/reservationsApi/web/controller/UserRestController.java" class.
93103
In this class, after the password received as input is decoded, a new String is created. While creating this string, the current computer's default Charset is used and may exhibit different behaviors on different computers. To prevent this, we define a charset.

jdk_11_gradle/em/external/rest/reservations-api/src/main/java/em/external/reservationsapi/ExternalEvoMasterController.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,20 @@ public static void main(String[] args) {
7070

7171
private static final String MONGODB_DATABASE_NAME = "reservations-api";
7272

73-
private static final GenericContainer mongodbContainer = new GenericContainer("bitnami/mongodb:" + MONGODB_VERSION)
74-
.withTmpFs(Collections.singletonMap("/bitnami/mongodb", "rw"))
73+
//private static final GenericContainer mongodbContainer = new GenericContainer("bitnami/mongodb:" + MONGODB_VERSION)
74+
// .withTmpFs(Collections.singletonMap("/bitnami/mongodb", "rw"))
75+
// .withEnv("MONGODB_REPLICA_SET_MODE", "primary")
76+
// .withEnv("ALLOW_EMPTY_PASSWORD", "yes")
77+
//.withExposedPorts(MONGODB_PORT);
78+
79+
private static final GenericContainer mongodbContainer = new GenericContainer("mongo:" + MONGODB_VERSION)
80+
.withTmpFs(Collections.singletonMap("/data/db", "rw"))
7581
.withEnv("MONGODB_REPLICA_SET_MODE", "primary")
7682
.withEnv("ALLOW_EMPTY_PASSWORD", "yes")
83+
.withCommand("--replSet rs0")
7784
.withExposedPorts(MONGODB_PORT);
7885

86+
7987
private static final String rawPassword = "bar123";
8088
private static final String hashedPassword = "$2a$10$nEDY5j731yXGnQHyM39PWurJWr1FukegmKYYarK5WOoAMmgDs6D3u";
8189

@@ -156,6 +164,9 @@ public void preStart() {
156164
mongodbContainer.start();
157165
mongoDbUrl = "mongodb://" + mongodbContainer.getContainerIpAddress() + ":" + mongodbContainer.getMappedPort(MONGODB_PORT) + "/" + MONGODB_DATABASE_NAME;
158166
mongoClient = MongoClients.create(mongoDbUrl);
167+
168+
mongoClient.getDatabase("admin")
169+
.runCommand(new Document("replSetInitiate", new Document()));
159170
}
160171

161172
@Override

0 commit comments

Comments
 (0)