@Test public void getAppIdOfNonExistingVmReturnsEmptyString() { assertEquals("", db.getAppIdOfVm("vmId1")); }
@Override public String getAppIdOfVm(String vmId) { List<String> appId = new ArrayList<>(); try { appId = query("SELECT appId FROM virtual_machines WHERE id = '" + vmId + "'"); } catch (SQLException e) { appId.add(""); } if (appId.isEmpty()) { appId.add(""); } return appId.get(0); }
VmManagerDbHsql implements VmManagerDb { @Override public String getAppIdOfVm(String vmId) { List<String> appId = new ArrayList<>(); try { appId = query("SELECT appId FROM virtual_machines WHERE id = '" + vmId + "'"); } catch (SQLException e) { appId.add(""); } if (appId.isEmpty()) { appId.add(""); } return appId.get(0); } }
VmManagerDbHsql implements VmManagerDb { @Override public String getAppIdOfVm(String vmId) { List<String> appId = new ArrayList<>(); try { appId = query("SELECT appId FROM virtual_machines WHERE id = '" + vmId + "'"); } catch (SQLException e) { appId.add(""); } if (appId.isEmpty()) { appId.add(""); } return appId.get(0); } VmManagerDbHsql(String dbFileNamePrefix); }
VmManagerDbHsql implements VmManagerDb { @Override public String getAppIdOfVm(String vmId) { List<String> appId = new ArrayList<>(); try { appId = query("SELECT appId FROM virtual_machines WHERE id = '" + vmId + "'"); } catch (SQLException e) { appId.add(""); } if (appId.isEmpty()) { appId.add(""); } return appId.get(0); } VmManagerDbHsql(String dbFileNamePrefix); @Override void closeConnection(); void cleanDb(); @Override void insertVm(String vmId, String appId, String ovfId, String slaId); @Override void deleteVm(String vmId); @Override void deleteAllVms(); @Override String getAppIdOfVm(String vmId); @Override String getOvfIdOfVm(String vmId); @Override String getSlaIdOfVm(String vmId); @Override List<String> getAllVmIds(); @Override List<String> getVmsOfApp(String appId); @Override SchedAlgorithmNameEnum getCurrentSchedulingAlg(); @Override void setCurrentSchedulingAlg(SchedAlgorithmNameEnum alg); @Override void saveSelfAdaptationOptions(SelfAdaptationOptions options); @Override SelfAdaptationOptions getSelfAdaptationOptions(); }
VmManagerDbHsql implements VmManagerDb { @Override public String getAppIdOfVm(String vmId) { List<String> appId = new ArrayList<>(); try { appId = query("SELECT appId FROM virtual_machines WHERE id = '" + vmId + "'"); } catch (SQLException e) { appId.add(""); } if (appId.isEmpty()) { appId.add(""); } return appId.get(0); } VmManagerDbHsql(String dbFileNamePrefix); @Override void closeConnection(); void cleanDb(); @Override void insertVm(String vmId, String appId, String ovfId, String slaId); @Override void deleteVm(String vmId); @Override void deleteAllVms(); @Override String getAppIdOfVm(String vmId); @Override String getOvfIdOfVm(String vmId); @Override String getSlaIdOfVm(String vmId); @Override List<String> getAllVmIds(); @Override List<String> getVmsOfApp(String appId); @Override SchedAlgorithmNameEnum getCurrentSchedulingAlg(); @Override void setCurrentSchedulingAlg(SchedAlgorithmNameEnum alg); @Override void saveSelfAdaptationOptions(SelfAdaptationOptions options); @Override SelfAdaptationOptions getSelfAdaptationOptions();  }