本文整理汇总了Java中gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException类的典型用法代码示例。如果您正苦于以下问题:Java XmlDocumentReadFailureException类的具体用法?Java XmlDocumentReadFailureException怎么用?Java XmlDocumentReadFailureException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlDocumentReadFailureException类属于gov.samhsa.c2s.common.validation.exception包,在下文中一共展示了XmlDocumentReadFailureException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateClinicalDocument
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
@Override
public ClinicalDocumentValidationResult validateClinicalDocument(ClinicalDocumentValidationRequest validationRequest) throws InvalidOriginalClinicalDocumentException, XmlDocumentReadFailureException {
Optional<String> documentEncoding = validationRequest.getDocumentEncoding();
Charset charset = getCharset(documentEncoding);
String document = new String(validationRequest.getDocument(), charset);
return this.validateClinicalDocument(charset, document);
}
示例2: testSegmentDocument_Given_Real_Marshaller_Throws_XmlDocumentReadFailureException
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
@Test(expected = XmlDocumentReadFailureException.class)
public void testSegmentDocument_Given_Real_Marshaller_Throws_XmlDocumentReadFailureException()
throws IOException, InvalidXmlDocumentException, AuditException {
// Arrange
final boolean xdm = true;
final boolean ecrypt = true;
final boolean audited = true;
final boolean auditFailureByPass = true;
final XmlValidation validationMock = mock(XmlValidation.class);
doThrow(XmlDocumentReadFailureException.class).when(validationMock)
.validateWithAllErrors("");
final DocumentSegmentationImpl documentSegmentationWithRealMarshaller = new DocumentSegmentationImpl(
ruleExecutionServiceClientMock,
documentEditorMock, new SimpleMarshallerImpl(),
documentRedactorMock, documentTaggerMock,
documentFactModelExtractorMock,
embeddedClinicalDocumentExtractorMock,
new ValueSetServiceImplMock(fileReader),
additionalMetadataGeneratorForSegmentedClinicalDocumentImplMock);
ClinicalDocumentValidation clinicalDocumentValidationMock = mock(ClinicalDocumentValidation.class);
ReflectionTestUtils.setField(documentSegmentationWithRealMarshaller,
"xmlValidator", validationMock);
ReflectionTestUtils.setField(documentSegmentationWithRealMarshaller,
"clinicalDocumentValidation", clinicalDocumentValidationMock);
final String notxml = "<notxml";
when(clinicalDocumentValidationMock.validateClinicalDocument(StandardCharsets.UTF_8, notxml)).thenThrow(XmlDocumentReadFailureException.class);
DSSRequest dssRequest = new DSSRequest();
dssRequest.setDocument(notxml.getBytes(StandardCharsets.UTF_8));
dssRequest.setAudited(audited);
dssRequest.setAuditFailureByPass(auditFailureByPass);
// Act
@SuppressWarnings("unused")
final DSSResponse resp = documentSegmentationWithRealMarshaller
.segmentDocument(dssRequest);
// Assert
// expect DS4PException
}
示例3: testValidateWithAllErrors
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
@Test
public void testValidateWithAllErrors() throws XmlDocumentReadFailureException{
// Act
XmlValidationResult result = sut.validateWithAllErrors(invalidC32);
// Assert
assertEquals(2, result.getExceptions().size());
for(SAXParseException e: result.getExceptions()){
assertTrue(e.getMessage().contains("noSuchElement") || e.getMessage().contains("noSuchElement2"));
}
}
示例4: segment
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
@RequestMapping(value = "/segmentedDocument", method = RequestMethod.POST)
public DSSResponse segment(@Valid @RequestBody DSSRequest request) throws InvalidSegmentedClinicalDocumentException, AuditException, XmlDocumentReadFailureException, InvalidOriginalClinicalDocumentException {
return documentSegmentation.segmentDocument(request);
}
示例5: testValidateInputStream
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
@Test(expected = InvalidXmlDocumentException.class)
public void testValidateInputStream() throws InvalidXmlDocumentException, XmlDocumentReadFailureException {
assertFalse(sut.validate(invalidC32));
}
示例6: testValidateString
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
@Test
public void testValidateString() throws InvalidXmlDocumentException, XmlDocumentReadFailureException {
assertTrue(sut.validate(validC32));
}
示例7: validateClinicalDocument
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
/**
* @param charset
* @param document
* @throws InvalidOriginalClinicalDocumentException
*/
ClinicalDocumentValidationResult validateClinicalDocument(Charset charset, String document) throws InvalidOriginalClinicalDocumentException, XmlDocumentReadFailureException;
示例8: validateClinicalDocumentAddAudited
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
/**
* @param originalClinicalDocumentValidationResult
* @param charset
* @param originalDocument
* @param document
* @param dssRequest
* @param factModel
* @param redactedDocument
* @param rulesFired
* @throws InvalidSegmentedClinicalDocumentException
* @throws AuditException
* @throws XmlDocumentReadFailureException
*/
void validateClinicalDocumentAddAudited(ClinicalDocumentValidationResult originalClinicalDocumentValidationResult,
Charset charset, String originalDocument, String document, DSSRequest dssRequest,
FactModel factModel, RedactedDocument redactedDocument,
String rulesFired) throws InvalidSegmentedClinicalDocumentException, AuditException, XmlDocumentReadFailureException;
示例9: segmentDocument
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
/**
* Segment document.
*
* @param dssRequest the document
* @return the segment document response
* @throws XmlDocumentReadFailureException the xml document read failure exception
* @throws InvalidSegmentedClinicalDocumentException the invalid segmented clinical document exception
* @throws AuditException the audit exception
*/
DSSResponse segmentDocument(DSSRequest dssRequest)
throws XmlDocumentReadFailureException,
InvalidSegmentedClinicalDocumentException, AuditException, InvalidOriginalClinicalDocumentException;
示例10: validate
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
/**
* Validate.
*
* @param xml the xml
* @return true, if successful
* @throws InvalidXmlDocumentException the invalid xml document exception
* @throws XmlDocumentReadFailureException the xml document read failure exception
*/
public boolean validate(String xml) throws InvalidXmlDocumentException,
XmlDocumentReadFailureException {
return validate(new ByteArrayInputStream(xml.getBytes(Charset
.forName("UTF-8"))));
}
示例11: validateWithAllErrors
import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
/**
* Validate with all errors.
*
* @param xml the xml
* @return the xml validation result
* @throws XmlDocumentReadFailureException the xml document read failure exception
*/
public XmlValidationResult validateWithAllErrors(String xml)
throws XmlDocumentReadFailureException {
return validateWithAllErrors(new ByteArrayInputStream(
xml.getBytes(Charset.forName("UTF-8"))));
}