X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-dom-xsql%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fxsql%2Ftest%2FXSQLTest.java;h=b7238abdd6bf1db6e37c45a98023d0e693c8b0f2;hb=413cd215a9bc7ca039b231a3b1abdbba092276a5;hp=8a6b184f820b91b838d077f8ad640de7f271ad8d;hpb=b3c034675957f963c5878ce1e5e183ec2de8b5e2;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java b/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java index 8a6b184f82..b7238abdd6 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java @@ -1,19 +1,38 @@ +/* + * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + package org.opendaylight.xsql.test; import java.io.InputStream; import java.sql.SQLException; +import java.util.Collections; +import java.util.Set; import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCResultSet; import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCServer; +import org.opendaylight.yangtools.yang.model.api.Module; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; public class XSQLTest { - - XSQLBluePrint bluePrint = null; + private static final String DATASTORE_TEST_YANG = "/sal-persisted-dom-test.yang"; + private XSQLBluePrint bluePrint = null; + //private static SchemaContext schemaContext = null; + @BeforeClass + public static void loadSchemaContext(){ + //schemaContext = createTestContext(); + } @Before public void before() { @@ -167,4 +186,18 @@ public class XSQLTest { System.out.print("*** XSQL Tests -"); System.out.println(str); } + + public static final InputStream getDatastoreTestInputStream() { + return getInputStream(DATASTORE_TEST_YANG); + } + + private static InputStream getInputStream(final String resourceName) { + return XSQLTest.class.getResourceAsStream(DATASTORE_TEST_YANG); + } + + public static SchemaContext createTestContext() { + YangParserImpl parser = new YangParserImpl(); + Set modules = parser.parseYangModelsFromStreams(Collections.singletonList(getDatastoreTestInputStream())); + return parser.resolveSchemaContext(modules); + } }