Fixed tests from deleting Mongo admin database
diff --git a/test/mongo/pom.xml b/test/mongo/pom.xml
index bfd6318..bea5470 100644
--- a/test/mongo/pom.xml
+++ b/test/mongo/pom.xml
@@ -41,10 +41,6 @@
<artifactId>findbugs-annotations</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-core</artifactId>
- </dependency>
- <dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</dependency>
@@ -52,7 +48,7 @@
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
</dependency>
-
+
<!-- Testing dependencies. -->
<dependency>
<groupId>junit</groupId>
diff --git a/test/mongo/src/main/java/org/apache/rya/test/mongo/MongoITBase.java b/test/mongo/src/main/java/org/apache/rya/test/mongo/MongoITBase.java
index dbf43e9..ffe4cdc 100644
--- a/test/mongo/src/main/java/org/apache/rya/test/mongo/MongoITBase.java
+++ b/test/mongo/src/main/java/org/apache/rya/test/mongo/MongoITBase.java
@@ -29,7 +29,6 @@
* JUnit framework.
*/
public class MongoITBase {
-
private MongoClient mongoClient = null;
@Before
@@ -38,7 +37,9 @@
// Remove any DBs that were created by previous tests.
for(final String dbName : mongoClient.listDatabaseNames()) {
- mongoClient.dropDatabase(dbName);
+ if (!MongoUtils.ADMIN_DATABASE_NAME.equals(dbName)) {
+ mongoClient.dropDatabase(dbName);
+ }
}
// Let subclasses do more setup.
diff --git a/test/mongo/src/main/java/org/apache/rya/test/mongo/MongoUtils.java b/test/mongo/src/main/java/org/apache/rya/test/mongo/MongoUtils.java
new file mode 100644
index 0000000..3fa1d6c
--- /dev/null
+++ b/test/mongo/src/main/java/org/apache/rya/test/mongo/MongoUtils.java
@@ -0,0 +1,36 @@
+/*
+ * 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.rya.test.mongo;
+
+/**
+ * Utility methods and constants for MongoDB.
+ */
+public final class MongoUtils {
+ /**
+ * Default "authSource" value for the admin database in the mongo URI
+ * connection string.
+ */
+ public static final String ADMIN_DATABASE_NAME = "admin";
+
+ /**
+ * Private constructor to prevent instantiation.
+ */
+ private MongoUtils() {
+ }
+}
\ No newline at end of file