Package org.candlepin.model.activationkeys

Examples of org.candlepin.model.activationkeys.ActivationKey


        assertEquals(expected, result.getErrors().get(0).getResourceKey());
    }

    @Test
    public void testDoesAllowSameConsumerTypePools() {
        ActivationKey key = new ActivationKey();
        key.addPool(genPoolForType("system"), 1L);

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


        assertTrue(result.getErrors().isEmpty());
    }

    @Test
    public void testDoesntAllowMismatchedHostRequires() {
        ActivationKey key = new ActivationKey();
        key.addPool(genHostRestricted("host1"), 1L);

        Pool pool = genHostRestricted("host2");

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

        assertEquals(expected, result.getErrors().get(0).getResourceKey());
    }

    @Test
    public void testDoesAllowSameHostRequires() {
        ActivationKey key = new ActivationKey();
        key.addPool(genHostRestricted("host1"), 1L);

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

        assertTrue(result.getErrors().isEmpty());
    }

    @Test
    public void testNonMultientOne() {
        ActivationKey key = new ActivationKey();

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

        assertTrue(result.getErrors().isEmpty());
    }

    @Test
    public void testNonMultientMultipleQuantity() {
        ActivationKey key = new ActivationKey();

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

        assertEquals(expected, result.getErrors().get(0).getResourceKey());
    }

    @Test
    public void testNonMultientOneTwice() {
        ActivationKey key = new ActivationKey();
        Pool pool = genNonMultiEnt();
        key.addPool(pool, 1L);

        ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
        assertTrue(result.getWarnings().isEmpty());
        assertEquals(1, result.getErrors().size());
        String expected = "rulefailed.already.exists";
View Full Code Here

        assertEquals(expected, result.getErrors().get(0).getResourceKey());
    }

    @Test
    public void testNullQuantityInstanceAndPhysicalOnly() {
        ActivationKey key = new ActivationKey();
        key.addPool(genInstanceBased(), null);

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

        return p;
    }

    public static ActivationKey createActivationKey(Owner owner,
        List<Pool> pools) {
        ActivationKey key = new ActivationKey();
        key.setOwner(owner);
        key.setName("A Test Key");
        key.setServiceLevel("TestLevel");
        key.setDescription("A test description for the test key.");
        if (pools != null) {
            Set<ActivationKeyPool> akPools = new HashSet<ActivationKeyPool>();
            for (Pool p : pools) {
                akPools.add(new ActivationKeyPool(key, p, (long) 1));
            }
            key.setPools(akPools);
        }

        return key;
    }
View Full Code Here

    @Mock
    private I18n i18n;

    @Before
    public void setUp() throws URISyntaxException {
        key = new ActivationKey("actkey", owner);
        key.setId("keyid");
        MultivaluedMap<String, String> mvm = new MultivaluedMapImpl<String, String>();
        mvm.add("activation_key_id", key.getId());
        when(context.getPathParameters()).thenReturn(mvm);
        akcor = new ActivationKeyContentOverrideResource(
View Full Code Here

        consumerBindUtil = new ConsumerBindUtil(this.entitler, this.i18n,
                this.consumerContentOverrideCurator, null, this.serviceLevelValidator);
    }

    private List<ActivationKey> mockActivationKeys() {
        ActivationKey key1 = new ActivationKey("key1", owner);
        ActivationKey key2 = new ActivationKey("key2", owner);
        ActivationKey key3 = new ActivationKey("key3", owner);
        List<ActivationKey> keys = new LinkedList<ActivationKey>();
        keys.add(key1);
        keys.add(key2);
        keys.add(key3);
        return keys;
View Full Code Here

TOP

Related Classes of org.candlepin.model.activationkeys.ActivationKey

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.