1
+ /*
2
+ * Copyright 2008-present MongoDB, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1
17
package com .mongodb .client ;
2
18
3
- import com .mongodb .MongoException ;
4
19
import com .mongodb .MongoTimeoutException ;
5
20
import org .bson .BsonDocument ;
6
21
import org .bson .BsonInt32 ;
22
+ import org .junit .Before ;
7
23
import org .junit .Test ;
8
24
9
25
import static com .mongodb .ClusterFixture .getOcspShouldSucceed ;
10
-
26
+ import static java . security . Security . getProperty ;
11
27
import static org .junit .Assert .fail ;
28
+ import static org .junit .Assume .assumeTrue ;
12
29
13
30
public class OcspTest {
31
+ @ Before
32
+ public void setUp () {
33
+ assumeTrue (canRunTests ());
34
+ }
35
+
14
36
@ Test
15
37
public void testTLS () {
16
38
String uri = "mongodb://localhost/?serverSelectionTimeoutMS=2000&tls=true" ;
@@ -22,4 +44,8 @@ public void testTLS() {
22
44
}
23
45
}
24
46
}
47
+
48
+ private boolean canRunTests () {
49
+ return getProperty ("ocsp.enable" ) != null && getProperty ("ocsp.enable" ).equals ("true" );
50
+ }
25
51
}
0 commit comments