@Test public void testUeberCertIsRegeneratedOnNextInvocation() throws Exception { EntitlementCertificate firstCert = or.createUeberCertificate(principal, owner.getKey()); Product firstProduct = productCurator.lookupByName(owner, owner.getKey() + UEBER_PRODUCT); EntitlementCertificate secondCert = or.createUeberCertificate(principal, owner.getKey()); Product secondProduct = productCurator.lookupByName(owner, owner.getKey() + UEBER_PRODUCT); // make sure we didn't regenerate the whole thing assertTrue(firstProduct.getUuid() == secondProduct.getUuid()); // only the ueber cert assertFalse(firstCert.getId() == secondCert.getId()); }
@Test(expected = NotFoundException.class) public void certificateRetrievalRaisesExceptionIfNoCertificateWasGenerated() throws Exception { // generate certificate for one owner or.createUeberCertificate(principal, owner.getKey()); // verify that owner under test doesn't have a certificate Owner anotherOwner = ownerCurator.create(new Owner(OWNER_NAME + "1")); or.getUeberCertificate(principal, anotherOwner.getKey()); }
@Test public void certificateRetrievalReturnsCert() { EntitlementCertificate cert = or.createUeberCertificate(principal, owner.getKey()); assertNotNull(cert); }
@Test(expected = NotFoundException.class) public void certificateGenerationRaisesExceptionIfOwnerNotFound() throws Exception { or.createUeberCertificate(principal, "non-existant"); }
@Test public void testUeberEntitlementIsGenerated() throws Exception { or.createUeberCertificate(principal, owner.getKey()); assertNotNull(poolCurator.findUeberPool(owner)); }
@Test public void testUeberConsumerIsCreated() throws Exception { or.createUeberCertificate(principal, owner.getKey()); assertNotNull(consumerCurator.findByName(owner, "ueber_cert_consumer")); }
@Test public void testUeberProductIsCreated() throws Exception { or.createUeberCertificate(principal, owner.getKey()); assertNotNull(productCurator.lookupByName(owner, owner.getKey() + UEBER_PRODUCT)); }