Examples of CertificateSerial


Examples of org.candlepin.model.CertificateSerial

    private IdentityCertificate generate(Consumer consumer)
        throws GeneralSecurityException, IOException {
        Date startDate = new Date();
        Date endDate = this.endDateGenerator.apply(startDate);

        CertificateSerial serial = new CertificateSerial(endDate);
        // We need the sequence generated id before we create the EntitlementCertificate,
        // otherwise we could have used cascading create
        serialCurator.create(serial);

        String dn = createDN(consumer);
        IdentityCertificate identityCert = new IdentityCertificate();
        KeyPair keyPair = keyPairCurator.getConsumerKeyPair(consumer);
        X509Certificate x509cert = pki.createX509Certificate(dn, null, null,
            startDate, endDate, keyPair, BigInteger.valueOf(serial.getId()),
            consumer.getName());

        identityCert.setCert(new String(pki.getPemEncoded(x509cert)));
        identityCert.setKey(new String(pki.getPemEncoded(keyPair.getPrivate())));
        identityCert.setSerial(serial);
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

        when(owner.getId()).thenReturn("test-owner-id");
        when(consumer.getUuid()).thenReturn("test-uuid");
        when(consumer.getOwner()).thenReturn(owner);

        IdentityCertificate idCert = new IdentityCertificate();
        idCert.setSerial(new CertificateSerial());

        importer.store(owner, consumer, new ConflictOverrides(), idCert);

        // now verify that the owner has the upstream consumer set
        ArgumentCaptor<UpstreamConsumer> arg =
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

        when(owner.getUpstreamUuid()).thenReturn("test-uuid");
        when(consumer.getUuid()).thenReturn("test-uuid");
        when(consumer.getOwner()).thenReturn(owner);

        IdentityCertificate idCert = new IdentityCertificate();
        idCert.setSerial(new CertificateSerial());

        importer.store(owner, consumer, new ConflictOverrides(), idCert);

        // now verify that the owner didn't change
        // arg.getValue() returns the Owner being stored
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

        when(owner.getUpstreamUuid()).thenReturn("another-test-uuid");
        when(consumer.getUuid()).thenReturn("test-uuid");
        when(consumer.getOwner()).thenReturn(owner);

        IdentityCertificate idCert = new IdentityCertificate();
        idCert.setSerial(new CertificateSerial());

        importer.store(owner, consumer,
            new ConflictOverrides(Importer.Conflict.DISTRIBUTOR_CONFLICT), idCert);

        // now verify that the owner has the upstream consumer set
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

    }

    protected EntitlementCertificate createEntitlementCertificate(String key,
        String cert) {
        EntitlementCertificate toReturn = new EntitlementCertificate();
        CertificateSerial certSerial = new CertificateSerial(1L, new Date());
        toReturn.setKeyAsBytes(key.getBytes());
        toReturn.setCertAsBytes(cert.getBytes());
        toReturn.setSerial(certSerial);
        return toReturn;
    }
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

    }

    protected EntitlementCertificate createEntitlementCertificate(String key,
        String cert) {
        EntitlementCertificate toReturn = new EntitlementCertificate();
        CertificateSerial certSerial = new CertificateSerial(new Date());
        certSerialCurator.create(certSerial);
        toReturn.setKeyAsBytes(key.getBytes());
        toReturn.setCertAsBytes(cert.getBytes());
        toReturn.setSerial(certSerial);
        return toReturn;
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

        assertEquals(1, sub.getDerivedProvidedProducts().size());
        assertEquals(subProvided1.getProductId(), sub.getDerivedProvidedProducts().
            iterator().next().getId());

        assertNotNull(sub.getCertificate());
        CertificateSerial serial = sub.getCertificate().getSerial();
        assertEquals(cert.getSerial().isCollected(), serial.isCollected());
        assertEquals(cert.getSerial().getExpiration(), serial.getExpiration());
        assertEquals(cert.getSerial().getCreated(), serial.getCreated());
        assertEquals(cert.getSerial().getUpdated(), serial.getUpdated());

        assertEquals(sub.getCdn().getLabel(), meta.getCdnLabel());
    }
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

    }

    protected EntitlementCertificate createEntitlementCertificate(String key,
        String cert) {
        EntitlementCertificate toReturn = new EntitlementCertificate();
        CertificateSerial certSerial = new CertificateSerial(new Date());
        certSerial.setCollected(true);
        certSerial.setUpdated(new Date());
        certSerial.setCreated(new Date());
        toReturn.setKeyAsBytes(key.getBytes());
        toReturn.setCertAsBytes(cert.getBytes());
        toReturn.setSerial(certSerial);
        return toReturn;
    }
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

        when(idcur.find(consumer.getId())).thenReturn(null);
        when(csc.create(any(CertificateSerial.class))).thenAnswer(
            new Answer<CertificateSerial>() {
                public CertificateSerial answer(InvocationOnMock invocation) {
                    Object[] args = invocation.getArguments();
                    CertificateSerial cs = (CertificateSerial) args[0];
                    cs.setId(42L);
                    return cs;
                }
            });

        when(pki.getPemEncoded(any(X509Certificate.class))).thenReturn(
View Full Code Here

Examples of org.candlepin.model.CertificateSerial

        when(kpc.getConsumerKeyPair(consumer)).thenReturn(kp);
        when(csc.create(any(CertificateSerial.class))).thenAnswer(
            new Answer<CertificateSerial>() {
                public CertificateSerial answer(InvocationOnMock invocation) {
                    Object[] args = invocation.getArguments();
                    CertificateSerial cs = (CertificateSerial) args[0];
                    cs.setId(42L);
                    return cs;
                }
            });

        when(pki.getPemEncoded(any(X509Certificate.class))).thenReturn(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.