import static org.junit.Assert.*;\r
\r
import java.io.File;\r
+import java.net.URI;\r
+import java.net.URISyntaxException;\r
import java.util.ArrayList;\r
import java.util.List;\r
import java.util.Set;\r
\r
public class GeneratedTypesTest {\r
\r
- private SchemaContext resolveSchemaContextFromFiles(final String... yangFiles) {\r
+ private SchemaContext resolveSchemaContextFromFiles(final URI... yangFiles) {\r
final YangModelParser parser = new YangParserImpl();\r
\r
final List<File> inputFiles = new ArrayList<File>();\r
}\r
\r
@Test\r
- public void testMultipleModulesResolving() {\r
- final String topologyPath = getClass().getResource("/abstract-topology.yang").getPath();\r
- final String typesPath = getClass().getResource("/ietf-inet-types@2010-09-24.yang").getPath();\r
+ public void testMultipleModulesResolving() throws URISyntaxException {\r
+ final URI topologyPath = getClass().getResource("/abstract-topology.yang").toURI();\r
+ final URI typesPath = getClass().getResource("/ietf-inet-types@2010-09-24.yang").toURI();\r
final SchemaContext context = resolveSchemaContextFromFiles(topologyPath, typesPath);\r
assertNotNull(context);\r
\r
}\r
\r
@Test\r
- public void testLeafrefResolving() {\r
- final String topologyPath = getClass().getResource("/leafref-test-models/abstract-topology@2013-02-08.yang")\r
- .getPath();\r
- final String interfacesPath = getClass().getResource("/leafref-test-models/ietf-interfaces@2012-11-15.yang")\r
- .getPath();\r
- // final String ifTypePath = getClass().getResource(\r
- // "/leafref-test-models/iana-if-type@2012-06-05.yang").getPath();\r
- final String inetTypesPath = getClass().getResource("/leafref-test-models/ietf-inet-types@2010-09-24.yang")\r
- .getPath();\r
- final String yangTypesPath = getClass().getResource("/leafref-test-models/ietf-yang-types@2010-09-24.yang")\r
- .getPath();\r
+ public void testLeafrefResolving() throws URISyntaxException {\r
+ final URI topologyPath = getClass().getResource("/leafref-test-models/abstract-topology@2013-02-08.yang")\r
+ .toURI();\r
+ final URI interfacesPath = getClass().getResource("/leafref-test-models/ietf-interfaces@2012-11-15.yang")\r
+ .toURI();\r
+ final URI inetTypesPath = getClass().getResource("/leafref-test-models/ietf-inet-types@2010-09-24.yang")\r
+ .toURI();\r
+ final URI yangTypesPath = getClass().getResource("/leafref-test-models/ietf-yang-types@2010-09-24.yang")\r
+ .toURI();\r
\r
assertNotNull(topologyPath);\r
assertNotNull(interfacesPath);\r
}\r
\r
@Test\r
- public void testContainerResolving() {\r
- final String filePath = getClass().getResource("/simple-container-demo.yang").getPath();\r
+ public void testContainerResolving() throws URISyntaxException {\r
+ final URI filePath = getClass().getResource("/simple-container-demo.yang").toURI();\r
final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
assert (context != null);\r
\r
}\r
\r
@Test\r
- public void testLeafListResolving() {\r
- final String filePath = getClass().getResource("/simple-leaf-list-demo.yang").getPath();\r
+ public void testLeafListResolving() throws URISyntaxException {\r
+ final URI filePath = getClass().getResource("/simple-leaf-list-demo.yang").toURI();\r
final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
assertNotNull(context);\r
\r
}\r
\r
@Test\r
- public void testListResolving() {\r
- final String filePath = getClass().getResource("/simple-list-demo.yang").getPath();\r
+ public void testListResolving() throws URISyntaxException {\r
+ final URI filePath = getClass().getResource("/simple-list-demo.yang").toURI();\r
final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
assertNotNull(context);\r
\r
}\r
\r
@Test\r
- public void testListCompositeKeyResolving() {\r
- final String filePath = getClass().getResource("/list-composite-key.yang").getPath();\r
+ public void testListCompositeKeyResolving() throws URISyntaxException {\r
+ final URI filePath = getClass().getResource("/list-composite-key.yang").toURI();\r
final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
\r
assertNotNull(context);\r
}\r
\r
@Test\r
- public void testGeneratedTypes() {\r
- final String filePath = getClass().getResource("/demo-topology.yang").getPath();\r
+ public void testGeneratedTypes() throws URISyntaxException {\r
+ final URI filePath = getClass().getResource("/demo-topology.yang").toURI();\r
final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
assertNotNull(context);\r
\r