OSDN Git Service

belongs to statement
[xerial/xerial-core.git] / src / test / java / org / xerial / silk / schema / SilkSchemaTest.java
1 /*--------------------------------------------------------------------------\r
2  *  Copyright 2009 Taro L. Saito\r
3  *\r
4  *  Licensed under the Apache License, Version 2.0 (the "License");\r
5  *  you may not use this file except in compliance with the License.\r
6  *  You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  *  Unless required by applicable law or agreed to in writing, software\r
11  *  distributed under the License is distributed on an "AS IS" BASIS,\r
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  *  See the License for the specific language governing permissions and\r
14  *  limitations under the License.\r
15  *--------------------------------------------------------------------------*/\r
16 //--------------------------------------\r
17 // XerialJ\r
18 //\r
19 // SilkSchemaTest.java\r
20 // Since: Jul 3, 2009 3:31:38 PM\r
21 //\r
22 // $URL$\r
23 // $Author$\r
24 //--------------------------------------\r
25 package org.xerial.silk.schema;\r
26 \r
27 import static org.junit.Assert.*;\r
28 \r
29 import org.junit.After;\r
30 import org.junit.Before;\r
31 import org.junit.Test;\r
32 import org.xerial.lens.Lens;\r
33 import org.xerial.util.FileResource;\r
34 import org.xerial.util.log.Logger;\r
35 \r
36 public class SilkSchemaTest {\r
37 \r
38     private static Logger _logger = Logger.getLogger(SilkSchemaTest.class);\r
39 \r
40     @Before\r
41     public void setUp() throws Exception {}\r
42 \r
43     @After\r
44     public void tearDown() throws Exception {}\r
45 \r
46     @Test\r
47     public void parse() throws Exception {\r
48         SilkSchema schema = SilkSchema\r
49                 .parse(FileResource.open(SilkSchemaTest.class, "schema.silk"));\r
50 \r
51         // confirm module\r
52         assertNotNull(schema.module);\r
53         assertEquals(1, schema.module.size());\r
54         SilkModule m = schema.module.get(0);\r
55         assertEquals("org.utgenome", m.name);\r
56 \r
57         // confirm classes\r
58 \r
59         assertNotNull(m.classDef);\r
60         assertEquals(7, m.classDef.size());\r
61         for (SilkClass c : m.classDef) {\r
62             if (c.name.equals("Coordinate")) {\r
63 \r
64             }\r
65             else if (c.name.equals("Locus")) {\r
66 \r
67             }\r
68             else if (c.name.equals("Gene")) {\r
69 \r
70             }\r
71             else if (c.name.equals("Exon")) {\r
72 \r
73             }\r
74             else if (c.name.equals("CDS")) {\r
75 \r
76             }\r
77             else if (c.name.equals("Reference")) {\r
78 \r
79             }\r
80             else if (c.name.equals("Read")) {\r
81 \r
82             }\r
83 \r
84         }\r
85 \r
86         // confirm relation\r
87         //        assertNotNull(schema.relation);\r
88         //        assertEquals(1, schema.relation.size());\r
89         //        SilkRelation r = schema.relation.get(0);\r
90         //        assertEquals("Alignment", r.name);\r
91         //        assertEquals(2, r.attribute.size());\r
92 \r
93         _logger.info(Lens.toJSON(schema));\r
94 \r
95         //_logger.info(schema.toGraphviz());\r
96 \r
97     }\r
98 \r
99 }\r