Package org.candlepin.model

Examples of org.candlepin.model.ConsumerCapability


    public void preEntitlementSuccessCoreCapable() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("cpu.core(s)_per_socket", "2");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        ConsumerCapability cc = new ConsumerCapability(c, "cores");
        caps.add(cc);
        c.setCapabilities(caps);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
View Full Code Here


    public void preEntitlementSuccessRamCapable() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        c.setFact("memory.memtotal", "2000000");
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        ConsumerCapability cc = new ConsumerCapability(c, "ram");
        caps.add(cc);
        c.setCapabilities(caps);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
View Full Code Here

    @Test
    public void preEntitlementSuccessInstanceCapable() {
        // Test with sockets to make sure that they are skipped.
        Consumer c = TestUtil.createConsumer();
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        ConsumerCapability cc = new ConsumerCapability(c, "instance_multiplier");
        caps.add(cc);
        c.setCapabilities(caps);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
View Full Code Here

    @Test
    public void preEntitlementWithDerivedProductCapabilitySuccessOnBind() {
        Consumer c = TestUtil.createConsumer();
        HashSet<ConsumerCapability> capabilities = new HashSet<ConsumerCapability>();
        capabilities.add(new ConsumerCapability(c, "derived_product"));
        c.setCapabilities(capabilities);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
View Full Code Here

    @Test
    public void preEntitlementWithDerivedProductCapabilitySuccessOnBestPools() {
        Consumer c = TestUtil.createConsumer();
        HashSet<ConsumerCapability> capabilities = new HashSet<ConsumerCapability>();
        capabilities.add(new ConsumerCapability(c, "derived_product"));
        c.setCapabilities(capabilities);
        c.getType().setManifest(true);

        Product prod = TestUtil.createProduct();
        Pool p = TestUtil.createPool(prod);
View Full Code Here

        when(consumer.getType()).thenReturn(
            new ConsumerType(ConsumerType.ConsumerTypeEnum.CANDLEPIN));

        Set<ConsumerCapability> set = new HashSet<ConsumerCapability>();
        set.add(new ConsumerCapability(consumer, "cert_v3"));
        when(consumer.getCapabilities()).thenReturn(set);

        X509V3ExtensionUtil mockV3extensionUtil = mock(X509V3ExtensionUtil.class);
        X509ExtensionUtil mockExtensionUtil = mock(X509ExtensionUtil.class);
View Full Code Here

    @Test
    public void consumerCapabilityUpdate() {
        Consumer c = getFakeConsumer();
        Set<ConsumerCapability> caps = new HashSet<ConsumerCapability>();
        ConsumerCapability cca = new ConsumerCapability(c, "capability_a");
        ConsumerCapability ccb = new ConsumerCapability(c, "capability_b");
        ConsumerCapability ccc = new ConsumerCapability(c, "capability_c");
        caps.add(cca);
        caps.add(ccb);
        caps.add(ccc);
        c.setCapabilities(caps);
        ConsumerType ct = new ConsumerType();
View Full Code Here

                Set<DistributorVersionCapability> capabilities = distributorVersionCurator.
                    findCapabilitiesByDistVersion(existing.getFact("distributor_version"));
                if (capabilities != null) {
                    Set<ConsumerCapability> ccaps = new HashSet<ConsumerCapability>();
                    for (DistributorVersionCapability dvc : capabilities) {
                        ConsumerCapability cc =
                            new ConsumerCapability(existing, dvc.getName());
                        ccaps.add(cc);
                    }
                    existing.setCapabilities(ccaps);
                }
                change = true;
            }
        }
        else {
            // update
            if (update.getCapabilities() != null) {
                change = update.getCapabilities().equals(existing.getCapabilities());
                existing.setCapabilities(update.getCapabilities());
            }
            else if (update.getFact("distributor_version") !=  null) {
                DistributorVersion dv = distributorVersionCurator.findByName(
                    update.getFact("distributor_version"));
                if (dv != null) {
                    Set<ConsumerCapability> ccaps = new HashSet<ConsumerCapability>();
                    for (DistributorVersionCapability dvc : dv.getCapabilities()) {
                        ConsumerCapability cc =
                            new ConsumerCapability(existing, dvc.getName());
                        ccaps.add(cc);
                    }
                    existing.setCapabilities(ccaps);
                }
                change = true;
View Full Code Here

TOP

Related Classes of org.candlepin.model.ConsumerCapability

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.