[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-11-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15626036#comment-15626036
 ] 

ASF GitHub Bot commented on RYA-174:


Github user asfgit closed the pull request at:

https://github.com/apache/incubator-rya/pull/118


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602692#comment-15602692
 ] 

ASF GitHub Bot commented on RYA-174:


Github user pujav65 commented on the issue:

https://github.com/apache/incubator-rya/pull/118
  
i thought the mongo connections factory was a bad idea at the time.  so i 
think removing it is a good thing in general.  The instance driver you're 
referring to is in the merge tool -- its not used in the main client path.  The 
accumulo dao has a setConnector() method which really should have been emulated 
by the Mongo dao.   I didn't realize the pattern until we started having issues 
with setting up multiple connections, but the passing in the connector/client 
pattern is nice because its a lot more flexible than what we currently have.  
Regardless, I think this pull request is fine -- all of this discussion is on 
future direction.  


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602685#comment-15602685
 ] 

ASF GitHub Bot commented on RYA-174:


Github user amihalik commented on the issue:

https://github.com/apache/incubator-rya/pull/118
  
It seems like everyone is on board with this PR... I'm going to let Jenkins 
chomp on it for a bit and (unless I hear otherwise) pull this into master after 
the build.


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602660#comment-15602660
 ] 

ASF GitHub Bot commented on RYA-174:


Github user amihalik commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/118#discussion_r84739883
  
--- Diff: extras/indexingExample/src/main/java/MongoRyaDirectExample.java 
---
@@ -255,19 +265,29 @@ private static void 
testAddAndFreeTextSearchWithPCJ(SailRepositoryConnection con
 Validate.isTrue(tupleHandler.getCount() == 2);
 }
 
-private static Configuration getConf() {
+private static MockMongoFactory mock = null;
+private static Configuration getConf() throws IOException {
 
 MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration();
 conf.set(ConfigUtils.USE_MONGO, "true");
 
-// User name and password must be filled in:
-conf.set(MongoDBRdfConfiguration.MONGO_USER, "fill this in");
-conf.set(MongoDBRdfConfiguration.MONGO_USER_PASSWORD, "fill this 
in");
-conf.set(MongoDBRdfConfiguration.USE_TEST_MONGO, 
Boolean.toString(USE_MOCK));
-if (!USE_MOCK){
+if (USE_MOCK) {
+mock = MockMongoFactory.newFactory();
+MongoClient c = mock.newMongo();
+ServerAddress address = c.getAddress();
+String url = address.getHost();
+String port = Integer.toString(address.getPort());
+c.close();
+//conf.set(MongoDBRdfConfiguration.MONGO_USER, "fill this in");
--- End diff --

Done.


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602657#comment-15602657
 ] 

ASF GitHub Bot commented on RYA-174:


Github user amihalik commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/118#discussion_r84739864
  
--- Diff: 
dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MockMongoFactory.java ---
@@ -0,0 +1,97 @@
+/*
+ * 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.mongodb;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.UnknownHostException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.mongodb.MongoClient;
+import com.mongodb.MongoException;
+import com.mongodb.ServerAddress;
+
+import de.flapdoodle.embed.mongo.Command;
+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.config.RuntimeConfigBuilder;
+import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion;
+import de.flapdoodle.embed.mongo.distribution.Version;
+
+public class MockMongoFactory {
+private static Logger logger = 
LoggerFactory.getLogger(MockMongoFactory.class.getName());
+
+public static MockMongoFactory newFactory() throws IOException {
+return MockMongoFactory.with(Version.Main.PRODUCTION);
+}
+
+public static MockMongoFactory with(final IFeatureAwareVersion 
version) throws IOException {
+return new MockMongoFactory(version);
+}
+
+private final MongodExecutable mongodExecutable;
+private final MongodProcess mongodProcess;
+
+/**
+ * Create the testing utility using the specified version of MongoDB.
+ * 
+ * @param version
+ *version of MongoDB.
+ */
+private MockMongoFactory(final IFeatureAwareVersion version) throws 
IOException {
+final MongodStarter runtime = MongodStarter.getInstance(new 
RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger).build());
+mongodExecutable = runtime.prepare(newMongodConfig(version));
+mongodProcess = mongodExecutable.start();
+}
+
+private IMongodConfig newMongodConfig(final IFeatureAwareVersion 
version) throws UnknownHostException, IOException {
+Net net = new Net(findRandomOpenPortOnAllLocalInterfaces(), false);
+return new MongodConfigBuilder().version(version).net(net).build();
+}
+
+private int findRandomOpenPortOnAllLocalInterfaces() throws 
IOException {
+try (ServerSocket socket = new ServerSocket(0);) {
+return socket.getLocalPort();
+}
+}
+
+/**
+ * Creates a new Mongo connection.
+ * 
+ * @throws MongoException
+ * @throws UnknownHostException
+ */
+public MongoClient newMongo() throws UnknownHostException, 
MongoException {
--- End diff --

Done.


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> 

[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602581#comment-15602581
 ] 

ASF GitHub Bot commented on RYA-174:


Github user isper3at commented on the issue:

https://github.com/apache/incubator-rya/pull/118
  
what do you mean by 'removes that which is good'?  The connections factory 
is a placeholder until we can get rid of the dependency on having the hadoop 
configuration everywhere (i put it in the docs the first time it went in).  
Accumulo has had a factory style object for a while now, the 
AccumuloInstanceDriver is essentially a factory


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602563#comment-15602563
 ] 

ASF GitHub Bot commented on RYA-174:


Github user pujav65 commented on the issue:

https://github.com/apache/incubator-rya/pull/118
  
hey i see where this was coming from, but i think we should try to move to 
the mongo client being passed in.  I'd like to see this look a lot closer to 
what was done in Accumulo (more because the Accumulo implementation is in line 
with what the intended contracts of the RyaDAO/etc. are).   We started moving 
away from that when we started having a connections factory -- I think this 
pull request removes that which is good, but I agree with Aaron that we should 
move to have the connector/client be passed in to everything that needs it 
rather than passing in the connection information.


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15596236#comment-15596236
 ] 

ASF GitHub Bot commented on RYA-174:


Github user isper3at commented on the issue:

https://github.com/apache/incubator-rya/pull/118
  
I disagree with the notion of matching accumulo naming conventions. I'm 
fine with ambiguous naming in interfaces and during design, but altering naming 
to match another datastore just seems.wrong?  If we want consistency, lets 
use what flapdoodle calls it.  Then we already have the correct naming if we 
need to google something. 


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15596024#comment-15596024
 ] 

ASF GitHub Bot commented on RYA-174:


Github user isper3at commented on the issue:

https://github.com/apache/incubator-rya/pull/118
  
done!


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15596022#comment-15596022
 ] 

ASF GitHub Bot commented on RYA-174:


Github user isper3at commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/118#discussion_r84527483
  
--- Diff: extras/indexingExample/src/main/java/MongoRyaDirectExample.java 
---
@@ -255,19 +265,29 @@ private static void 
testAddAndFreeTextSearchWithPCJ(SailRepositoryConnection con
 Validate.isTrue(tupleHandler.getCount() == 2);
 }
 
-private static Configuration getConf() {
+private static MockMongoFactory mock = null;
+private static Configuration getConf() throws IOException {
 
 MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration();
 conf.set(ConfigUtils.USE_MONGO, "true");
 
-// User name and password must be filled in:
-conf.set(MongoDBRdfConfiguration.MONGO_USER, "fill this in");
-conf.set(MongoDBRdfConfiguration.MONGO_USER_PASSWORD, "fill this 
in");
-conf.set(MongoDBRdfConfiguration.USE_TEST_MONGO, 
Boolean.toString(USE_MOCK));
-if (!USE_MOCK){
+if (USE_MOCK) {
+mock = MockMongoFactory.newFactory();
+MongoClient c = mock.newMongo();
+ServerAddress address = c.getAddress();
+String url = address.getHost();
+String port = Integer.toString(address.getPort());
+c.close();
+//conf.set(MongoDBRdfConfiguration.MONGO_USER, "fill this in");
--- End diff --

remove commented out code?


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15596005#comment-15596005
 ] 

ASF GitHub Bot commented on RYA-174:


Github user isper3at commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/118#discussion_r84526738
  
--- Diff: 
dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MockMongoFactory.java ---
@@ -0,0 +1,97 @@
+/*
+ * 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.mongodb;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.UnknownHostException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.mongodb.MongoClient;
+import com.mongodb.MongoException;
+import com.mongodb.ServerAddress;
+
+import de.flapdoodle.embed.mongo.Command;
+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.config.RuntimeConfigBuilder;
+import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion;
+import de.flapdoodle.embed.mongo.distribution.Version;
+
+public class MockMongoFactory {
+private static Logger logger = 
LoggerFactory.getLogger(MockMongoFactory.class.getName());
+
+public static MockMongoFactory newFactory() throws IOException {
+return MockMongoFactory.with(Version.Main.PRODUCTION);
+}
+
+public static MockMongoFactory with(final IFeatureAwareVersion 
version) throws IOException {
+return new MockMongoFactory(version);
+}
+
+private final MongodExecutable mongodExecutable;
+private final MongodProcess mongodProcess;
+
+/**
+ * Create the testing utility using the specified version of MongoDB.
+ * 
+ * @param version
+ *version of MongoDB.
+ */
+private MockMongoFactory(final IFeatureAwareVersion version) throws 
IOException {
+final MongodStarter runtime = MongodStarter.getInstance(new 
RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger).build());
+mongodExecutable = runtime.prepare(newMongodConfig(version));
+mongodProcess = mongodExecutable.start();
+}
+
+private IMongodConfig newMongodConfig(final IFeatureAwareVersion 
version) throws UnknownHostException, IOException {
+Net net = new Net(findRandomOpenPortOnAllLocalInterfaces(), false);
+return new MongodConfigBuilder().version(version).net(net).build();
+}
+
+private int findRandomOpenPortOnAllLocalInterfaces() throws 
IOException {
+try (ServerSocket socket = new ServerSocket(0);) {
+return socket.getLocalPort();
+}
+}
+
+/**
+ * Creates a new Mongo connection.
+ * 
+ * @throws MongoException
+ * @throws UnknownHostException
+ */
+public MongoClient newMongo() throws UnknownHostException, 
MongoException {
--- End diff --

can you rename this to newMongoClient(), there is an object in the mongo 
api called Mongo that's different from the client


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> 

[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15595847#comment-15595847
 ] 

ASF GitHub Bot commented on RYA-174:


Github user amihalik commented on the issue:

https://github.com/apache/incubator-rya/pull/118
  
@isper3at Can you look at this as well?  


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15593855#comment-15593855
 ] 

ASF GitHub Bot commented on RYA-174:


GitHub user amihalik opened a pull request:

https://github.com/apache/incubator-rya/pull/118

RYA-174 Removing Mongo Test Factory from non-test code

>What Changed?

Removed Mongo Test Factory code from non-test code

### Tests

no new tests

### Links
[Jira](https://issues.apache.org/jira/browse/RYA-174)

### Checklist
- [ ] Code Review
- [ ] Squash Commits

 People To Reivew

@dlotts



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/amihalik/incubator-rya RYA-174-2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-rya/pull/118.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #118


commit ef9a461e2b582ea869e68f9eeb8b840842038383
Author: Aaron Mihalik 
Date:   2016-10-21T03:23:59Z

RYA-174 Removing Mongo Test Factory from non-test code




> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
> Fix For: 3.2.10
>
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15593143#comment-15593143
 ] 

ASF GitHub Bot commented on RYA-174:


Github user asfgit closed the pull request at:

https://github.com/apache/incubator-rya/pull/117


> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (RYA-174) Embedded Mongo tries to bind to busy ports

2016-10-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/RYA-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15590241#comment-15590241
 ] 

ASF GitHub Bot commented on RYA-174:


GitHub user amihalik opened a pull request:

https://github.com/apache/incubator-rya/pull/117

RYA-174 Adding Mongo Cleanup in Test

## Description

Modified tests with embedded mongo.  Embedded mongo now cleans  up after 
itself.

### Tests

no new tests

### Links
[Jira](https://issues.apache.org/jira/browse/RYA-174)

### Checklist
- [ ] Code Review
- [ ] Squash Commits

 People To Review



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/amihalik/incubator-rya RYA-174

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-rya/pull/117.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #117


commit 10d63321bfec6486b46845e61a1f8608353b80d0
Author: Aaron Mihalik 
Date:   2016-10-19T23:34:04Z

RYA-174 Adding Mongo Cleanup in Test




> Embedded Mongo tries to bind to busy ports
> --
>
> Key: RYA-174
> URL: https://issues.apache.org/jira/browse/RYA-174
> Project: Rya
>  Issue Type: Bug
>Reporter: Aaron Mihalik
>Assignee: Aaron Mihalik
>
> There are a couple mongo tests that fail while building on builds.a.o.  It 
> looks like Embedded Mongo will try to bind to ports that are already in use.
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoGeoIndexerSfTest/testIntersectsLine/
> https://builds.apache.org/view/Incubator%20Projects/job/incubator-rya-master/org.apache.rya$rya.indexing/31/testReport/junit/mvm.rya.indexing.mongo/MongoTemporalIndexerTest/testQueryInstantHasBeginningInterval/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)