当前位置: 首页>>代码示例>>Java>>正文


Java XmlDocumentReadFailureException类代码示例

本文整理汇总了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);
}
 
开发者ID:bhits,项目名称:dss-api,代码行数:8,代码来源:ClinicalDocumentValidationImpl.java

示例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
}
 
开发者ID:bhits,项目名称:dss-api,代码行数:41,代码来源:DocumentSegmentationImplTest.java

示例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"));
    }
}
 
开发者ID:bhits,项目名称:common-libraries,代码行数:12,代码来源:XmlValidationTest.java

示例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);
}
 
开发者ID:bhits,项目名称:dss-api,代码行数:5,代码来源:DocumentSegmentationRestController.java

示例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));
}
 
开发者ID:bhits,项目名称:common-libraries,代码行数:5,代码来源:XmlValidationTest.java

示例6: testValidateString

import gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException; //导入依赖的package包/类
@Test
public void testValidateString() throws InvalidXmlDocumentException, XmlDocumentReadFailureException {
    assertTrue(sut.validate(validC32));
}
 
开发者ID:bhits,项目名称:common-libraries,代码行数:5,代码来源:XmlValidationTest.java

示例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;
 
开发者ID:bhits,项目名称:dss-api,代码行数:7,代码来源:ClinicalDocumentValidation.java

示例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;
 
开发者ID:bhits,项目名称:dss-api,代码行数:18,代码来源:ClinicalDocumentValidation.java

示例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;
 
开发者ID:bhits,项目名称:dss-api,代码行数:13,代码来源:DocumentSegmentation.java

示例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"))));
}
 
开发者ID:bhits,项目名称:common-libraries,代码行数:14,代码来源:XmlValidation.java

示例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"))));
}
 
开发者ID:bhits,项目名称:common-libraries,代码行数:13,代码来源:XmlValidation.java


注:本文中的gov.samhsa.c2s.common.validation.exception.XmlDocumentReadFailureException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。