File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 17
17
package com .mongodb ;
18
18
19
19
import java .net .UnknownHostException ;
20
+ import java .util .List ;
20
21
21
22
/**
22
23
* Helper class for the acceptance tests.
@@ -76,6 +77,20 @@ public static boolean isReplicaSet() {
76
77
return runIsMaster ().get ("setName" ) != null ;
77
78
}
78
79
80
+ public static boolean isServerStartedWithJournalingDisabled () {
81
+ return serverStartedWithBooleanOption ("--nojournal" , "nojournal" );
82
+ }
83
+
84
+ private static boolean serverStartedWithBooleanOption (final String commandLineOption , final String configOption ) {
85
+ CommandResult res = getMongoClient ().getDB ("admin" ).command (new BasicDBObject ("getCmdLineOpts" , 1 ));
86
+ res .throwOnError ();
87
+ if (res .containsField ("parsed" ) && ((DBObject ) res .get ("parsed" )).containsField (configOption )) {
88
+ return (Boolean ) ((DBObject ) res .get ("parsed" )).get (configOption );
89
+ } else {
90
+ return ((List ) res .get ("argv" )).contains (commandLineOption );
91
+ }
92
+ }
93
+
79
94
private static CommandResult runIsMaster () {
80
95
// Check to see if this is a replica set... if not, get out of here.
81
96
return getMongoClient ().getDB ("admin" ).command (new BasicDBObject ("ismaster" , 1 ));
You can’t perform that action at this time.
0 commit comments