1 package com.srv4pos.server.api.registration;
2
3 import com.srv4pos.server.api.ServiceFactory;
4 import com.srv4pos.server.api.exceptions.ForbiddenJsonException;
5 import com.srv4pos.server.api.infrastructure.credentials.Credentials;
6 import com.srv4pos.server.api.infrastructure.http.Transport;
7 import com.srv4pos.server.api.seller.SellerService;
8
9 import java.net.URL;
10
11 import static com.srv4pos.server.api.infrastructure.DiagnosticsUtil.assertExceptionThrown;
12
13
14
15
16 public class RegistrationServiceSample {
17
18 private final RegistrationService registrationService;
19 private final SellerService sellerService;
20
21 public RegistrationServiceSample(URL url, Credentials activationCredentials, Transport transport) {
22 ServiceFactory serviceFactory = new ServiceFactory(url, activationCredentials, transport);
23
24 registrationService = serviceFactory.getRegistrationService();
25 sellerService = serviceFactory.getSellerService();
26 }
27
28 public void test() throws Exception {
29 final int currentSellerVersion = sellerService.getThisVersion().getVersion();
30
31 assertExceptionThrown("RegistrationService.list() is forbidden!", ForbiddenJsonException.class, new Runnable() {
32 public void run() {
33 registrationService.list(null);
34 }
35 });
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 }
53 }