use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class CopyConfigTest method testConfigMissing.
@Test
public void testConfigMissing() {
final DocumentedException e = assertThrows(DocumentedException.class, () -> copyConfig("messages/mapping/copyConfigs/copyConfig_no_config.xml"));
assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR);
assertEquals(e.getErrorTag(), ErrorTag.MISSING_ELEMENT);
assertEquals(e.getErrorType(), ErrorType.PROTOCOL);
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class CopyConfigTest method testSourceMissing.
@Test
public void testSourceMissing() {
final DocumentedException e = assertThrows(DocumentedException.class, () -> copyConfig("messages/mapping/copyConfigs/copyConfig_no_source.xml"));
assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR);
assertEquals(e.getErrorTag(), ErrorTag.MISSING_ELEMENT);
assertEquals(e.getErrorType(), ErrorType.PROTOCOL);
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class CopyConfigTest method testRunning.
@Test
public void testRunning() {
final DocumentedException e = assertThrows(DocumentedException.class, () -> copyConfig("messages/mapping/copyConfigs/copyConfig_running.xml"));
assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR);
assertEquals(e.getErrorTag(), ErrorTag.OPERATION_NOT_SUPPORTED);
assertEquals(e.getErrorType(), ErrorType.PROTOCOL);
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class CopyConfigTest method testExternalConfigInvalid.
@Test
public void testExternalConfigInvalid() throws Exception {
// Ask class loader for URI of config file and use it as <url> in <copy-config> RPC:
final String template = XmlFileLoader.fileToString("messages/mapping/copyConfigs/copyConfig_from_file.xml");
final URI uri = getClass().getClassLoader().getResource("messages/mapping/copyConfigs/config_file_invalid.xml").toURI();
final String copyConfig = template.replaceFirst("URL", uri.toString());
final Document request = XmlUtil.readXmlToDocument(copyConfig);
final DocumentedException e = assertThrows(DocumentedException.class, () -> copyConfig(request));
assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR);
assertEquals(e.getErrorTag(), ErrorTag.OPERATION_FAILED);
assertEquals(e.getErrorType(), ErrorType.APPLICATION);
assertTrue(e.getCause() instanceof SAXException);
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class CopyConfigTest method testUnsupportedTargetUrlProtocol.
@Test
public void testUnsupportedTargetUrlProtocol() {
final DocumentedException e = assertThrows(DocumentedException.class, () -> copyConfig("messages/mapping/copyConfigs/copyConfig_to_unsupported_url_protocol.xml"));
assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR);
assertEquals(e.getErrorTag(), ErrorTag.OPERATION_NOT_SUPPORTED);
assertEquals(e.getErrorType(), ErrorType.PROTOCOL);
}
Aggregations