File tree Expand file tree Collapse file tree 4 files changed +41
-10
lines changed
objectbox-java/src/main/java/io/objectbox/sync
tests/objectbox-java-test/src/test/java/io/objectbox Expand file tree Collapse file tree 4 files changed +41
-10
lines changed Original file line number Diff line number Diff line change 12
12
@ Experimental
13
13
public final class Sync {
14
14
15
+ /**
16
+ * Returns true if the included native (JNI) ObjectBox library supports sync.
17
+ */
18
+ public static boolean isAvailable () {
19
+ return BoxStore .isSyncAvailable ();
20
+ }
21
+
15
22
/**
16
23
* Start building a sync client. Requires the BoxStore that should be synced with the server,
17
24
* the URL and port of the server to connect to and credentials to authenticate against the server.
Original file line number Diff line number Diff line change @@ -240,14 +240,4 @@ public void testIsObjectBrowserAvailable() {
240
240
assertFalse (BoxStore .isObjectBrowserAvailable ());
241
241
}
242
242
243
- @ Test
244
- public void testIsSyncAvailable () {
245
- // The individual values don't matter; basically just ensure the methods are available and don't crash...
246
- if (BoxStore .isSyncServerAvailable ()) {
247
- assertTrue (BoxStore .isSyncAvailable ());
248
- } else {
249
- BoxStore .isSyncAvailable ();
250
- }
251
- }
252
-
253
243
}
Original file line number Diff line number Diff line change 29
29
import io .objectbox .relation .ToOneTest ;
30
30
import io .objectbox .sync .ConnectivityMonitorTest ;
31
31
import io .objectbox .sync .PlatformTest ;
32
+ import io .objectbox .sync .SyncTest ;
32
33
33
34
import org .junit .runner .RunWith ;
34
35
import org .junit .runners .Suite ;
55
56
QueryTest .class ,
56
57
RelationTest .class ,
57
58
RelationEagerTest .class ,
59
+ SyncTest .class ,
58
60
ToManyStandaloneTest .class ,
59
61
ToManyTest .class ,
60
62
ToOneTest .class ,
Original file line number Diff line number Diff line change
1
+ package io .objectbox .sync ;
2
+
3
+ import org .junit .Test ;
4
+
5
+
6
+ import io .objectbox .BoxStore ;
7
+
8
+
9
+ import static org .junit .Assert .assertFalse ;
10
+
11
+ public class SyncTest {
12
+
13
+ /**
14
+ * Ensure that non-sync native library correctly reports sync client availability.
15
+ *
16
+ * Note: this test is mirrored in objectbox-integration-test sync tests, where sync is available.
17
+ */
18
+ @ Test
19
+ public void clientIsNotAvailable () {
20
+ assertFalse (Sync .isAvailable ());
21
+ }
22
+
23
+ /**
24
+ * Ensure that non-sync native library correctly reports sync server availability.
25
+ *
26
+ * Note: this test is mirrored in objectbox-integration-test sync tests, where sync is available.
27
+ */
28
+ @ Test
29
+ public void serverIsNotAvailable () {
30
+ assertFalse (BoxStore .isSyncServerAvailable ());
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments