コード例 #1
0
ファイル: QLicenseDAOTest.java プロジェクト: nagyist/openolat
 @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));
 }
コード例 #2
0
ファイル: QLicenseDAOTest.java プロジェクト: nagyist/openolat
 @Test
 public void testCreate() {
   String licenseKey = "mit-license-" + UUID.randomUUID().toString();
   QLicense license = qpoolLicenseDao.create(licenseKey, null, true);
   dbInstance.commit();
   // check
   Assert.assertNotNull(license);
   Assert.assertNotNull(license.getKey());
   Assert.assertNotNull(license.getCreationDate());
   Assert.assertEquals(licenseKey, license.getLicenseKey());
   Assert.assertTrue(license.isDeletable());
 }
コード例 #3
0
ファイル: QLicenseDAOTest.java プロジェクト: nagyist/openolat
 @Test
 public void testCreateAndGet_byLicenseKey() {
   String licenseKey = "apache-license-" + UUID.randomUUID().toString();
   QLicense license = qpoolLicenseDao.create(licenseKey, null, true);
   dbInstance.commit();
   // load it
   QLicense reloadedLicense = qpoolLicenseDao.loadByLicenseKey(licenseKey);
   // check the values
   Assert.assertNotNull(reloadedLicense);
   Assert.assertEquals(license.getKey(), reloadedLicense.getKey());
   Assert.assertNotNull(reloadedLicense.getCreationDate());
   Assert.assertEquals(licenseKey, reloadedLicense.getLicenseKey());
   Assert.assertTrue(reloadedLicense.isDeletable());
 }
コード例 #4
0
ファイル: QLicenseDAOTest.java プロジェクト: nagyist/openolat
  @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));
  }