ValidationReportSoapResponseTransformer { public ValidationReport toSoapResponse(SimpleReport report) { ValidationReport validationReport = new ValidationReport(); ValidationConclusion responseValidationConclusion = toSoapValidationConclusion(report.getValidationConclusion()); validationReport.setValidationConclusion(responseValidationConclusion); if (report instanceof DetailedReport) { XmlDetailedReport xmlDetailedReport = ((DetailedReport) report).getValidationProcess(); validationReport.setValidationProcess(DETAILED_REPORT_TRANSFORMER.transform(xmlDetailedReport)); } else if (report instanceof DiagnosticReport) { XmlDiagnosticData diagnosticData = ((DiagnosticReport) report).getDiagnosticData(); validationReport.setDiagnosticData(DIAGNOSTIC_DATA_TRANSFORMER.transform(diagnosticData)); } return validationReport; }  ValidationReport toSoapResponse(SimpleReport report);  }
@Test public void qualifiedSimpleReportIsCorrectlyTransformedToSoapResponseReport() { ee.openeid.siva.validation.document.report.ValidationConclusion validationConclusion = createMockedValidationConclusion(); SimpleReport simpleReport = new SimpleReport(); simpleReport.setValidationConclusion(validationConclusion); ValidationReport soapValidationReport = transformer.toSoapResponse(simpleReport); assertValidationConclusion(validationConclusion, soapValidationReport.getValidationConclusion()); assertNull(soapValidationReport.getValidationProcess()); assertNull(soapValidationReport.getDiagnosticData()); }
@Test public void qualifiedDetailedReportIsCorrectlyTransformedToSoapResponseReport() { ee.openeid.siva.validation.document.report.ValidationConclusion validationConclusion = createMockedValidationConclusion(); eu.europa.esig.dss.detailedreport.jaxb.XmlDetailedReport validationProcess = createMockedValidationProcess(); DetailedReport detailedReport = new DetailedReport(validationConclusion, validationProcess); ValidationReport responseValidationReport = transformer.toSoapResponse(detailedReport); assertValidationConclusion(validationConclusion, responseValidationReport.getValidationConclusion()); assertNull(responseValidationReport.getDiagnosticData()); Assert.assertEquals("EE", responseValidationReport.getValidationProcess().getTLAnalysis().get(0).getCountryCode()); }
@Test @Ignore("SIVA-187") public void qualifiedDiagnosticDataIsCorrectlyTransformedToSoapResponseReport() { ee.openeid.siva.validation.document.report.ValidationConclusion validationConclusion = createMockedValidationConclusion(); eu.europa.esig.dss.diagnostic.jaxb.XmlDiagnosticData diagnosticData = createMockedDiagnosticData(); DiagnosticReport diagnosticReport = new DiagnosticReport(validationConclusion, diagnosticData); ValidationReport responseValidationReport = transformer.toSoapResponse(diagnosticReport); assertValidationConclusion(validationConclusion, responseValidationReport.getValidationConclusion()); assertDiagnosticData(diagnosticData, responseValidationReport.getDiagnosticData()); assertNull(responseValidationReport.getValidationProcess()); }
@Test public void qualifiedDetailedReportIsNull() { ee.openeid.siva.validation.document.report.ValidationConclusion validationConclusion = createMockedValidationConclusion(); SimpleReport simpleReport = new SimpleReport(validationConclusion); ValidationReport responseValidationReport = transformer.toSoapResponse(simpleReport); ValidationConclusion responseValidationConclusion = responseValidationReport.getValidationConclusion(); Assert.assertEquals(validationConclusion.getSignatures().get(0).getIndication(), responseValidationConclusion.getSignatures().getSignature().get(0).getIndication().value()); }
@Test public void detailedReportWithNullValidationProcess() { ee.openeid.siva.validation.document.report.ValidationConclusion validationConclusion = createMockedValidationConclusion(); DetailedReport detailedReport = new DetailedReport(validationConclusion, null); ValidationReport responseValidationReport = transformer.toSoapResponse(detailedReport); assertValidationConclusion(validationConclusion, responseValidationReport.getValidationConclusion()); assertNull(responseValidationReport.getValidationProcess()); assertNull(responseValidationReport.getDiagnosticData()); }
@Test public void diagnosticReportWithNullDiagnosticData() { ee.openeid.siva.validation.document.report.ValidationConclusion validationConclusion = createMockedValidationConclusion(); DiagnosticReport diagnosticReport = new DiagnosticReport(validationConclusion, null); ValidationReport responseValidationReport = transformer.toSoapResponse(diagnosticReport); assertValidationConclusion(validationConclusion, responseValidationReport.getValidationConclusion()); assertNull(responseValidationReport.getValidationProcess()); assertNull(responseValidationReport.getDiagnosticData()); }