Package org.candlepin.model

Examples of org.candlepin.model.SubscriptionsCertificate


    protected SubscriptionsCertificate createSubCert(String key, String cert) {
        return createSubCert(key, cert, new Date());
    }

    protected SubscriptionsCertificate createSubCert(String key, String cert, Date dt) {
        SubscriptionsCertificate sc = new SubscriptionsCertificate();
        CertificateSerial ser = new CertificateSerial(dt);
        certSerialCurator.create(ser);
        sc.setCert(cert);
        sc.setKey(key);
        sc.setSerial(ser);
        return sc;
    }
View Full Code Here


    }

    @Test
    public void testLookup() throws Exception {

        SubscriptionsCertificate certificate = createSubCert("key", "cert");
        certificateCurator.create(certificate);
        SubscriptionsCertificate lookedUp = certificateCurator.find(certificate
            .getId());

        assertNotNull(lookedUp);
        assertEquals(certificate.getId(), lookedUp.getId());
        assertEquals(certificate.getKey(), lookedUp.getKey());
        assertEquals(certificate.getCert(), lookedUp.getCert());
        assertEquals(certificate.getSerial(), lookedUp.getSerial());
    }
View Full Code Here

    }

    @Test
    public void createDuplicateCertSameOwnerThrowsException() throws Exception {
        Date now = new Date();
        SubscriptionsCertificate certificate1 = createSubCert("not a cert", "booya", now);
        SubscriptionsCertificate certificate2 = createSubCert("not a cert", "booya", now);

        certificateCurator.create(certificate1);
        certificateCurator.create(certificate2);
    }
View Full Code Here

            cs.setCollected(cert.getSerial().isCollected());
            cs.setExpiration(cert.getSerial().getExpiration());
            cs.setUpdated(cert.getSerial().getUpdated());
            cs.setCreated(cert.getSerial().getCreated());
            csCurator.create(cs);
            SubscriptionsCertificate sc = new SubscriptionsCertificate();
            sc.setKey(cert.getKey());
            sc.setCertAsBytes(cert.getCertAsBytes());
            sc.setSerial(cs);
            subscription.setCertificate(sc);
        }

        if (entcnt > 1) {
            log.error("More than one entitlement cert found for subscription");
View Full Code Here

    // cpc passes up content-type on all calls, make sure we don't 415 it
    @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    @Produces({ MediaType.TEXT_PLAIN })
    public String getSubCertAsPem(
        @PathParam("subscription_id") String subscriptionId) {
        SubscriptionsCertificate subCert = getSubCertWorker(subscriptionId);
        log.debug("get as pem");
        return subCert.getCert() + subCert.getKey();
    }
View Full Code Here

    @Path("{subscription_id}/cert")
    @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    @Produces({ MediaType.APPLICATION_JSON})
    public SubscriptionsCertificate getSubCert(
        @PathParam("subscription_id") String subscriptionId) {
        SubscriptionsCertificate subCert = getSubCertWorker(subscriptionId);
        return subCert;
    }
View Full Code Here

        return subCert;
    }

    private SubscriptionsCertificate getSubCertWorker(String subscriptionId) {
        Subscription sub = verifyAndFind(subscriptionId);
        SubscriptionsCertificate subCert = sub.getCertificate();
        if (subCert == null) {
            throw new BadRequestException(
                i18n.tr("no certificate for subscription {0}", subscriptionId));
        }
        return subCert;
View Full Code Here

TOP

Related Classes of org.candlepin.model.SubscriptionsCertificate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.