Repository: gora Updated Branches: refs/heads/master df28e1de9 -> 8da648456
MongoDB: Run integration tests of both MongoDB 2.6.x and 3.0.x releases series. Project: http://git-wip-us.apache.org/repos/asf/gora/repo Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/8da64845 Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/8da64845 Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/8da64845 Branch: refs/heads/master Commit: 8da648456c49866a58480a14f1e11aa4a1ac0426 Parents: df28e1d Author: Damien Raude-Morvan <[email protected]> Authored: Wed May 20 18:07:38 2015 +0200 Committer: Damien Raude-Morvan <[email protected]> Committed: Wed May 20 18:07:38 2015 +0200 ---------------------------------------------------------------------- .../gora/mongodb/GoraMongodbTestDriver.java | 21 ++++++++----- .../gora/mongodb/store/TestMongoStore.java | 5 +--- .../gora/mongodb/store/TestMongoStore26.java | 31 ++++++++++++++++++++ .../gora/mongodb/store/TestMongoStore30.java | 31 ++++++++++++++++++++ 4 files changed, 76 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/gora/blob/8da64845/gora-mongodb/src/test/java/org/apache/gora/mongodb/GoraMongodbTestDriver.java ---------------------------------------------------------------------- diff --git a/gora-mongodb/src/test/java/org/apache/gora/mongodb/GoraMongodbTestDriver.java b/gora-mongodb/src/test/java/org/apache/gora/mongodb/GoraMongodbTestDriver.java index 30cb6ed..aba167c 100644 --- a/gora-mongodb/src/test/java/org/apache/gora/mongodb/GoraMongodbTestDriver.java +++ b/gora-mongodb/src/test/java/org/apache/gora/mongodb/GoraMongodbTestDriver.java @@ -15,12 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * Driver to set up an embedded MongoDB database instance for use in our - * unit tests. We use embedded mongodb which is available from - * https://github.com/flapdoodle-oss/embedmongo.flapdoodle.de - */ package org.apache.gora.mongodb; import org.apache.gora.GoraTestDriver; @@ -40,6 +34,11 @@ import de.flapdoodle.embed.mongo.config.Net; import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.process.runtime.Network; +/** + * Driver to set up an embedded MongoDB database instance for use in our + * unit tests. We use embedded mongodb which is available from + * https://github.com/flapdoodle-oss/embedmongo.flapdoodle.de + */ public class GoraMongodbTestDriver extends GoraTestDriver { private static Logger log = LoggerFactory @@ -48,12 +47,18 @@ public class GoraMongodbTestDriver extends GoraTestDriver { private MongodExecutable _mongodExe; private MongodProcess _mongod; private MongoClient _mongo; + private final Version.Main version; /** * Constructor for this class. */ public GoraMongodbTestDriver() { + this(Version.Main.PRODUCTION); + } + + public GoraMongodbTestDriver(Version.Main version) { super(MongoStore.class); + this.version = version; } /** @@ -66,8 +71,8 @@ public class GoraMongodbTestDriver extends GoraTestDriver { int port = Network.getFreeServerPort(); IMongodConfig mongodConfig = new MongodConfigBuilder() - .version(Version.Main.PRODUCTION) - .net(new Net(port, Network.localhostIsIPv6())).build(); + .version(version) + .net(new Net(port, Network.localhostIsIPv6())).build(); // Store Mongo server "host:port" in Hadoop configuration // so that MongoStore will be able to get it latter http://git-wip-us.apache.org/repos/asf/gora/blob/8da64845/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore.java ---------------------------------------------------------------------- diff --git a/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore.java b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore.java index 0f01173..e29d4db 100644 --- a/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore.java +++ b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore.java @@ -34,11 +34,8 @@ import org.junit.Test; import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; -public class TestMongoStore extends DataStoreTestBase { - static { - setTestDriver(new GoraMongodbTestDriver()); - } +public abstract class TestMongoStore extends DataStoreTestBase { @Deprecated @Override http://git-wip-us.apache.org/repos/asf/gora/blob/8da64845/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore26.java ---------------------------------------------------------------------- diff --git a/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore26.java b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore26.java new file mode 100644 index 0000000..2b6f1ee --- /dev/null +++ b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore26.java @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.gora.mongodb.store; + +import de.flapdoodle.embed.mongo.distribution.Version; +import org.apache.gora.mongodb.GoraMongodbTestDriver; + +/** + * Perform {@link TestMongoStore} tests on MongoDB 2.6.x branch. + */ +public class TestMongoStore26 extends TestMongoStore { + + static { + setTestDriver(new GoraMongodbTestDriver(Version.Main.V2_6)); + } +} http://git-wip-us.apache.org/repos/asf/gora/blob/8da64845/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore30.java ---------------------------------------------------------------------- diff --git a/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore30.java b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore30.java new file mode 100644 index 0000000..fc545d5 --- /dev/null +++ b/gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore30.java @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.gora.mongodb.store; + +import de.flapdoodle.embed.mongo.distribution.Version; +import org.apache.gora.mongodb.GoraMongodbTestDriver; + +/** + * Perform {@link TestMongoStore} tests on MongoDB 3.0.x branch. + */ +public class TestMongoStore30 extends TestMongoStore { + + static { + setTestDriver(new GoraMongodbTestDriver(Version.Main.V3_0)); + } +}
