Skip to content

Commit

Permalink
feat: Refactor the test container image
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang committed Dec 7, 2023
1 parent 6243d95 commit a4fa928
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@

import me.ahoo.cosid.mongo.reactive.MongoReactiveIdSegmentDistributorFactory;
import me.ahoo.cosid.mongo.reactive.MongoReactiveIdSegmentInitializer;
import me.ahoo.cosid.segment.IdSegmentDistributor;
import me.ahoo.cosid.segment.IdSegmentDistributorFactory;
import me.ahoo.cosid.test.container.MongoLauncher;
import me.ahoo.cosid.test.segment.distributor.GroupedIdSegmentDistributorSpec;
import me.ahoo.cosid.test.segment.distributor.IdSegmentDistributorSpec;

import com.mongodb.reactivestreams.client.MongoClients;
import com.mongodb.reactivestreams.client.MongoDatabase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import me.ahoo.cosid.segment.IdSegmentDistributor;
import me.ahoo.cosid.segment.IdSegmentDistributorFactory;
import me.ahoo.cosid.test.container.MongoLauncher;
import me.ahoo.cosid.test.segment.distributor.IdSegmentDistributorSpec;

import com.mongodb.client.MongoClients;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.hamcrest.MatcherAssert.assertThat;

import me.ahoo.cosid.test.MockIdGenerator;
import me.ahoo.cosid.test.container.MongoLauncher;

import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
import me.ahoo.cosid.machine.ClockBackwardsSynchronizer;
import me.ahoo.cosid.machine.MachineIdDistributor;
import me.ahoo.cosid.machine.MachineStateStorage;
import me.ahoo.cosid.test.container.MongoLauncher;
import me.ahoo.cosid.test.machine.distributor.MachineIdDistributorSpec;

import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
import org.junit.jupiter.api.BeforeEach;

import java.time.Duration;

class MongoMachineIdDistributorTest extends MachineIdDistributorSpec {
MongoDatabase mongoDatabase;
MachineIdDistributor machineIdDistributor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import me.ahoo.cosid.segment.IdSegmentDistributorFactory;
import me.ahoo.cosid.segment.SegmentChainId;
import me.ahoo.cosid.test.MockIdGenerator;
import me.ahoo.cosid.test.container.MongoLauncher;
import me.ahoo.cosid.test.segment.distributor.IdSegmentDistributorSpec;

import com.mongodb.reactivestreams.client.MongoClients;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
import me.ahoo.cosid.machine.MachineStateStorage;
import me.ahoo.cosid.mongo.reactive.MongoReactiveMachineCollection;
import me.ahoo.cosid.mongo.reactive.MongoReactiveMachineInitializer;
import me.ahoo.cosid.test.container.MongoLauncher;
import me.ahoo.cosid.test.machine.distributor.MachineIdDistributorSpec;

import com.mongodb.reactivestreams.client.MongoClients;
import com.mongodb.reactivestreams.client.MongoDatabase;
import org.junit.jupiter.api.BeforeEach;

import java.time.Duration;

class MongoReactiveMachineIdDistributorTest extends MachineIdDistributorSpec {
MongoDatabase mongoDatabase;
MachineIdDistributor machineIdDistributor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import me.ahoo.cosid.mongo.reactive.MongoReactiveMachineCollection;
import me.ahoo.cosid.mongo.reactive.MongoReactiveMachineInitializer;
import me.ahoo.cosid.spring.boot.starter.CosIdAutoConfiguration;
import me.ahoo.cosid.spring.boot.starter.mongo.MongoLauncher;
import me.ahoo.cosid.test.MockIdGenerator;
import me.ahoo.cosid.test.container.MongoLauncher;

import org.assertj.core.api.AssertionsForInterfaceTypes;
import org.junit.jupiter.api.Test;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import me.ahoo.cosid.mongo.MongoIdSegmentInitializer;
import me.ahoo.cosid.mongo.reactive.MongoReactiveIdSegmentDistributorFactory;
import me.ahoo.cosid.mongo.reactive.MongoReactiveIdSegmentInitializer;
import me.ahoo.cosid.spring.boot.starter.mongo.MongoLauncher;
import me.ahoo.cosid.test.container.MongoLauncher;

import org.assertj.core.api.AssertionsForInterfaceTypes;
import org.junit.jupiter.api.Test;
Expand Down
10 changes: 10 additions & 0 deletions cosid-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,18 @@

description = "CosId test specification module"

java {
registerFeature("mongoSupport") {
usingSourceSet(sourceSets[SourceSet.MAIN_SOURCE_SET_NAME])
capability(group.toString(), "mongo-support", version.toString())
}
}

dependencies {
implementation(project(":cosid-core"))
implementation("org.junit.jupiter:junit-jupiter-api")
implementation("org.hamcrest:hamcrest")
"mongoSupportImplementation"("org.testcontainers:testcontainers")
"mongoSupportImplementation"("org.testcontainers:junit-jupiter")
"mongoSupportImplementation"("org.testcontainers:mongodb")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* limitations under the License.
*/

package me.ahoo.cosid.mongo;
package me.ahoo.cosid.test.container;


import org.testcontainers.containers.MongoDBContainer;
Expand Down

0 comments on commit a4fa928

Please sign in to comment.