1 package com.srv4pos.server.api.auth;
2
3 import com.srv4pos.server.api.Registry;
4 import com.srv4pos.server.api.ServiceFactory;
5 import com.srv4pos.server.api.exceptions.NotImplementedJsonException;
6 import com.srv4pos.server.api.exceptions.OutdatedVersionJsonException;
7 import com.srv4pos.server.api.infrastructure.http.Transport;
8 import org.junit.Assert;
9
10 import java.net.URL;
11
12
13
14
15 public class AuthServiceSample {
16 private final AuthService authService;
17
18 public AuthServiceSample(URL url, Transport transport) {
19 ServiceFactory serviceFactory = new ServiceFactory(url, null, transport);
20 authService = serviceFactory.getAuthService();
21 }
22
23 public void test() {
24
25
26
27
28
29 try {
30 authService.handshake();
31 Assert.assertTrue(String.format("Checking version '%s' is still supportable by the server", Registry.VERSION), true);
32 } catch (OutdatedVersionJsonException e) {
33 Assert.assertTrue("Current version is out date!", false);
34
35 } catch (NotImplementedJsonException e) {
36 Assert.assertTrue("Current version is not yet supported!", false);
37
38
39 }
40 }
41
42 }