You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by pi...@apache.org on 2018/08/09 09:13:12 UTC

svn commit: r1837702 - in /manifoldcf/branches/CONNECTORS-1490: CHANGES.txt connectors/mongodb/connector/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITHSQLDB.java connectors/mongodb/pom.xml

Author: piergiorgio
Date: Thu Aug  9 09:13:12 2018
New Revision: 1837702

URL: http://svn.apache.org/viewvc?rev=1837702&view=rev
Log:
- Fixed the integration test: now is totally based on JUnit with the Embedded MongoDB library (CONNECTORS-1490)
- Removed the Docker configuration 
- Updated the CHANGES.txt with the attribution of this contribution by Irindu Nugawela

Modified:
    manifoldcf/branches/CONNECTORS-1490/CHANGES.txt
    manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/connector/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITHSQLDB.java
    manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml

Modified: manifoldcf/branches/CONNECTORS-1490/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/CHANGES.txt?rev=1837702&r1=1837701&r2=1837702&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1490/CHANGES.txt (original)
+++ manifoldcf/branches/CONNECTORS-1490/CHANGES.txt Thu Aug  9 09:13:12 2018
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 2.11-dev =====================
 
+CONNECTORS-1490: GSOC MongoDB Output Connector
+(Irindu Nugawela, Piergiorgio Lucidi)
+
 CONNECTORS-1517: Documentum mimetypes form didn't allow for no restrictions
 (James Thomas, Karl Wright)
 

Modified: manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/connector/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITHSQLDB.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/connector/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITHSQLDB.java?rev=1837702&r1=1837701&r2=1837702&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/connector/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITHSQLDB.java (original)
+++ manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/connector/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITHSQLDB.java Thu Aug  9 09:13:12 2018
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: BaseITHSQLDB.java 1800083 2017-06-27 19:55:21Z piergiorgio $ */
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,6 +21,17 @@ package org.apache.manifoldcf.agents.out
 import org.junit.After;
 import org.junit.Before;
 
+import com.mongodb.Mongo;
+
+import de.flapdoodle.embed.mongo.MongodExecutable;
+import de.flapdoodle.embed.mongo.MongodProcess;
+import de.flapdoodle.embed.mongo.MongodStarter;
+import de.flapdoodle.embed.mongo.config.IMongodConfig;
+import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
+import de.flapdoodle.embed.mongo.config.Net;
+import de.flapdoodle.embed.mongo.distribution.Version;
+import de.flapdoodle.embed.process.runtime.Network;
+
 /**
  * Base integration tests class for MongoDB tested against a CMIS repository
  *
@@ -28,37 +39,49 @@ import org.junit.Before;
  */
 public class BaseITHSQLDB extends org.apache.manifoldcf.crawler.tests.BaseITHSQLDB {
 
-    protected String[] getConnectorNames() {
-        return new String[]{"CMIS"};
-    }
-
-    protected String[] getConnectorClasses() {
-        return new String[]{"org.apache.manifoldcf.crawler.tests.TestingRepositoryConnector"};
-    }
-
-    protected String[] getOutputNames() {
-        return new String[]{"MongoDB"};
-    }
-
-    protected String[] getOutputClasses() {
-        return new String[]{"org.apache.manifoldcf.agents.output.mongodboutput.MongodbOutputConnector"};
-    }
-
-    // Setup/teardown
-
-    @Before
-    public void setUpMongoDB()
-            throws Exception {
-
-        //start mongod here
-        //we use maven docker plugin for this so no need to implement
-    }
-
-    @After
-    public void cleanUpMongoDB()
-            throws Exception {
-        //stop mongod here
-        //we use maven docker plugin for this so no need to implement
-    }
+	private MongodExecutable mongodExecutable;
+	private MongodProcess mongod;
+	private Mongo mongo;
+
+	protected String[] getConnectorNames() {
+		return new String[] { "CMIS" };
+	}
+
+	protected String[] getConnectorClasses() {
+		return new String[] { "org.apache.manifoldcf.crawler.tests.TestingRepositoryConnector" };
+	}
+
+	protected String[] getOutputNames() {
+		return new String[] { "MongoDB" };
+	}
+
+	protected String[] getOutputClasses() {
+		return new String[] { "org.apache.manifoldcf.agents.output.mongodboutput.MongodbOutputConnector" };
+	}
+
+	// Setup/teardown
+
+	@Before
+	public void setUpMongoDB() throws Exception {
+
+		// start mongod here
+		MongodStarter starter = MongodStarter.getDefaultInstance();
+		String bindIp = "localhost";
+		int port = 27017;
+		IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.V2_6_8)
+		    .net(new Net(bindIp, port, Network.localhostIsIPv6())).build();
+
+		mongodExecutable = starter.prepare(mongodConfig);
+		mongod = mongodExecutable.start();
+		
+	}
+
+	@After
+	public void cleanUpMongoDB() throws Exception {
+		// stop mongod here
+		if (mongodExecutable != null) {
+			mongodExecutable.stop();
+		}
+	}
 
 }

Modified: manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml?rev=1837702&r1=1837701&r2=1837702&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml (original)
+++ manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml Thu Aug  9 09:13:12 2018
@@ -25,9 +25,9 @@
         </developer>
         <developer>
             <name>Piergiorgio Lucidi</name>
-            <organization>Sourcesense</organization>
-            <organizationUrl>http://www.sourcesense.com</organizationUrl>
-            <url>http://www.open4dev.com</url>
+            <organization>TAI Solutions</organization>
+            <organizationUrl>https://www.taisolutions.com/</organizationUrl>
+            <url>https://www.open4dev.com</url>
         </developer>
     </developers>
 
@@ -75,6 +75,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+				  <groupId>de.flapdoodle.embed</groupId>
+				  <artifactId>de.flapdoodle.embed.mongo</artifactId>
+				  <version>2.1.2-SNAPSHOT</version>
+				  <scope>test</scope>
+				</dependency>
+        <dependency>
             <groupId>io.fabric8</groupId>
             <artifactId>docker-maven-plugin</artifactId>
             <version>${docker.maven.plugin.version}</version>
@@ -367,57 +373,17 @@
                     </execution>
                 </executions>
             </plugin>
-
-            <plugin>
-                <groupId>io.fabric8</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-                <version>0.26.0</version>
-                <configuration>
-                    <showLogs>true</showLogs>
-
-                    <images>
-                        <image>
-                            <!--<name>mongo:3.4.6</name>-->
-                            <name>mongo:2.6.9</name>
-                            <alias>mongo</alias>
-                            <run>
-                                <ports>
-                                    <port>${mongodb.port}:27017</port>
-                                </ports>
-                                <env>
-                                    <MONGO_INITDB_ROOT_USERNAME>${mongodb.username}</MONGO_INITDB_ROOT_USERNAME>
-                                    <MONGO_INITDB_ROOT_PASSWORD>${mongodb.password}</MONGO_INITDB_ROOT_PASSWORD>
-                                </env>
-                                <wait>
-                                    <log>waiting for connections on port</log>
-                                    <url>http://localhost:${mongodb.port}</url>
-                                    <time>60000</time>
-                                </wait>
-                            </run>
-                        </image>
-                    </images>
-                </configuration>
-
-                <executions>
-                    <execution>
-                        <id>prepare-containers</id>
-                        <phase>pre-integration-test</phase>
-                        <goals>
-                            <goal>start</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>remove-containers</id>
-                        <phase>post-integration-test</phase>
-                        <goals>
-                            <goal>stop</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
+            
         </plugins>
 
     </build>
 
+    <repositories>
+      <repository>
+      <id>sonatype-repo</id>
+      <name>Sonatype Repo</name>
+      <url>http://oss.sonatype.org/content/repositories/snapshots</url>
+    </repository>
+    </repositories>
+
 </project>
\ No newline at end of file