Search in sources :

Example 1 with CdnCurator

use of org.candlepin.model.CdnCurator in project candlepin by candlepin.

the class ConsumerResourceTest method testAsyncExport.

@Test
public void testAsyncExport() {
    CdnCurator mockCdnCurator = mock(CdnCurator.class);
    ManifestManager manifestManager = mock(ManifestManager.class);
    ConsumerResource cr = new ConsumerResource(mockConsumerCurator, mockConsumerTypeCurator, null, null, null, null, null, null, i18n, null, null, null, null, null, null, null, mockOwnerCurator, null, null, null, null, null, null, this.config, null, mockCdnCurator, null, null, manifestManager, null, this.factValidator, null, consumerEnricher, migrationProvider, translator);
    List<KeyValueParameter> extParams = new ArrayList<>();
    Owner owner = this.createOwner();
    owner.setId(TestUtil.randomString());
    when(mockOwnerCurator.findOwnerById(eq(owner.getId()))).thenReturn(owner);
    ConsumerType ctype = this.mockConsumerType(new ConsumerType(ConsumerType.ConsumerTypeEnum.CANDLEPIN));
    Consumer consumer = this.createConsumer(owner, ctype);
    Cdn cdn = new Cdn("cdn-label", "test", "url");
    when(mockCdnCurator.lookupByLabel(eq(cdn.getLabel()))).thenReturn(cdn);
    cr.exportDataAsync(null, consumer.getUuid(), cdn.getLabel(), "prefix", cdn.getUrl(), extParams);
    verify(manifestManager).generateManifestAsync(eq(consumer.getUuid()), eq(owner.getKey()), eq(cdn.getLabel()), eq("prefix"), eq(cdn.getUrl()), any(Map.class));
}
Also used : Owner(org.candlepin.model.Owner) Consumer(org.candlepin.model.Consumer) ArrayList(java.util.ArrayList) KeyValueParameter(org.candlepin.resteasy.parameter.KeyValueParameter) CdnCurator(org.candlepin.model.CdnCurator) ManifestManager(org.candlepin.controller.ManifestManager) ConsumerType(org.candlepin.model.ConsumerType) Cdn(org.candlepin.model.Cdn) Map(java.util.Map) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ManifestManager (org.candlepin.controller.ManifestManager)1 Cdn (org.candlepin.model.Cdn)1 CdnCurator (org.candlepin.model.CdnCurator)1 Consumer (org.candlepin.model.Consumer)1 ConsumerType (org.candlepin.model.ConsumerType)1 Owner (org.candlepin.model.Owner)1 KeyValueParameter (org.candlepin.resteasy.parameter.KeyValueParameter)1 Test (org.junit.Test)1