Esempio n. 1
0
 @Test
 public void testGetItemLevels() {
   String licenseKey = "gnu-" + UUID.randomUUID().toString();
   QLicense license = qpoolLicenseDao.create(licenseKey, null, true);
   dbInstance.commit();
   // load it
   List<QLicense> allLicenses = qpoolLicenseDao.getLicenses();
   // check the values
   Assert.assertNotNull(allLicenses);
   Assert.assertTrue(allLicenses.contains(license));
 }
Esempio n. 2
0
  @Test
  public void testDelete_deletable() {
    String licenseKey = "gpl-" + UUID.randomUUID().toString();
    QLicense license = qpoolLicenseDao.create(licenseKey, null, true);
    dbInstance.commitAndCloseSession();

    // delete it
    boolean deleted = qpoolLicenseDao.delete(license);
    dbInstance.commitAndCloseSession();
    Assert.assertTrue(deleted);

    // check that the type is really, really deleted
    QLicense reloadedLicense = qpoolLicenseDao.loadById(license.getKey());
    Assert.assertNull(reloadedLicense);
    List<QLicense> licenses = qpoolLicenseDao.getLicenses();
    Assert.assertFalse(licenses.contains(license));
  }