use of com.intel.mtwilson.as.data.TblTaLog in project OpenAttestation by OpenAttestation.
the class HostBOTest method testDeleteHost.
@Test
public void testDeleteHost() throws CryptographyException {
List<TblTaLog> taLogs = new ArrayList<TblTaLog>();
taLogs.add(new TblTaLog(1));
taLogs.add(new TblTaLog(2));
when(taLogJpaController.findLogsByHostId(anyInt(), any(Date.class))).thenReturn(taLogs);
doReturn(new TblHosts(1)).when(hostBO).getHostByName(new Hostname(SERVER_NAME));
String response = hostBO.deleteHost(new Hostname(SERVER_NAME));
assertTrue(response.equalsIgnoreCase("true"));
}
use of com.intel.mtwilson.as.data.TblTaLog in project OpenAttestation by OpenAttestation.
the class HostTrustBO method logTrustStatus.
private void logTrustStatus(TblHosts host, TblMle mle, IManifest manifest) {
Date today = new Date(System.currentTimeMillis());
PcrManifest pcrManifest = (PcrManifest) manifest;
TblTaLog taLog = new TblTaLog();
taLog.setHostID(host.getId());
taLog.setMleId(mle.getId());
taLog.setManifestName(String.valueOf(pcrManifest.getPcrNumber()));
taLog.setManifestValue(pcrManifest.getPcrValue());
taLog.setTrustStatus(pcrManifest.getVerifyStatus());
taLog.setUpdatedOn(today);
getTblTaLogJpaController().create(taLog);
}
use of com.intel.mtwilson.as.data.TblTaLog in project OpenAttestation by OpenAttestation.
the class TblTaLogJpaController method findLastStatusTs.
public Date findLastStatusTs(Integer hostId) {
Date lastUpdateTs = null;
EntityManager em = getEntityManager();
try {
Query query = em.createNamedQuery("TblTaLog.findLastStatusTs");
query.setParameter("hostID", hostId);
query.setMaxResults(1);
List<TblTaLog> logs = query.getResultList();
if (logs != null && logs.size() == 1)
lastUpdateTs = logs.get(0).getUpdatedOn();
} finally {
em.close();
}
return lastUpdateTs;
}
use of com.intel.mtwilson.as.data.TblTaLog in project OpenAttestation by OpenAttestation.
the class TblTaLogJpaController method findLogsByHostId.
public List<TblTaLog> findLogsByHostId(int hostId) {
EntityManager em = getEntityManager();
try {
Query query = em.createNamedQuery("TblTaLog.findLogsByHostId2");
query.setParameter("hostID", hostId);
List<TblTaLog> logs = query.getResultList();
return logs;
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.data.TblTaLog in project OpenAttestation by OpenAttestation.
the class TblTaLogJpaController method findTrustStatusByHostId.
// Custom find methods
public List<TblTaLog> findTrustStatusByHostId(int hostId, int maxresults) {
EntityManager em = getEntityManager();
try {
Query query = em.createNamedQuery("TblTaLog.findTrustStatusByHostId");
query.setParameter("hostID", hostId);
query.setMaxResults(maxresults);
List<TblTaLog> logs = query.getResultList();
return logs;
} finally {
em.close();
}
}
Aggregations