Package org.candlepin.model

Examples of org.candlepin.model.ProductCertificate


        subProvidedProduct.setCreated(new Date());
        subProvidedProduct.setUpdated(new Date());
        subProvidedProduct.setHref("http://localhost");
        subProvidedProduct.setAttributes(Collections.EMPTY_SET);

        ProductCertificate pcert = new ProductCertificate();
        pcert.setKey("euh0876puhapodifbvj094");
        pcert.setCert("hpj-08ha-w4gpoknpon*)&^%#");
        pcert.setCreated(new Date());
        pcert.setUpdated(new Date());

        when(pp.getProductId()).thenReturn("12345");
        when(pool.getProvidedProducts()).thenReturn(ppset);
        when(pool.getProductId()).thenReturn("MKT-prod");

View Full Code Here


    }

    @Override
    public void deleteProduct(Product product) {
        // clean up any product certificates
        ProductCertificate cert = prodCertCurator.findForProduct(product);
        if (cert != null) {
            prodCertCurator.delete(cert);
        }
        prodCurator.delete(product);
    }
View Full Code Here

        prodCurator.delete(product);
    }

    @Override
    public ProductCertificate getProductCertificate(Product product) {
        ProductCertificate cert = this.prodCertCurator.findForProduct(product);

        if (cert == null) {
            // TODO: Do something better with these exceptions!
            try {
                cert = createForProduct(product);
View Full Code Here

        X509Certificate x509Cert = this.pki.createX509Certificate("CN=" +
            product.getId(), extensions, null, new Date(), future.getTime(), keyPair,
            serial, null);

        ProductCertificate cert = new ProductCertificate();
        cert.setKeyAsBytes(pki.getPemEncoded(keyPair.getPrivate()));
        cert.setCertAsBytes(this.pki.getPemEncoded(x509Cert));
        cert.setProduct(product);

        return cert;
    }
View Full Code Here

        assertNull(productCertificateCurator.findForProduct(null));
    }

    @Test
    public void validFindForProduct() {
        ProductCertificate cert = new ProductCertificate();
        cert.setProduct(product);
        cert.setKey("key");
        cert.setCert("cert");

        productCertificateCurator.create(cert);

        assertEquals(cert, productCertificateCurator.findForProduct(product));
    }
View Full Code Here

    }

    @Test
    public void deleteProductWithCerts() {
        Product p = mock(Product.class);
        ProductCertificate cert = mock(ProductCertificate.class);
        when(pcc.findForProduct((eq(p)))).thenReturn(cert);
        dpsa.deleteProduct(p);
        verify(pcc).delete(eq(cert));
        verify(pc).delete(eq(p));
    }
View Full Code Here

    }

    @Test
    public void productCertificateExists() {
        Product p = mock(Product.class);
        ProductCertificate cert = mock(ProductCertificate.class);
        when(pcc.findForProduct((eq(p)))).thenReturn(cert);
        ProductCertificate result = dpsa.getProductCertificate(p);
        verify(pcc, never()).create(eq(cert));
        assertEquals(cert, result);
    }
View Full Code Here

        when(p.getId()).thenReturn(someid);
        when(pcc.findForProduct((eq(p)))).thenReturn(null);
        KeyPair kp = createKeyPair();
        when(pki.generateNewKeyPair()).thenReturn(kp);
        when(pki.getPemEncoded(any(Key.class))).thenReturn("junk".getBytes());
        ProductCertificate result = dpsa.getProductCertificate(p);
        assertNotNull(result);
        assertEquals(p, result.getProduct());
    }
View Full Code Here

        return new ProductCertCreationModule();
    }

    @Test
    public void hasCert() {
        ProductCertificate cert = createDummyCert();

        Assert.assertTrue(cert.getCert().length() > 0);
    }
View Full Code Here

        Assert.assertTrue(cert.getCert().length() > 0);
    }

    @Test
    public void hasKey() {
        ProductCertificate cert = createDummyCert();

        Assert.assertTrue(cert.getKey().length() > 0);
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.ProductCertificate

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.