1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.client.bindings.misc;
20
21 import junit.framework.TestCase;
22
23 import org.apache.chemistry.opencmis.client.bindings.spi.local.LocalCallContext;
24 import org.apache.chemistry.opencmis.commons.server.CallContext;
25
26 public class LocalCallContextTest extends TestCase {
27
28 public void testLocalCallContextSimple() {
29 LocalCallContext lcc = new LocalCallContext("repId", "user", "password");
30
31 assertEquals(CallContext.BINDING_LOCAL, lcc.getBinding());
32 assertEquals("repId", lcc.getRepositoryId());
33 assertEquals("user", lcc.getUsername());
34 assertEquals("password", lcc.getPassword());
35 assertNull(lcc.get(CallContext.LOCALE_ISO639_LANGUAGE));
36 assertNull(lcc.get(CallContext.LOCALE_ISO3166_COUNTRY));
37 assertNull(lcc.getLocale());
38 }
39
40 public void testLocalCallContextLang() {
41 LocalCallContext lcc = new LocalCallContext("repId", "user", "password", "de", null);
42
43 assertEquals(CallContext.BINDING_LOCAL, lcc.getBinding());
44 assertEquals("repId", lcc.getRepositoryId());
45 assertEquals("user", lcc.getUsername());
46 assertEquals("password", lcc.getPassword());
47 assertEquals("de", lcc.get(CallContext.LOCALE_ISO639_LANGUAGE));
48 assertNull(lcc.get(CallContext.LOCALE_ISO3166_COUNTRY));
49 assertEquals("de", lcc.getLocale());
50 }
51
52 public void testLocalCallContextLangCountry() {
53 LocalCallContext lcc = new LocalCallContext("repId", "user", "password", "de", "ch");
54
55 assertEquals(CallContext.BINDING_LOCAL, lcc.getBinding());
56 assertEquals("repId", lcc.getRepositoryId());
57 assertEquals("user", lcc.getUsername());
58 assertEquals("password", lcc.getPassword());
59 assertEquals("de", lcc.get(CallContext.LOCALE_ISO639_LANGUAGE));
60 assertEquals("ch", lcc.get(CallContext.LOCALE_ISO3166_COUNTRY));
61 assertEquals("de-ch", lcc.getLocale());
62 }
63 }