use of org.candlepin.model.UpstreamConsumer in project candlepin by candlepin.
the class ConsumerImporterTest method importConsumerWithSameUuidOnAnotherOwnerShouldThrowException.
@Test(expected = SyncDataFormatException.class)
public void importConsumerWithSameUuidOnAnotherOwnerShouldThrowException() throws ImporterException {
Owner owner = new Owner();
UpstreamConsumer uc = new UpstreamConsumer("test-uuid");
owner.setUpstreamConsumer(uc);
ConsumerDTO consumer = new ConsumerDTO();
consumer.setUuid("test-uuid");
Owner anotherOwner = new Owner("other", "Other");
anotherOwner.setId("blah");
anotherOwner.setUpstreamConsumer(uc);
when(curator.lookupWithUpstreamUuid(consumer.getUuid())).thenReturn(anotherOwner);
importer.store(owner, consumer, new ConflictOverrides(), null);
}
use of org.candlepin.model.UpstreamConsumer in project candlepin by candlepin.
the class UpstreamConsumerTranslatorTest method initSourceObject.
@Override
protected UpstreamConsumer initSourceObject() {
UpstreamConsumer consumer = new UpstreamConsumer();
consumer.setId("consumer_id");
consumer.setUuid("consumer_uuid");
consumer.setName("consumer_name");
consumer.setApiUrl("http://www.url.com");
consumer.setWebUrl("http://www.url.com");
consumer.setOwnerId("owner_id");
consumer.setType(this.consumerTypeTranslatorTest.initSourceObject());
consumer.setIdCert((IdentityCertificate) this.certificateTranslatorTest.initSourceObject());
return consumer;
}
use of org.candlepin.model.UpstreamConsumer in project candlepin by candlepin.
the class OwnerTranslator method populate.
/**
* {@inheritDoc}
*/
@Override
public OwnerDTO populate(ModelTranslator translator, Owner source, OwnerDTO dest) {
dest = super.populate(translator, source, dest);
dest.setId(source.getId());
dest.setKey(source.getKey());
dest.setDisplayName(source.getDisplayName());
dest.setContentPrefix(source.getContentPrefix());
dest.setDefaultServiceLevel(source.getDefaultServiceLevel());
dest.setLogLevel(source.getLogLevel());
dest.setAutobindDisabled(source.isAutobindDisabled());
dest.setContentAccessMode(source.getContentAccessMode());
dest.setContentAccessModeList(source.getContentAccessModeList());
dest.setLastRefreshed(source.getLastRefreshed());
// TODO: Should this actually follow the nested child rules of all the other objects?
Owner parent = source.getParentOwner();
dest.setParentOwner(parent != null ? this.translate(translator, parent) : null);
// Process nested objects if we have a model translator to use to the translation...
if (translator != null) {
UpstreamConsumer consumer = source.getUpstreamConsumer();
dest.setUpstreamConsumer(translator.translate(consumer, UpstreamConsumerDTO.class));
} else {
dest.setUpstreamConsumer(null);
}
return dest;
}
use of org.candlepin.model.UpstreamConsumer in project candlepin by candlepin.
the class OwnerTranslator method populate.
/**
* {@inheritDoc}
*/
@Override
public OwnerDTO populate(ModelTranslator translator, Owner source, OwnerDTO dest) {
dest = super.populate(translator, source, dest);
dest.setId(source.getId());
dest.setKey(source.getKey());
dest.setDisplayName(source.getDisplayName());
dest.setContentPrefix(source.getContentPrefix());
dest.setDefaultServiceLevel(source.getDefaultServiceLevel());
dest.setLogLevel(source.getLogLevel());
dest.setAutobindDisabled(source.isAutobindDisabled());
dest.setContentAccessMode(source.getContentAccessMode());
dest.setContentAccessModeList(source.getContentAccessModeList());
dest.setLastRefreshed(source.getLastRefreshed());
// TODO: Should this actually follow the nested child rules of all the other objects?
Owner parent = source.getParentOwner();
dest.setParentOwner(parent != null ? this.translate(translator, parent) : null);
// Process nested objects if we have a model translator to use to the translation...
if (translator != null) {
UpstreamConsumer consumer = source.getUpstreamConsumer();
dest.setUpstreamConsumer(translator.translate(consumer, UpstreamConsumerDTO.class));
} else {
dest.setUpstreamConsumer(null);
}
return dest;
}
Aggregations