use of org.opendaylight.restconf.common.errors.RestconfDocumentedException in project netconf by opendaylight.
the class ParserIdentifierTest method makeQNameFromIdentifierMountPointTooShortIdentifierNegativeTest.
/**
* Negative test when supplied identifier for module behind mount point is too short (contains only module name).
* <code>RestconfDocumentedException</code> is expected and error type, error tag and error status code
* are compared to expected values.
*/
@Test
public void makeQNameFromIdentifierMountPointTooShortIdentifierNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier(MOUNT_POINT_IDENT + "/" + TEST_MODULE_NAME));
assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
}
use of org.opendaylight.restconf.common.errors.RestconfDocumentedException in project netconf by opendaylight.
the class ParserIdentifierTest method toSchemaExportContextFromIdentifierInvalidIdentifierNegativeTest.
/**
* Negative test trying to get <code>SchemaExportContext</code> with invalid identifier. Test is expected to fail
* with <code>RestconfDocumentedException</code> error type, error tag and error status code are compared to
* expected values.
*/
@Test
public void toSchemaExportContextFromIdentifierInvalidIdentifierNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.toSchemaExportContextFromIdentifier(SCHEMA_CONTEXT, TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, null, sourceProvider));
assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
}
use of org.opendaylight.restconf.common.errors.RestconfDocumentedException in project netconf by opendaylight.
the class ParserIdentifierTest method makeQNameFromIdentifierMountPointInvalidIdentifierNegativeTest.
/**
* Negative test when supplied identifier for module behind mount point is in invalid format and then revision is
* not parsable. <code>RestconfDocumentedException</code> is expected and error type, error tag and error status
* code are compared to expected values.
*/
@Test
public void makeQNameFromIdentifierMountPointInvalidIdentifierNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier(MOUNT_POINT_IDENT + "/" + TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME));
assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
}
use of org.opendaylight.restconf.common.errors.RestconfDocumentedException in project netconf by opendaylight.
the class ParserIdentifierTest method makeQNameFromIdentifierDoubleSlashNegativeTest.
/**
* Negative test with identifier containing double slash. Between // there is one empty string which will be
* incorrectly considered to be module revision. Test is expected to fail with
* <code>RestconfDocumentedException</code> and error type, error tag and error status code are compared to
* expected values.
*/
@Test
public void makeQNameFromIdentifierDoubleSlashNegativeTest() {
RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier(TEST_MODULE_NAME + "//" + TEST_MODULE_REVISION));
assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals("Not expected error tag", ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
}
use of org.opendaylight.restconf.common.errors.RestconfDocumentedException in project netconf by opendaylight.
the class RestconfValidationTest method validateAndGetModuleNameNotParsableFirstTest.
/**
* Negative test of module name validation when supplied name is not parsable as module name on the first
* character. Test fails catching <code>RestconfDocumentedException</code> and checking for correct error type,
* error tag and error status code.
*/
@Test
public void validateAndGetModuleNameNotParsableFirstTest() {
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator("01-not-parsable-as-name-on-firts-char")));
assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
assertEquals(ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag());
}
Aggregations