MleBO { public String updateMle(MleData mleData, String mleUuid) { TblMle tblMle; try { if (mleUuid != null && !mleUuid.isEmpty()) { tblMle = mleJpaController.findTblMleByUUID(mleUuid); } else { tblMle = getMleDetails(mleData.getName(), mleData.getVersion(), mleData.getOsName(), mleData.getOsVersion(), mleData.getOemName()); } if (tblMle == null) { throw new ASException(ErrorCode.WS_MLE_DOES_NOT_EXIST, mleData.getName(), mleData.getVersion()); } setTblMle(tblMle, mleData); mleJpaController.edit(tblMle); if (mleData.getManifestList() != null) updatePcrManifest(tblMle, mleData); } catch (ASException ase) { throw ase; } catch (Exception e) { log.error("Error during MLE update.", e); throw new ASException(ErrorCode.WS_MLE_UPDATE_ERROR, e.getClass().getSimpleName()); } return "true"; } MleBO(); String addMLe(MleData mleData, String mleUuid); String updateMle(MleData mleData, String mleUuid); String deleteMle(String mleName, String mleVersion, String osName, String osVersion, String oemName, String mleUuid); List<MleData> listMles(String searchCriteria); MleData findMle(String mleName, String mleVersion, String osName, String osVersion, String oemName); MleData createMleDataFromDatabaseRecord(TblMle tblMle, boolean addManifest); String addPCRWhiteList(PCRWhiteList pcrData); String addPCRWhiteList(PCRWhiteList pcrData, EntityManager em, String uuid, String mleUuid); String updatePCRWhiteList(PCRWhiteList pcrData); String updatePCRWhiteList(PCRWhiteList pcrData, EntityManager em, String uuid); String deletePCRWhiteList(String pcrName, String algorithmBank, String mleName, String mleVersion, String osName, String osVersion, String oemName, String pcrUuid); String addModuleWhiteList(ModuleWhiteList moduleData); String addModuleWhiteList(ModuleWhiteList moduleData, EntityManager em, String uuid, String mleUuid); String updateModuleWhiteList(ModuleWhiteList moduleData); String updateModuleWhiteList(ModuleWhiteList moduleData, EntityManager em, String uuid); String deleteModuleWhiteList(String componentName, String eventName, String pcrBank, String mleName, String mleVersion,
            String osName, String osVersion, String oemName, String uuid); List<ModuleWhiteList> getModuleWhiteList(String mleName, String mleVersion,
            String osName, String osVersion, String oemName); String addMleSource(MleSource mleSourceObj, String uuid, String mleUuid); String updateMleSource(MleSource mleSourceObj, String mleUuid); String deleteMleSource(String mleName, String mleVersion, String osName, String osVersion, String oemName, String mleUuid); String getMleSource(String mleName, String mleVersion, String osName, String osVersion, String oemName);  }
@Test public void testUpdateMle() { MleData vmm = getVmmMle(); System.out.println("updateMle"); MleBO instance = new MleBO(); String expResult = "true"; try { MleData originalRecord = instance.findMle(vmm.getName(), vmm.getVersion(), vmm.getOsName(), vmm.getOsVersion(), null); System.out.println("MLE already in database: "+originalRecord.getName()); } catch(Exception e) { instance.addMLe(vmm, null); } String updatedDescription = vmm.getDescription() + "updated " + rnd.nextInt(99); vmm.setDescription(updatedDescription); String result = instance.updateMle(vmm, null); assertEquals(expResult, result); MleData updatedRecord = instance.findMle(vmm.getName(), vmm.getVersion(), vmm.getOsName(), vmm.getOsVersion(), null); assertTrue(updatedRecord.getDescription() != null && updatedRecord.getDescription().equals(updatedDescription)); }