- Map<File, String> testedFilesToYangModules = new HashMap<>();
- Map<String, String> testedYangModulesToExpectedConflictingName = new HashMap<>();
-
- @Ignore
- @Test
- public void testNameConflicts() throws Exception {
- prepareSamples();
- prepareExceptionAssertions();
-
- for (final Map.Entry<File, String> currentTestEntry : this.testedFilesToYangModules
- .entrySet()) {
- final String moduleName = currentTestEntry.getValue();
- final File yangFile = currentTestEntry.getKey();
- final Module testedModule = loadYangs(yangFile, moduleName);
-
- try {
- LOG.debug("Testing {}", yangFile);
- ModuleMXBeanEntry.create(testedModule,
- new HashMap<>(), this.context,
- new TypeProviderWrapper(new TypeProviderImpl(this.context)),
- PACKAGE_NAME);
- fail(yangFile.toString()
- + " did not cause a name conflict and should");
- } catch (final NameConflictException e) {
- assertEquals(
- this.testedYangModulesToExpectedConflictingName
- .get(moduleName),
- e.getConflictingName());
- }
- }
- }
-
- private void prepareSamples() {
- final File first = new File(getClass().getResource(
- "/duplicates/config-test-duplicate-attribute-in-list.yang")
- .getFile());
- final File dir = first.getParentFile();
-
- for (final File testYang : dir.listFiles()) {
- final String moduleName = getYangModuleName(testYang.getName());
- this.testedFilesToYangModules.put(testYang, moduleName);
- }
- }