From 3602b57321d4629003f9d022197f826812794162 Mon Sep 17 00:00:00 2001 From: Jakub Toth Date: Fri, 12 Feb 2016 11:31:31 +0100 Subject: [PATCH] Bug 3899: Milestone: Increase test coverage for Yangtools YangSourceFromFileTest Change-Id: I6f0330bc6411c46e5dac9677a44952d648e0bd70 Signed-off-by: Jakub Toth --- .../plugin/YangSourceFromFileTest.java | 26 +++++++++++++++++++ .../test/resources/yang-source-from-file.yang | 24 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/YangSourceFromFileTest.java create mode 100644 yang/yang-maven-plugin/src/test/resources/yang-source-from-file.yang diff --git a/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/YangSourceFromFileTest.java b/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/YangSourceFromFileTest.java new file mode 100644 index 0000000000..5286855d40 --- /dev/null +++ b/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/YangSourceFromFileTest.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 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.yangtools.yang2sources.plugin; + +import java.io.File; +import java.io.InputStream; +import org.junit.Assert; +import org.junit.Test; + +public class YangSourceFromFileTest { + + @Test + public void yangSourceFromFileTest() throws Exception { + final File source = new File(getClass().getResource("/yang-source-from-file.yang").getFile()); + final YangSourceFromFile yangSource = new YangSourceFromFile(source); + final InputStream openStream = yangSource.openStream(); + Assert.assertNotNull(openStream); + Assert.assertEquals(541, yangSource.size()); + } + +} diff --git a/yang/yang-maven-plugin/src/test/resources/yang-source-from-file.yang b/yang/yang-maven-plugin/src/test/resources/yang-source-from-file.yang new file mode 100644 index 0000000000..688c5b14c5 --- /dev/null +++ b/yang/yang-maven-plugin/src/test/resources/yang-source-from-file.yang @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 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 + */ + module yang-source-from-file { + + namespace "yang:source:from:file"; + prefix "ysff"; + + revision 2016-02-12 { + description + "Initial revision."; + } + + container cont{ + leaf l{ + type string; + } + } + + } -- 2.36.6