Exemple #1
0
 @Test(expected = DocumentedException.class)
 public void testNoSource() throws Exception {
   final XmlElement xml =
       XmlElement.fromString(
           "<validate xmlns=\""
               + XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0
               + "\"/>");
   final Validate validate = new Validate(null, NETCONF_SESSION_ID_FOR_REPORTING);
   validate.handleWithNoSubsequentOperations(null, xml);
 }
Exemple #2
0
 @Test(expected = DocumentedException.class)
 public void testValidationException() throws Exception {
   final XmlElement xml =
       XmlElement.fromString(
           "<validate xmlns=\""
               + XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0
               + "\">><source><candidate/></source></validate>");
   final ConfigSubsystemFacade facade = mock(ConfigSubsystemFacade.class);
   doThrow(ValidationException.class).when(facade).validateConfiguration();
   final Validate validate = new Validate(facade, NETCONF_SESSION_ID_FOR_REPORTING);
   validate.handleWithNoSubsequentOperations(null, xml);
 }
Exemple #3
0
 @Test
 public void testValidation() throws Exception {
   final XmlElement xml =
       XmlElement.fromString(
           "<validate xmlns=\""
               + XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0
               + "\"><source><candidate/></source></validate>");
   final Element okElement = XmlUtil.readXmlToElement("<ok/>");
   final ConfigSubsystemFacade facade = mock(ConfigSubsystemFacade.class);
   doNothing().when(facade).validateConfiguration();
   final Validate validate = new Validate(facade, NETCONF_SESSION_ID_FOR_REPORTING);
   Element ok = validate.handleWithNoSubsequentOperations(XmlUtil.newDocument(), xml);
   assertEquals(XmlUtil.toString(okElement), XmlUtil.toString(ok));
 }
Exemple #4
0
 @Test(expected = DocumentedException.class)
 public void testNoNamespace() throws Exception {
   final XmlElement xml = XmlElement.fromString("<validate/>");
   final Validate validate = new Validate(null, NETCONF_SESSION_ID_FOR_REPORTING);
   validate.handleWithNoSubsequentOperations(null, xml);
 }