Bug 4540: Yang parser exceptions should follow consistent path
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / retest / SchemaContextTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.stmt.retest;
9
10 import static org.mockito.Mockito.doReturn;
11 import java.net.URI;
12 import java.net.URISyntaxException;
13 import java.text.ParseException;
14 import java.util.Collections;
15 import java.util.Date;
16 import java.util.Map;
17 import org.junit.Before;
18 import org.mockito.Mock;
19 import org.mockito.MockitoAnnotations;
20 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
21 import org.opendaylight.yangtools.yang.model.api.Module;
22 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
23 //import org.opendaylight.yangtools.yang.parser.impl.SchemaContextImpl;
24
25 public class SchemaContextTest {
26     @Mock
27     private Module oldModule;
28
29     @Mock
30     private Module newModule;
31
32     private Map<ModuleIdentifier, String> sources;
33
34     private URI ns;
35     private Date oldDate;
36     private Date newDate;
37
38     @Before
39     public void setUp() throws ParseException, URISyntaxException {
40         MockitoAnnotations.initMocks(this);
41
42         ns = new URI("http://abc");
43         oldDate = SimpleDateFormatUtil.getRevisionFormat().parse("2014-07-20");
44         newDate = SimpleDateFormatUtil.getRevisionFormat().parse("2014-07-22");
45
46         doReturn("abc").when(oldModule).getName();
47         doReturn(oldDate).when(oldModule).getRevision();
48         doReturn(ns).when(oldModule).getNamespace();
49         doReturn("abc").when(newModule).getName();
50         doReturn(newDate).when(newModule).getRevision();
51         doReturn(ns).when(newModule).getNamespace();
52
53         sources = Collections.emptyMap();
54     }
55
56 //    @Test
57 //    public void testModuleOrdering() {
58 //        SchemaContext sc;
59 //        Module m;
60 //
61 //        sc = SchemaContextImpl(ImmutableSet.of(newModule, oldModule), sources);
62 //        m = sc.findModuleByName("abc", null);
63 //        assertEquals(newDate, m.getRevision());
64 //        m = sc.findModuleByNamespaceAndRevision(ns, null);
65 //        assertEquals(newDate, m.getRevision());
66 //
67 //        sc = new SchemaContextImpl(ImmutableSet.of(oldModule, newModule), sources);
68 //        m = sc.findModuleByName("abc", null);
69 //        assertEquals(newDate, m.getRevision());
70 //        m = sc.findModuleByNamespaceAndRevision(ns, null);
71 //        assertEquals(newDate, m.getRevision());
72 //    }
73
74
75 }