use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.
the class ActivationKeyContentOverrideCuratorTest method deleteByConsumer.
@Test
public void deleteByConsumer() {
ActivationKeyContentOverride cco1 = new ActivationKeyContentOverride(key, "test-content1", "name1", "value");
activationKeyContentOverrideCurator.create(cco1);
ActivationKeyContentOverride cco2 = new ActivationKeyContentOverride(key, "test-content2", "name2", "value");
activationKeyContentOverrideCurator.create(cco2);
activationKeyContentOverrideCurator.removeByParent(key);
List<ActivationKeyContentOverride> ccoList = activationKeyContentOverrideCurator.listAll().list();
assertEquals(ccoList.size(), 0);
}
use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.
the class ActivationKeyContentOverrideCuratorTest method testModifyOverride.
@Test
public void testModifyOverride() {
ActivationKeyContentOverride override = new ActivationKeyContentOverride(key, "test-repo", "GpGCheck", "1");
ActivationKeyContentOverride created = this.activationKeyContentOverrideCurator.create(override);
created.setValue("0");
ActivationKeyContentOverride merged = this.activationKeyContentOverrideCurator.merge(created);
assertEquals("0", merged.getValue());
}
use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.
the class ActivationKeyContentOverrideCuratorTest method testRetrieveByName.
@Test
public void testRetrieveByName() {
activationKeyContentOverrideCurator.create(new ActivationKeyContentOverride(key, "test-repo", "gpgcheck", "1"));
ActivationKeyContentOverride found = activationKeyContentOverrideCurator.retrieve(key, "test-repo", "gpgcheck");
assertNotNull(found);
assertEquals(key, found.getKey());
assertEquals("test-repo", found.getContentLabel());
assertEquals("gpgcheck", found.getName());
assertEquals("1", found.getValue());
}
use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.
the class ActivationKeyContentOverrideResourceTest method testActivationKeyAddOverrides.
@Test
public void testActivationKeyAddOverrides() {
ActivationKeyContentOverride override = new ActivationKeyContentOverride(key, "somelabel", "test", "test");
ActivationKeyContentOverride otherOverride = new ActivationKeyContentOverride(key, "somelabel1", "test", "test");
List<ContentOverride> toAdd = new LinkedList<>();
toAdd.add(override);
toAdd.add(otherOverride);
akcor.addContentOverrides(context, principal, toAdd);
verify(activationKeyContentOverrideCurator, Mockito.times(1)).addOrUpdate(eq(key), eq(override));
verify(activationKeyContentOverrideCurator, Mockito.times(1)).addOrUpdate(eq(key), eq(otherOverride));
}
use of org.candlepin.model.activationkeys.ActivationKeyContentOverride in project candlepin by candlepin.
the class ActivationKeyContentOverrideResourceTest method testActivationKeyOverrideValidationIsRun.
@Test
public void testActivationKeyOverrideValidationIsRun() {
List<ContentOverride> newOverrides = new LinkedList<>();
newOverrides.add(new ActivationKeyContentOverride(key, "x", "baseurl", "x"));
akcor.addContentOverrides(context, principal, newOverrides);
verify(contentOverrideValidator, Mockito.times(1)).validate(eq(newOverrides));
}
Aggregations