1 /*--------------------------------------------------------------------------
\r
2 * Copyright 2009 Taro L. Saito
\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
8 * http://www.apache.org/licenses/LICENSE-2.0
\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
19 // SilkSchemaTest.java
\r
20 // Since: Jul 3, 2009 3:31:38 PM
\r
24 //--------------------------------------
\r
25 package org.xerial.silk.schema;
\r
27 import static org.junit.Assert.*;
\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
36 public class SilkSchemaTest {
\r
38 private static Logger _logger = Logger.getLogger(SilkSchemaTest.class);
\r
41 public void setUp() throws Exception {}
\r
44 public void tearDown() throws Exception {}
\r
47 public void parse() throws Exception {
\r
48 SilkSchema schema = SilkSchema
\r
49 .parse(FileResource.open(SilkSchemaTest.class, "schema.silk"));
\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
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
65 else if (c.name.equals("Locus")) {
\r
68 else if (c.name.equals("Gene")) {
\r
71 else if (c.name.equals("Exon")) {
\r
74 else if (c.name.equals("CDS")) {
\r
77 else if (c.name.equals("Reference")) {
\r
80 else if (c.name.equals("Read")) {
\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
93 _logger.info(Lens.toJSON(schema));
\r
95 //_logger.info(schema.toGraphviz());
\r