Search in sources :

Example 6 with ActivationKeyContentOverride

use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.

the class ActivationKeyContentOverrideCuratorTest method testCreateOverrideForcesLowercaseName.

@Test
public void testCreateOverrideForcesLowercaseName() {
    ActivationKeyContentOverride override = new ActivationKeyContentOverride(key, "test-repo", "GpGCheck", "1");
    ActivationKeyContentOverride created = this.activationKeyContentOverrideCurator.create(override);
    assertEquals("gpgcheck", created.getName());
}
Also used : ActivationKeyContentOverride(org.candlepin.model.activationkeys.ActivationKeyContentOverride) Test(org.junit.Test)

Example 7 with ActivationKeyContentOverride

use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.

the class ActivationKeyContentOverrideCuratorTest method testRemoveByConsumer.

@Test
public void testRemoveByConsumer() {
    ActivationKey key2 = new ActivationKey("other key", owner);
    key2 = activationKeyCurator.create(key2);
    activationKeyContentOverrideCurator.create(new ActivationKeyContentOverride(key2, "test-repo", "gpgcheck", "1"));
    activationKeyContentOverrideCurator.create(new ActivationKeyContentOverride(key, "test-repo", "gpgcheck", "1"));
    activationKeyContentOverrideCurator.create(new ActivationKeyContentOverride(key, "another-test-repo", "gpgcheck", "0"));
    activationKeyContentOverrideCurator.removeByParent(key);
    assertTrue(activationKeyContentOverrideCurator.getList(key).isEmpty());
    assertEquals(1, activationKeyContentOverrideCurator.getList(key2).size());
}
Also used : ActivationKey(org.candlepin.model.activationkeys.ActivationKey) ActivationKeyContentOverride(org.candlepin.model.activationkeys.ActivationKeyContentOverride) Test(org.junit.Test)

Example 8 with ActivationKeyContentOverride

use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.

the class ActivationKeyContentOverrideCuratorTest method normalCreateAndRetrieve.

@Test
public void normalCreateAndRetrieve() {
    ActivationKeyContentOverride cco = new ActivationKeyContentOverride(key, "test-content", "name", "value");
    activationKeyContentOverrideCurator.create(cco);
    ActivationKeyContentOverride cco2 = activationKeyContentOverrideCurator.retrieve(key, "test-content", "name");
    assert (cco2 != null);
    assertEquals("value", cco2.getValue());
}
Also used : ActivationKeyContentOverride(org.candlepin.model.activationkeys.ActivationKeyContentOverride) Test(org.junit.Test)

Example 9 with ActivationKeyContentOverride

use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.

the class ActivationKeyContentOverrideCuratorTest method deleteByName.

@Test
public void deleteByName() {
    ActivationKeyContentOverride cco = new ActivationKeyContentOverride(key, "test-content", "name", "value");
    activationKeyContentOverrideCurator.create(cco);
    activationKeyContentOverrideCurator.removeByName(key, "test-content", "name");
    ActivationKeyContentOverride cco2 = activationKeyContentOverrideCurator.retrieve(key, "test-content", "name");
    assert (cco2 == null);
}
Also used : ActivationKeyContentOverride(org.candlepin.model.activationkeys.ActivationKeyContentOverride) Test(org.junit.Test)

Example 10 with ActivationKeyContentOverride

use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.

the class ActivationKeyContentOverrideCuratorTest method testAddOrUpdateCreatesNew.

@Test
public void testAddOrUpdateCreatesNew() {
    ActivationKeyContentOverride cco1 = new ActivationKeyContentOverride(key, "test-content1", "name1", "value");
    activationKeyContentOverrideCurator.create(cco1);
    ActivationKeyContentOverride cco2 = new ActivationKeyContentOverride(key, "test-content2", "name2", "value2");
    activationKeyContentOverrideCurator.addOrUpdate(key, cco2);
    List<ActivationKeyContentOverride> ccoList = activationKeyContentOverrideCurator.listAll().list();
    assertEquals(2, ccoList.size());
}
Also used : ActivationKeyContentOverride(org.candlepin.model.activationkeys.ActivationKeyContentOverride) Test(org.junit.Test)

Aggregations

ActivationKeyContentOverride (org.candlepin.model.activationkeys.ActivationKeyContentOverride)26 Test (org.junit.Test)22 LinkedList (java.util.LinkedList)4 ContentOverride (org.candlepin.model.ContentOverride)3 Product (org.candlepin.model.Product)3 Release (org.candlepin.model.Release)3 ActivationKeyPool (org.candlepin.model.activationkeys.ActivationKeyPool)2 ActivationKeyDTO (org.candlepin.dto.api.v1.ActivationKeyDTO)1 ConsumerContentOverride (org.candlepin.model.ConsumerContentOverride)1 Owner (org.candlepin.model.Owner)1 Pool (org.candlepin.model.Pool)1 ActivationKey (org.candlepin.model.activationkeys.ActivationKey)1