This is an automated email from the ASF dual-hosted git repository.

pujav65 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-rya.git

commit 8fa6a397a1ad6a3d0bea4621f96f3d071d4ba2e5
Author: eric.white <[email protected]>
AuthorDate: Mon May 6 16:14:46 2019 -0400

    Fixed tests from deleting Mongo admin database
---
 test/mongo/pom.xml                                 |  6 +---
 .../org/apache/rya/test/mongo/MongoITBase.java     |  5 +--
 .../java/org/apache/rya/test/mongo/MongoUtils.java | 36 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 7 deletions(-)

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 @@ under the License.
             <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 @@ under the License.
             <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 @@ import com.mongodb.MongoClient;
  * JUnit framework.
  */
 public class MongoITBase {
-
     private MongoClient mongoClient = null;
 
     @Before
@@ -38,7 +37,9 @@ public class MongoITBase {
 
         // 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

Reply via email to