Search in sources :

Example 1 with AttestationReport

use of com.intel.mtwilson.datatypes.AttestationReport in project OpenAttestation by OpenAttestation.

the class ReportsBOTest method testGetAttestationReport.

@Test
public void testGetAttestationReport() throws NumberFormatException, IOException {
    when(tblHostsJpaController.findByName(anyString())).thenReturn(mockFindByName());
    when(tblTaLogJpaController.findLastStatusTs(any(Integer.class))).thenReturn(new Date());
    List<TblTaLog> taLogs = new ArrayList<TblTaLog>();
    taLogs.add(new TblTaLog(Integer.valueOf(1), 1, 1, "18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", true, new Date()));
    when(tblTaLogJpaController.findLogsByHostId(anyInt(), any(Date.class))).thenReturn(taLogs);
    AttestationReport attestationReport = reportsBO.getAttestationReport(new Hostname(SERVER_NAME), false);
    assertNotNull(attestationReport);
    assertTrue(attestationReport.getPcrLogs().size() > 0);
}
Also used : TblTaLog(com.intel.mtwilson.as.data.TblTaLog) AttestationReport(com.intel.mtwilson.datatypes.AttestationReport) ArrayList(java.util.ArrayList) Hostname(com.intel.mtwilson.util.net.Hostname) Date(java.util.Date) Test(org.junit.Test)

Example 2 with AttestationReport

use of com.intel.mtwilson.datatypes.AttestationReport in project OpenAttestation by OpenAttestation.

the class DemoPortalServicesImpl method getFailureReportData.

/**
	 * This method is used to get failure report for Host. 
	 * 
	 * @param hostName
	 * @param attestationService
	 * @return
	 * @throws DemoPortalException
	 * @throws Exception
	 */
@Override
public List<PcrLogReport> getFailureReportData(String hostName, ApiClient attestationService) throws Exception {
    log.info("DemoPortalServicesImpl.getFailureReportData >>");
    AttestationReport report;
    try {
        report = attestationService.getAttestationReport(new Hostname(hostName));
    } catch (Exception e) {
        log.error(e.getMessage());
        throw ConnectionUtil.handleException(e);
    }
    return report.getPcrLogs();
}
Also used : AttestationReport(com.intel.mtwilson.datatypes.AttestationReport) Hostname(com.intel.mtwilson.util.net.Hostname) ApiException(com.intel.mtwilson.ApiException) SignatureException(java.security.SignatureException) IOException(java.io.IOException) DemoPortalException(com.intel.mountwilson.common.DemoPortalException)

Aggregations

AttestationReport (com.intel.mtwilson.datatypes.AttestationReport)2 Hostname (com.intel.mtwilson.util.net.Hostname)2 DemoPortalException (com.intel.mountwilson.common.DemoPortalException)1 ApiException (com.intel.mtwilson.ApiException)1 TblTaLog (com.intel.mtwilson.as.data.TblTaLog)1 IOException (java.io.IOException)1 SignatureException (java.security.SignatureException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Test (org.junit.Test)1