Search in sources :

Example 1 with OsData

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

the class ConverterUtil method getListToOSDataVO.

/**
	 * Method convert OS List from Api CLient into List OS OSDataVO.
	 * 
	 * @param osListFromApiClient
	 * @return
	 */
public static List<OSDataVO> getListToOSDataVO(List<OsData> osListFromApiClient) {
    List<OSDataVO> list = new ArrayList<OSDataVO>();
    for (OsData data : osListFromApiClient) {
        OSDataVO osVo = new OSDataVO();
        osVo.setOsName(data.getName());
        osVo.setOsVersion(data.getVersion());
        osVo.setOsDescription(data.getDescription());
        list.add(osVo);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) OsData(com.intel.mtwilson.datatypes.OsData) OSDataVO(com.intel.mountwilson.datamodel.OSDataVO)

Example 2 with OsData

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

the class OsBOTest method testUpdateOs.

@Test
public void testUpdateOs() {
    TblOs tblOs = new TblOs(OS_ID1, "Fedora", "20");
    doReturn(tblOs).when(tblOsJpaController).findTblOsByNameVersion(anyString(), anyString());
    OsData osData = new OsData("Fedora", "20", "");
    String result = osBO.updateOs(osData);
    assertEquals("true", result);
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) OsData(com.intel.mtwilson.datatypes.OsData) TblOs(com.intel.mtwilson.as.data.TblOs) Test(org.junit.Test)

Example 3 with OsData

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

the class OsBOTest method testCreateOs.

@Test
public void testCreateOs() {
    TblOs tblOs = null;
    doReturn(tblOs).when(tblOsJpaController).findTblOsByNameVersion(anyString(), anyString());
    OsData osData = new OsData("Fedora", "20", "");
    String result = osBO.createOs(osData);
    assertEquals("true", result);
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) OsData(com.intel.mtwilson.datatypes.OsData) TblOs(com.intel.mtwilson.as.data.TblOs) Test(org.junit.Test)

Example 4 with OsData

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

the class OsBO method getAllOs.

/**
     * 
     * @return 
     */
public List<OsData> getAllOs() {
    List<OsData> allOsData = new ArrayList<OsData>();
    try {
        List<TblOs> allRecords = tblOsJpaController.findTblOsEntities();
        for (TblOs tblOs : allRecords) {
            OsData osData = new OsData(tblOs.getName(), tblOs.getVersion(), tblOs.getDescription());
            allOsData.add(osData);
        }
    } catch (ASException ase) {
        throw ase;
    } catch (Exception e) {
        throw new ASException(e);
    }
    return allOsData;
}
Also used : ArrayList(java.util.ArrayList) OsData(com.intel.mtwilson.datatypes.OsData) ASException(com.intel.mountwilson.as.common.ASException) ASException(com.intel.mountwilson.as.common.ASException) TblOs(com.intel.mtwilson.as.data.TblOs)

Example 5 with OsData

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

the class OsBOTest method testGetAllOs.

@Test
public void testGetAllOs() {
    List<TblOs> allRecords = new ArrayList<TblOs>();
    TblOs tblOs1 = new TblOs(OS_ID1, "Fedora", "20");
    TblOs tblOs2 = new TblOs(OS_ID2, "Fedora", "19");
    allRecords.add(tblOs1);
    allRecords.add(tblOs2);
    doReturn(allRecords).when(tblOsJpaController).findTblOsEntities();
    List<OsData> allData = osBO.getAllOs();
    assertNotNull(allData);
    assertEquals(2, allData.size());
}
Also used : ArrayList(java.util.ArrayList) OsData(com.intel.mtwilson.datatypes.OsData) TblOs(com.intel.mtwilson.as.data.TblOs) Test(org.junit.Test)

Aggregations

OsData (com.intel.mtwilson.datatypes.OsData)5 TblOs (com.intel.mtwilson.as.data.TblOs)4 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 Matchers.anyString (org.mockito.Matchers.anyString)2 ASException (com.intel.mountwilson.as.common.ASException)1 OSDataVO (com.intel.mountwilson.datamodel.OSDataVO)1