@@ -33,7 +33,8 @@ import org.bson.BsonNull
33
33
import org.bson.BsonString
34
34
import spock.lang.Specification
35
35
36
- import static com.mongodb.ClusterFixture.*
36
+ import static com.mongodb.ClusterFixture.TIMEOUT_SETTINGS
37
+ import static com.mongodb.ClusterFixture.TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT
37
38
import static com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException
38
39
import static com.mongodb.internal.connection.ProtocolHelper.getQueryFailureException
39
40
import static com.mongodb.internal.connection.ProtocolHelper.isCommandOk
@@ -73,22 +74,19 @@ class ProtocolHelperSpecification extends Specification {
73
74
def ' command failure exception should be MongoExecutionTimeoutException if error code is 50' () {
74
75
expect :
75
76
getCommandFailureException(new BsonDocument (' ok' , new BsonInt32 (0 )). append(' code' , new BsonInt32 (50 )),
76
- new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS ))
77
- instanceof MongoExecutionTimeoutException
77
+ new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS )) instanceof MongoExecutionTimeoutException
78
78
}
79
79
80
80
def ' command failure exception should be MongoOperationTimeoutException if error code is 50 and timeoutMS is set' () {
81
81
expect :
82
82
getCommandFailureException(new BsonDocument (' ok' , new BsonInt32 (0 )). append(' code' , new BsonInt32 (50 )),
83
- new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT ))
84
- instanceof MongoOperationTimeoutException
83
+ new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT )) instanceof MongoOperationTimeoutException
85
84
}
86
85
87
86
def ' query failure exception should be MongoExecutionTimeoutException if error code is 50' () {
88
87
expect :
89
88
getQueryFailureException(new BsonDocument (' code' , new BsonInt32 (50 )),
90
- new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS ))
91
- instanceof MongoExecutionTimeoutException
89
+ new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS )) instanceof MongoExecutionTimeoutException
92
90
}
93
91
94
92
def ' query failure exception should be MongoOperationTimeoutException if error code is 50' () {
@@ -97,13 +95,12 @@ class ProtocolHelperSpecification extends Specification {
97
95
new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT ))
98
96
exception instanceof MongoOperationTimeoutException
99
97
exception. getCause() instanceof MongoExecutionTimeoutException
100
-
101
98
}
102
99
103
100
def ' command failure exceptions should handle MongoNotPrimaryException scenarios' () {
104
101
expect :
105
- getCommandFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
106
- instanceof MongoNotPrimaryException
102
+ getCommandFailureException(
103
+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNotPrimaryException
107
104
108
105
where :
109
106
exception << [
@@ -115,8 +112,8 @@ class ProtocolHelperSpecification extends Specification {
115
112
116
113
def ' query failure exceptions should handle MongoNotPrimaryException scenarios' () {
117
114
expect :
118
- getQueryFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
119
- instanceof MongoNotPrimaryException
115
+ getQueryFailureException(
116
+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNotPrimaryException
120
117
121
118
where :
122
119
exception << [
@@ -128,8 +125,8 @@ class ProtocolHelperSpecification extends Specification {
128
125
129
126
def ' command failure exceptions should handle MongoNodeIsRecoveringException scenarios' () {
130
127
expect :
131
- getCommandFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
132
- instanceof MongoNodeIsRecoveringException
128
+ getCommandFailureException(
129
+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNodeIsRecoveringException
133
130
134
131
where :
135
132
exception << [
@@ -144,8 +141,8 @@ class ProtocolHelperSpecification extends Specification {
144
141
145
142
def ' query failure exceptions should handle MongoNodeIsRecoveringException scenarios' () {
146
143
expect :
147
- getQueryFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
148
- instanceof MongoNodeIsRecoveringException
144
+ getQueryFailureException(
145
+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNodeIsRecoveringException
149
146
150
147
where :
151
148
exception << [
0 commit comments