@@ -57,7 +57,6 @@ public class ObjectHandlerTest {
57
57
private ObjectHandler objHandler = new ObjectHandler ();
58
58
59
59
private MongodForTestsFactory testsFactory ;
60
- private MongodExecutable mongodExecutable = null ;
61
60
private MongoClient mongoClient = null ;
62
61
63
62
private MongoDBHandler mongoDBHandler = new MongoDBHandler ();
@@ -79,21 +78,8 @@ public class ObjectHandlerTest {
79
78
80
79
public void setUpEmbeddedMongo () throws Exception {
81
80
try {
82
- // testsFactory = MongodForTestsFactory.with(Version.V3_4_1);
83
- // mongoClient = testsFactory.newMongo();
84
- int port = SocketUtils .findAvailableTcpPort ();
85
-
86
- MongodStarter starter = MongodStarter .getDefaultInstance ();
87
-
88
- String bindIp = "localhost" ;
89
-
90
- IMongodConfig mongodConfig = new MongodConfigBuilder ().version (Version .Main .PRODUCTION )
91
- .net (new Net (bindIp , port , Network .localhostIsIPv6 ())).build ();
92
-
93
- mongodExecutable = starter .prepare (mongodConfig );
94
- MongodProcess mongod = mongodExecutable .start ();
95
- mongoClient = new MongoClient ("localhost" , port );
96
-
81
+ testsFactory = MongodForTestsFactory .with (Version .V3_4_1 );
82
+ mongoClient = testsFactory .newMongo ();
97
83
} catch (Exception e ) {
98
84
log .error (e .getMessage (), e );
99
85
e .printStackTrace ();
@@ -138,10 +124,8 @@ public void dropCollection() {
138
124
mongoDBHandler .dropDocument (dataBaseName , collectionName , condition );
139
125
if (mongoClient != null )
140
126
mongoClient .close ();
141
- if (mongodExecutable != null )
142
- mongodExecutable .stop ();
143
- // if (testsFactory != null)
144
- // testsFactory.shutdown();
127
+ if (testsFactory != null )
128
+ testsFactory .shutdown ();
145
129
146
130
}
147
131
}
0 commit comments