/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * 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.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
public class YangParserNegativeTest {
}
}
- @Test
- public void testWrongDependenciesDir() throws Exception {
- try {
- File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
- File dependenciesDir = new File("/invalid");
- YangContextParser parser = new YangParserImpl();
- parser.parseFile(yangFile, dependenciesDir);
- fail("Exception should be thrown");
- } catch (IllegalStateException e) {
- String expected = File.separator + "invalid does not exists";
- assertEquals(expected, e.getMessage());
- }
- }
-
- @Test
- public void testWrongDependenciesDir2() throws Exception {
- try {
- File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
- File dependenciesDir = new File(getClass().getResource("/model").toURI());
- YangContextParser parser = new YangParserImpl();
- parser.parseFile(yangFile, dependenciesDir);
- fail("Exception should be thrown");
- } catch (YangValidationException e) {
- String expected = "Not existing module imported";
- assertTrue(e.getMessage().contains(expected));
- }
- }
-
@Test
public void testInvalidListKeyDefinition() throws Exception {
File yang1 = new File(getClass().getResource("/negative-scenario/invalid-list-key-def.yang").toURI());