+/*
+ * 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.List;
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.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
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() {
System.out.print("*** XSQL Tests -");
System.out.println(str);
}
+
+ private static InputStream getInputStream() {
+ return XSQLTest.class.getResourceAsStream(DATASTORE_TEST_YANG);
+ }
+
+ public static SchemaContext createTestContext() {
+ final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
+ final SchemaContext schemaContext;
+ final List<InputStream> streams = Collections.singletonList(getInputStream());
+
+ try {
+ schemaContext = reactor.buildEffective(streams);
+ } catch (ReactorException e) {
+ throw new RuntimeException("Unable to build schema context from " + streams, e);
+ }
+ return schemaContext;
+ }
}