Package org.candlepin.model.activationkeys

Examples of org.candlepin.model.activationkeys.ActivationKey.addPool()


        pool2.setId("pool2");
        key1.addPool(pool2, 10L);
        Product prod3 = TestUtil.createProduct();
        Pool pool3 = TestUtil.createPool(owner, prod3, 5);
        pool3.setId("pool3");
        key1.addPool(pool3, 5L);

        Consumer consumer = new Consumer("sys.example.com", null, null, system);
        when(entitler.bindByPool(eq(pool1.getId()), eq(consumer), eq(10)))
            .thenThrow(new ForbiddenException("fail"));
        when(entitler.bindByPool(eq(pool2.getId()), eq(consumer), eq(10)))
View Full Code Here


        pool2.setId("pool2");
        key1.addPool(pool2, 10L);
        Product prod3 = TestUtil.createProduct();
        Pool pool3 = TestUtil.createPool(owner, prod3, 5);
        pool3.setId("pool3");
        key2.addPool(pool3, 5L);

        Consumer consumer = new Consumer("sys.example.com", null, null, system);
        when(entitler.bindByPool(eq(pool1.getId()), eq(consumer), eq(10)))
            .thenThrow(new ForbiddenException("fail"));
        when(entitler.bindByPool(eq(pool2.getId()), eq(consumer), eq(10)))
View Full Code Here

        productCurator.create(p);

        ActivationKey ak = new ActivationKey();
        Pool akpool = new Pool();
        akpool.setAttribute("physical_only", "true");
        ak.addPool(akpool, 1L);
        Page<List<Pool>> results =
            poolManager.listAvailableEntitlementPools(null, ak,
                parentSystem.getOwner(), null, null, true, true,
                new PoolFilterBuilder(), new PageRequest());
        assertEquals(4, results.getPageData().size());
View Full Code Here

    }

    @Test
    public void testActivationKeyRules() {
        ActivationKey key = new ActivationKey();
        key.addPool(genPool(), new Long(1));
        key.addPool(genPool(), new Long(1));

        Pool pool = genPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getErrors().isEmpty());
View Full Code Here

    @Test
    public void testActivationKeyRules() {
        ActivationKey key = new ActivationKey();
        key.addPool(genPool(), new Long(1));
        key.addPool(genPool(), new Long(1));

        Pool pool = genPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getErrors().isEmpty());
        assertTrue(result.getWarnings().isEmpty());
View Full Code Here

    }

    @Test
    public void testVirtOnlyOnKeyWithPhysical() {
        ActivationKey key = new ActivationKey();
        key.addPool(genPhysOnlyPool(), new Long(1));

        Pool pool = genVirtOnlyPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
View Full Code Here

    }

    @Test
    public void testPhysicalOnlyOnKeyWithVirt() {
        ActivationKey key = new ActivationKey();
        key.addPool(genVirtOnlyPool(), new Long(1));

        Pool pool = genPhysOnlyPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
View Full Code Here

    @Test
    public void testNullQuantityEmptyPool() {
        ActivationKey key = new ActivationKey();
        Pool existing = genPool();
        existing.setConsumed(existing.getQuantity());
        key.addPool(genVirtOnlyPool(), null);

        Pool pool = genPhysOnlyPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
View Full Code Here

     * should be treated as virt only.
     */
    @Test
    public void testPhysicalOnlyOnKeyWithOneInstanceBased() {
        ActivationKey key = new ActivationKey();
        key.addPool(genInstanceBased(), new Long(1));

        Pool pool = genPhysOnlyPool();
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
View Full Code Here

     * amount for physical or virtual systems.
     */
    @Test
    public void testPhysicalOnlyOnKeyWithNullInstanceBased() {
        ActivationKey key = new ActivationKey();
        key.addPool(genInstanceBased(), null);

        Pool pool = genPhysOnlyPool();
        // Should be a valid combination
        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
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.