Package org.candlepin.model

Examples of org.candlepin.model.ConsumerInstalledProduct


        key1.addPool(pool, 0L);
        key1.setAutoAttach(true);

        Consumer consumer = new Consumer("sys.example.com", null, null, system);
        Set<ConsumerInstalledProduct> cips = new HashSet<ConsumerInstalledProduct>();
        ConsumerInstalledProduct cip = new ConsumerInstalledProduct(prod.getId(), prod.getName());
        cips.add(cip);
        consumer.setInstalledProducts(cips);

        AutobindData ad = new AutobindData(consumer).withPools(poolIds).forProducts(prodIds);
        consumerBindUtil.handleActivationKeys(consumer, keys);
View Full Code Here


        keys.add(key1);
        key1.setAutoAttach(true);

        Consumer consumer = new Consumer("sys.example.com", null, null, system);
        Set<ConsumerInstalledProduct> cips = new HashSet<ConsumerInstalledProduct>();
        ConsumerInstalledProduct cip = new ConsumerInstalledProduct(prod.getId(), prod.getName());
        cips.add(cip);
        consumer.setInstalledProducts(cips);

        AutobindData ad = new AutobindData(consumer).forProducts(prodIds);
        consumerBindUtil.handleActivationKeys(consumer, keys);
View Full Code Here

        key1.addProduct(prod2);
        key1.setAutoAttach(true);

        Consumer consumer = new Consumer("sys.example.com", null, null, system);
        Set<ConsumerInstalledProduct> cips = new HashSet<ConsumerInstalledProduct>();
        ConsumerInstalledProduct cip = new ConsumerInstalledProduct(prod1.getId(), prod1.getName());
        cips.add(cip);
        consumer.setInstalledProducts(cips);

        AutobindData ad = new AutobindData(consumer).forProducts(prodIds);
        consumerBindUtil.handleActivationKeys(consumer, keys);
View Full Code Here

        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);
        ComplianceStatus status = compliance.getStatus(c, now);
        status.addNonCompliantProduct(PRODUCT_1);
        ConsumerInstalledProduct cip = new ConsumerInstalledProduct();
        c.addInstalledProduct(cip);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
        Product p = new Product(PRODUCT_1, "Awesome Product");
        p.setAttribute("version", "candlepin version");
        p.setAttribute("arch", "candlepin arch");
        calculator.enrich(cip, p);
        assertEquals("candlepin version", cip.getVersion());
        assertEquals("candlepin arch", cip.getArch());
    }
View Full Code Here

        c.addEntitlement(mockEntitlement(c, PRODUCT_1, range2, PRODUCT_1));
        List<Entitlement> ents = new LinkedList<Entitlement>(c.getEntitlements());
        mockEntCurator(c, ents);
        ComplianceStatus status = compliance.getStatus(c, now);
        status.addNonCompliantProduct(PRODUCT_1);
        ConsumerInstalledProduct cip = new ConsumerInstalledProduct();
        cip.setArch("x86_64");
        cip.setVersion("4.5");
        c.addInstalledProduct(cip);
        ConsumerInstalledProductEnricher calculator =
            new ConsumerInstalledProductEnricher(c, status, compliance);
        Product p = new Product(PRODUCT_1, "Awesome Product");
        p.setAttribute("version", "candlepin version");
        p.setAttribute("arch", "candlepin arch");
        calculator.enrich(cip, p);
        assertEquals("4.5", cip.getVersion());
        assertEquals("x86_64", cip.getArch());
    }
View Full Code Here

    private Consumer mockConsumer(String ... installedProducts) {
        Consumer c = new Consumer();
        c.setType(new ConsumerType(ConsumerType.ConsumerTypeEnum.SYSTEM));
        for (String pid : installedProducts) {
            c.addInstalledProduct(new ConsumerInstalledProduct(pid, pid));
        }
        c.setFact("cpu.cpu_socket(s)", "4");
        return c;
    }
View Full Code Here

    @Test
    public void testNonInstalled() {
        HashMap<String, String> attrs = new HashMap<String, String>();
        attrs.put("product_id", "prod1");
        ComplianceReason reason = buildReason("NOTCOVERED", attrs);
        ConsumerInstalledProduct installed = new ConsumerInstalledProduct();
        installed.setProductId("prod1");
        installed.setProductName("NonCovered Product");
        consumer.addInstalledProduct(installed);
        generator.setMessage(consumer, reason, new Date());
        assertEquals("Not supported by a valid subscription.", reason.getMessage());
    }
View Full Code Here

        owner = ownerCurator.create(owner);
        ct = new ConsumerType(ConsumerTypeEnum.SYSTEM);
        ct = consumerTypeCurator.create(ct);

        consumer = new Consumer("a consumer", "username", owner, ct);
        consumer.addInstalledProduct(new ConsumerInstalledProduct(prod.getId(), prod.getName()));
        consumerCurator.create(consumer);

        job = injector.getInstance(ActiveEntitlementJob.class);
    }
View Full Code Here

    }

    @Test
    public void testInstalledProducts() throws Exception {
        Consumer lookedUp = consumerCurator.find(consumer.getId());
        lookedUp.addInstalledProduct(new ConsumerInstalledProduct("someproduct",
            "someproductname"));
        lookedUp.addInstalledProduct(new ConsumerInstalledProduct("someproduct2",
            "someproductname2"));
        consumerCurator.update(lookedUp);
        lookedUp = consumerCurator.find(consumer.getId());
        assertEquals(2, lookedUp.getInstalledProducts().size());
        ConsumerInstalledProduct installed = lookedUp.getInstalledProducts().
            iterator().next();
        lookedUp.getInstalledProducts().remove(installed);
        consumerCurator.update(lookedUp);
        lookedUp = consumerCurator.find(consumer.getId());
        assertEquals(1, lookedUp.getInstalledProducts().size());
View Full Code Here

        Consumer c = mock(Consumer.class);
        Owner o = mock(Owner.class);
        SubscriptionServiceAdapter sa = mock(SubscriptionServiceAdapter.class);
        Entitler e = mock(Entitler.class);
        ConsumerCurator cc = mock(ConsumerCurator.class);
        ConsumerInstalledProduct cip = mock(ConsumerInstalledProduct.class);
        Set<ConsumerInstalledProduct> products = new HashSet<ConsumerInstalledProduct>();
        products.add(cip);

        when(c.getOwner()).thenReturn(o);
        when(cip.getProductId()).thenReturn("product-foo");
        when(sa.hasUnacceptedSubscriptionTerms(eq(o))).thenReturn(false);
        when(cc.verifyAndLookupConsumer(eq("fakeConsumer"))).thenReturn(c);

        ConsumerResource cr = new ConsumerResource(cc, null, null, sa,
            null, null, null, null, null, null, null, null, null, null,
View Full Code Here

TOP

Related Classes of org.candlepin.model.ConsumerInstalledProduct

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.