File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ public void requestDone(){
126
126
*/
127
127
@ Override
128
128
public void requestEnsureConnection (){
129
+ checkMaster ( false , true );
129
130
_myPort .get ().requestEnsureConnection ();
130
131
}
131
132
Original file line number Diff line number Diff line change 19
19
import org .testng .annotations .Test ;
20
20
21
21
import java .net .UnknownHostException ;
22
+ import java .util .Arrays ;
22
23
23
24
public class DBTest extends TestCase {
24
25
@@ -119,6 +120,27 @@ public void testReadPreferenceObedience() {
119
120
assertEquals (ReadPreference .primary (), _db .getCommandReadPreference (obj , ReadPreference .secondary ()));
120
121
}
121
122
123
+ @ Test (groups = {"basic" })
124
+ public void testEnsureConnection () throws UnknownHostException {
125
+
126
+ Mongo m = new Mongo (Arrays .asList (new ServerAddress ("localhost" )));
127
+
128
+ if (isStandalone (m )) {
129
+ return ;
130
+ }
131
+ try {
132
+ DB db = m .getDB ("com_mongodb_unittest_DBTest" );
133
+ db .requestStart ();
134
+ try {
135
+ db .requestEnsureConnection ();
136
+ } finally {
137
+ db .requestDone ();
138
+ }
139
+ } finally {
140
+ m .close ();
141
+ }
142
+ }
143
+
122
144
/*public static class Person extends DBObject {
123
145
124
146
public Person(){
You can’t perform that action at this time.
0 commit comments