use of com.intel.mtwilson.as.data.TblOs in project OpenAttestation by OpenAttestation.
the class TblOsJpaControllerTest method testDestroy.
@Test
public void testDestroy() throws NonexistentEntityException {
TblOs tblOs = new TblOs(OS_ID, "Fedora", "20");
doReturn(tblOs).when(em).getReference(TblOs.class, OS_ID);
tblOsJpaController.destroy(OS_ID);
verify(em).remove(tblOs);
verify(em).close();
verify(transaction).begin();
verify(transaction).commit();
}
use of com.intel.mtwilson.as.data.TblOs in project OpenAttestation by OpenAttestation.
the class TblOsJpaControllerTest method testCreate.
@Test
public void testCreate() {
TblOs tblOs = new TblOs(OS_ID, "Fedora", "20");
tblOsJpaController.create(tblOs);
verify(em).persist(tblOs);
verify(em).close();
verify(transaction).begin();
verify(transaction).commit();
}
use of com.intel.mtwilson.as.data.TblOs in project OpenAttestation by OpenAttestation.
the class TblOsJpaController method getTblOsCount.
public int getTblOsCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<TblOs> rt = cq.from(TblOs.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.data.TblOs in project OpenAttestation by OpenAttestation.
the class TblOsJpaController method findTblOsByNameVersion.
public TblOs findTblOsByNameVersion(String name, String version) {
EntityManager em = getEntityManager();
try {
Query query = em.createNamedQuery("TblOs.findTblOsByNameVersion");
query.setParameter("name", name);
query.setParameter("version", version);
query.setHint(QueryHints.REFRESH, HintValues.TRUE);
query.setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache);
TblOs tblOs = (TblOs) query.getSingleResult();
return tblOs;
} catch (NoResultException e) {
return null;
} finally {
em.close();
}
}
use of com.intel.mtwilson.as.data.TblOs in project OpenAttestation by OpenAttestation.
the class HostBOTest method mockGetHost.
public TblHosts mockGetHost() {
TblHosts tblHosts = new TblHosts();
tblHosts.setId(1);
tblHosts.setName(SERVER_NAME);
tblHosts.setIPAddress(SERVER_NAME);
String biosName = "DELL";
String biosVersion = "A08";
String oemName = "DELL";
TblMle biosMle = new TblMle();
biosMle.setId(1);
biosMle.setName(biosName);
biosMle.setVersion(biosVersion);
TblOem oem = new TblOem();
oem.setId(1);
oem.setName(oemName);
biosMle.setOemId(oem);
Collection<TblPcrManifest> tblPcrManifestCollection = new ArrayList<TblPcrManifest>();
TblPcrManifest tblPcrManifest = new TblPcrManifest();
tblPcrManifest.setId(1);
tblPcrManifest.setName("0");
tblPcrManifest.setValue("31B97D97B4679917EC3C1D943635693FFBAB4143");
tblPcrManifestCollection.add(tblPcrManifest);
biosMle.setTblPcrManifestCollection(tblPcrManifestCollection);
tblHosts.setBiosMleId(biosMle);
String vmmName = "XEN";
String vmmVersion = "4.3";
String osName = "Fedora";
String osVersion = "20";
TblMle vmmMle = new TblMle();
vmmMle.setId(1);
vmmMle.setName(vmmName);
vmmMle.setVersion(vmmVersion);
TblOs os = new TblOs();
os.setId(1);
os.setName(osName);
os.setVersion(osVersion);
vmmMle.setOsId(os);
Collection<TblPcrManifest> tblPcrManifestCollectionVMM = new ArrayList<TblPcrManifest>();
TblPcrManifest tblPcrManifestVMM = new TblPcrManifest();
tblPcrManifestVMM.setId(2);
tblPcrManifestVMM.setName("18");
tblPcrManifestVMM.setValue("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
tblPcrManifestCollection.add(tblPcrManifestVMM);
vmmMle.setTblPcrManifestCollection(tblPcrManifestCollectionVMM);
tblHosts.setVmmMleId(vmmMle);
tblHosts.setTlsPolicyName("");
tblHosts.setPort(8181);
return tblHosts;
}
Aggregations