Search in sources :

Example 1 with PCRWhiteList

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

the class MleBOTest method testAddPCRWhiteList.

@Test
public void testAddPCRWhiteList() {
    PCRWhiteList biosPcrData = new PCRWhiteList("0", "31B97D97B4679917EC3C1D943635693FFBAB4143", "DELL", "A08", "", "", "DELL");
    PCRWhiteList vmmPcrData = new PCRWhiteList("18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "XEN", "4.3", "Fedora", "20", "");
    doReturn(new TblMle(MLE_ID1, "DELL", "A08", "PCR", "BIOS", "0")).when(tblMleJpaController).findBiosMle(biosPcrData.getMleName(), biosPcrData.getMleVersion(), biosPcrData.getOemName());
    doReturn(new TblMle(MLE_ID2, "XEN", "4.3", "PCR", "VMM", "18")).when(tblMleJpaController).findVmmMle(vmmPcrData.getMleName(), vmmPcrData.getMleVersion(), vmmPcrData.getOsName(), vmmPcrData.getOsVersion());
    doReturn(null).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID1, biosPcrData.getPcrName());
    doReturn(null).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID2, vmmPcrData.getPcrName());
    String biosResult = mleBO.addPCRWhiteList(biosPcrData);
    assertEquals("true", biosResult);
    String vmmResult = mleBO.addPCRWhiteList(vmmPcrData);
    assertEquals("true", vmmResult);
}
Also used : TblMle(com.intel.mtwilson.as.data.TblMle) Matchers.anyString(org.mockito.Matchers.anyString) PCRWhiteList(com.intel.mtwilson.datatypes.PCRWhiteList) Test(org.junit.Test)

Example 2 with PCRWhiteList

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

the class MleBOTest method testUpdatePCRWhiteList.

@Test
public void testUpdatePCRWhiteList() {
    PCRWhiteList biosPcrData = new PCRWhiteList("0", "31B97D97B4679917EC3C1D943635693FFBAB4143", "DELL", "A08", "", "", "DELL");
    PCRWhiteList vmmPcrData = new PCRWhiteList("18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "XEN", "4.3", "Fedora", "20", "");
    doReturn(new TblMle(MLE_ID1, "DELL", "A08", "PCR", "BIOS", "0")).when(tblMleJpaController).findBiosMle(biosPcrData.getMleName(), biosPcrData.getMleVersion(), biosPcrData.getOemName());
    doReturn(new TblMle(MLE_ID2, "XEN", "4.3", "PCR", "VMM", "18")).when(tblMleJpaController).findVmmMle(vmmPcrData.getMleName(), vmmPcrData.getMleVersion(), vmmPcrData.getOsName(), vmmPcrData.getOsVersion());
    doReturn(new TblPcrManifest(PcrManifest_ID1, biosPcrData.getPcrName(), biosPcrData.getPcrDigest())).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID1, biosPcrData.getPcrName());
    doReturn(new TblPcrManifest(PcrManifest_ID2, vmmPcrData.getPcrName(), vmmPcrData.getPcrDigest())).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID2, vmmPcrData.getPcrName());
    String biosResult = mleBO.updatePCRWhiteList(biosPcrData);
    assertEquals("true", biosResult);
    String vmmResult = mleBO.updatePCRWhiteList(vmmPcrData);
    assertEquals("true", vmmResult);
}
Also used : TblMle(com.intel.mtwilson.as.data.TblMle) Matchers.anyString(org.mockito.Matchers.anyString) PCRWhiteList(com.intel.mtwilson.datatypes.PCRWhiteList) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) Test(org.junit.Test)

Aggregations

TblMle (com.intel.mtwilson.as.data.TblMle)2 PCRWhiteList (com.intel.mtwilson.datatypes.PCRWhiteList)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 TblPcrManifest (com.intel.mtwilson.as.data.TblPcrManifest)1