Projects >> candlepin >>2f9fce2c48af7589feac6c36f23be9b381e836a1

Chunk
Conflicting content
import org.candlepin.model.PoolFilterBuilder;
import org.candlepin.model.PoolQuantity;
import org.candlepin.model.Product;
<<<<<<< HEAD
=======
import org.candlepin.model.ProductContent;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
import org.candlepin.model.ProductCurator;
import org.candlepin.model.Subscription;
import org.candlepin.model.activationkeys.ActivationKey;
Solution content
import org.candlepin.model.PoolFilterBuilder;
import org.candlepin.model.PoolQuantity;
import org.candlepin.model.Product;
import org.candlepin.model.ProductContent;
import org.candlepin.model.ProductCurator;
import org.candlepin.model.Subscription;
import org.candlepin.model.activationkeys.ActivationKey;
File
CandlepinPoolManager.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
     * @param mergedPool
     * @return
     */
<<<<<<< HEAD
    private EntitlementCertificate generateEntitlementCertificate(Pool pool, Entitlement e,
        boolean generateUeberCert) {

=======
    private EntitlementCertificate generateEntitlementCertificate(
        SubscriptionServiceAdapter subAdapter, Pool pool, Entitlement e, boolean generateUeberCert) {
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
        Subscription sub = null;
        if (pool.getSubscriptionId() != null) {
            log.info("Getting subscription: " + pool.getSubscriptionId());
Solution content
     * @param mergedPool
     * @return
     */
    private EntitlementCertificate generateEntitlementCertificate(
        SubscriptionServiceAdapter subAdapter, Pool pool, Entitlement e, boolean generateUeberCert) {

        Subscription sub = null;
        if (pool.getSubscriptionId() != null) {
            log.info("Getting subscription: " + pool.getSubscriptionId());
File
CandlepinPoolManager.java
Developer's decision
Version 2
Kind of conflict
Method signature
Chunk
Conflicting content
     */
    @Override
    @Transactional
<<<<<<< HEAD
    public void regenerateCertificatesOf(Environment e, Set affectedContent, boolean lazy) {
=======
    public void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, Environment e, Set affectedContent,
        boolean lazy) {
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
        log.info("Regenerating relevant certificates in environment: " + e.getId());

        List allEnvEnts = entitlementCurator.listByEnvironment(e);
Solution content
     */
    @Override
    @Transactional
    public void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, Environment e,
        Set affectedContent, boolean lazy) {

        log.info("Regenerating relevant certificates in environment: " + e.getId());

        List allEnvEnts = entitlementCurator.listByEnvironment(e);
File
CandlepinPoolManager.java
Developer's decision
Version 2
Kind of conflict
Method signature
Chunk
Conflicting content
    @Override
    @Transactional
<<<<<<< HEAD
    public void regenerateCertificatesOf(Owner owner, String productId, boolean lazy) {
        // TODO: Should probably enforce the presence of owner.

        List poolsForProduct = this.listAvailableEntitlementPools(null, null, owner,
=======
    public void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, String productId, boolean lazy) {
        List poolsForProduct = this.listAvailableEntitlementPools(null, null, null,
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
            productId, new Date(), false, false, new PoolFilterBuilder(), null)
            .getPageData();
Solution content
    @Override
    @Transactional
    public void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, Owner owner, String productId, boolean lazy) {
        // TODO: Should probably enforce the presence of owner.

        List poolsForProduct = this.listAvailableEntitlementPools(null, null, owner,
            productId, new Date(), false, false, new PoolFilterBuilder(), null)
            .getPageData();
File
CandlepinPoolManager.java
Developer's decision
Manual
Kind of conflict
Comment
Method invocation
Method signature
Variable
Chunk
Conflicting content
    void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, Environment env, Set contentIds, boolean lazy);

<<<<<<< HEAD
    void regenerateCertificatesOf(Owner owner, String productId, boolean lazy);
=======
    void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, String productId, boolean lazy);
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183

    void regenerateEntitlementCertificates(SubscriptionServiceAdapter subAdapter, Consumer consumer, boolean lazy);
Solution content
    void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, Environment env, Set contentIds, boolean lazy);

    void regenerateCertificatesOf(SubscriptionServiceAdapter subAdapter, Owner owner, String productId, boolean lazy);

    void regenerateEntitlementCertificates(SubscriptionServiceAdapter subAdapter, Consumer consumer, boolean lazy);
File
PoolManager.java
Developer's decision
Manual
Kind of conflict
Method interface
Chunk
Conflicting content
<<<<<<< HEAD
import org.candlepin.model.Product;
import org.candlepin.model.ProductCurator;
import org.candlepin.pinsetter.core.model.JobStatus;
=======
import org.candlepin.service.ProductServiceAdapter;
import org.candlepin.service.SubscriptionServiceAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
import org.candlepin.util.Util;

import com.google.inject.Inject;
Solution content
import org.candlepin.model.Product;
import org.candlepin.model.ProductCurator;
import org.candlepin.pinsetter.core.model.JobStatus;
import org.candlepin.service.ProductServiceAdapter;
import org.candlepin.service.SubscriptionServiceAdapter;
import org.candlepin.util.Util;

import com.google.inject.Inject;
File
RefreshPoolsForProductJob.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
 */
public class RefreshPoolsForProductJob extends KingpinJob {

<<<<<<< HEAD
    private ProductCurator productCurator;
=======
    private ProductServiceAdapter productAdapter;
    private SubscriptionServiceAdapter subAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    private PoolManager poolManager;

    public static final String LAZY_REGEN = "lazy_regen";
Solution content
 */
public class RefreshPoolsForProductJob extends KingpinJob {

    // TODO: FIX ME.

    private ProductServiceAdapter productAdapter;
    private SubscriptionServiceAdapter subAdapter;
    private PoolManager poolManager;

    public static final String LAZY_REGEN = "lazy_regen";
File
RefreshPoolsForProductJob.java
Developer's decision
Manual
Kind of conflict
Attribute
Chunk
Conflicting content
    public static final String LAZY_REGEN = "lazy_regen";

    @Inject
<<<<<<< HEAD
    public RefreshPoolsForProductJob(ProductCurator productCurator,
        PoolManager poolManager) {
        this.productCurator = productCurator;
=======
    public RefreshPoolsForProductJob(ProductServiceAdapter productAdapter,
        SubscriptionServiceAdapter subAdapter,
        PoolManager poolManager) {
        this.productAdapter = productAdapter;
        this.subAdapter = subAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
        this.poolManager = poolManager;
    }
Solution content
    public static final String LAZY_REGEN = "lazy_regen";

    @Inject
    public RefreshPoolsForProductJob(ProductServiceAdapter productAdapter,
        SubscriptionServiceAdapter subAdapter, PoolManager poolManager) {

        this.productAdapter = productAdapter;
        this.subAdapter = subAdapter;
        this.poolManager = poolManager;
    }
File
RefreshPoolsForProductJob.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method signature
Chunk
Conflicting content
        String productUuid = context.getMergedJobDataMap().getString(JobStatus.TARGET_ID);
        Boolean lazy = context.getMergedJobDataMap().getBoolean(LAZY_REGEN);

<<<<<<< HEAD
        poolManager.getRefresher(lazy).add(this.productCurator.find(productUuid)).run();
=======
        poolManager.getRefresher(subAdapter, lazy).add(productAdapter.getProductById(productId)).run();
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183

        context.setResult("Pools refreshed for product " + productUuid);
    }
Solution content
        Boolean lazy = context.getMergedJobDataMap().getBoolean(LAZY_REGEN);

        // TODO: We need either an owner or a product UUID here.
        // poolManager.getRefresher(subAdapter, lazy).add(productAdapter.getProductById(productId)).run();

        context.setResult("Pools refreshed for product " + productId);
    }
File
RefreshPoolsForProductJob.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
        //       needs to use the product's UUID.
        String productId = arg0.getJobDetail().getJobDataMap().getString(PROD_ID);
        boolean lazy = arg0.getJobDetail().getJobDataMap().getBoolean(LAZY_REGEN);
<<<<<<< HEAD

        // this.poolManager.regenerateCertificatesOf(productId, lazy);
=======
        this.poolManager.regenerateCertificatesOf(subAdapter, prodId, lazy);
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    }
}
Solution content
        //       needs to use the product's UUID.
        String productId = arg0.getJobDetail().getJobDataMap().getString(PROD_ID);
        boolean lazy = arg0.getJobDetail().getJobDataMap().getBoolean(LAZY_REGEN);

        // this.poolManager.regenerateCertificatesOf(subAdapter, productId, lazy);
    }
}
File
RegenProductEntitlementCertsJob.java
Developer's decision
Manual
Kind of conflict
Comment
Method invocation
Chunk
Conflicting content
import org.candlepin.model.ContentCurator;
import org.candlepin.model.EnvironmentContent;
import org.candlepin.model.EnvironmentContentCurator;
<<<<<<< HEAD
import org.candlepin.model.Owner;
import org.candlepin.model.OwnerCurator;
import org.candlepin.model.ProductCurator;
=======
import org.candlepin.service.ProductServiceAdapter;
import org.candlepin.service.SubscriptionServiceAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
import org.candlepin.service.UniqueIdGenerator;

import com.google.inject.Inject;
Solution content
import org.candlepin.model.ContentCurator;
import org.candlepin.model.EnvironmentContent;
import org.candlepin.model.EnvironmentContentCurator;
import org.candlepin.model.Owner;
import org.candlepin.model.OwnerCurator;
import org.candlepin.model.ProductCurator;
import org.candlepin.service.UniqueIdGenerator;

import com.google.inject.Inject;
File
ContentResource.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    private UniqueIdGenerator idGenerator;
    private EnvironmentContentCurator envContentCurator;
    private PoolManager poolManager;
<<<<<<< HEAD
    private ProductCurator productCurator;
    private OwnerCurator ownerCurator;
=======
    private SubscriptionServiceAdapter subAdapter;
    private ProductServiceAdapter productAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183

    @Inject
    public ContentResource(ContentCurator contentCurator, I18n i18n,
Solution content
    private UniqueIdGenerator idGenerator;
    private EnvironmentContentCurator envContentCurator;
    private PoolManager poolManager;
    private ProductCurator productCurator;
    private OwnerCurator ownerCurator;

    @Inject
    public ContentResource(ContentCurator contentCurator, I18n i18n,
File
ContentResource.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
    @Inject
    public ContentResource(ContentCurator contentCurator, I18n i18n,
        UniqueIdGenerator idGenerator, EnvironmentContentCurator envContentCurator,
<<<<<<< HEAD
        PoolManager poolManager, ProductCurator productCurator, OwnerCurator ownerCurator) {
=======
        PoolManager poolManager, SubscriptionServiceAdapter subAdapter,
        ProductServiceAdapter productAdapter) {
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
        this.i18n = i18n;
        this.contentCurator = contentCurator;
        this.idGenerator = idGenerator;
Solution content
    @Inject
    public ContentResource(ContentCurator contentCurator, I18n i18n,
        UniqueIdGenerator idGenerator, EnvironmentContentCurator envContentCurator,
        PoolManager poolManager, ProductCurator productCurator, OwnerCurator ownerCurator) {
        this.i18n = i18n;
        this.contentCurator = contentCurator;
        this.idGenerator = idGenerator;
File
ContentResource.java
Developer's decision
Version 1
Kind of conflict
Variable
Chunk
Conflicting content
        this.idGenerator = idGenerator;
        this.envContentCurator = envContentCurator;
        this.poolManager = poolManager;
<<<<<<< HEAD
        this.productCurator = productCurator;
        this.ownerCurator = ownerCurator;
=======
        this.subAdapter = subAdapter;
        this.productAdapter = productAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    }

    /**
Solution content
        this.idGenerator = idGenerator;
        this.envContentCurator = envContentCurator;
        this.poolManager = poolManager;
        this.productCurator = productCurator;
        this.ownerCurator = ownerCurator;
    }

    /**
File
ContentResource.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
    @PUT
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{content_id}")
<<<<<<< HEAD
    public Content updateContent(@PathParam("content_id") String contentId, Content changes) {
        throw new UnsupportedOperationException(this.i18n.tr(
            "Organization-agnostic content write operations are not supported."
        ));
=======
    public Content updateContent(@PathParam("content_id") String contentId,
            Content changes) {
        Content lookedUp  = contentCurator.find(contentId);
        if (lookedUp == null) {
            throw new NotFoundException(
                i18n.tr("Content with id {0} could not be found.", contentId));
        }

        // FIXME: needs arches handled as well?
        changes.setId(contentId);
        Content updated = contentCurator.createOrUpdate(changes);
        // require regeneration of entitlement certificates of affected consumers
        Set affectedProducts =
            productAdapter.getProductsWithContent(setFrom(contentId));
        for (String productId : affectedProducts) {
            poolManager.regenerateCertificatesOf(subAdapter, productId, true);
        }

        return updated;
    }

    private  Set setFrom(T anElement) {
        Set toReturn = new HashSet();
        toReturn.add(anElement);
        return toReturn;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    }

    /**
Solution content
    @PUT
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{content_id}")
    public Content updateContent(@PathParam("content_id") String contentId, Content changes) {
        throw new UnsupportedOperationException(this.i18n.tr(
            "Organization-agnostic content write operations are not supported."
        ));
    }

    /**
File
ContentResource.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Method invocation
Method signature
Return statement
Throw statement
Variable
Chunk
Conflicting content
    @DELETE
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{content_id}")
<<<<<<< HEAD
    public void remove(@PathParam("content_id") String contentId) {
        throw new UnsupportedOperationException(this.i18n.tr(
            "Organization-agnostic content write operations are not supported."
        ));
=======
    public void remove(@PathParam("content_id") String cid) {
        Set affectedProducts = productAdapter.getProductsWithContent(setFrom(cid));
        Content nuke = getContent(cid);
        contentCurator.delete(nuke);

        // Clean up any dangling environment content:
        for (EnvironmentContent ec : envContentCurator.lookupByContent(cid)) {
            envContentCurator.delete(ec);
        }
        // Regenerate affected products
        for (String productId : affectedProducts) {
            poolManager.regenerateCertificatesOf(subAdapter, productId, true);
        }
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    }
}
Solution content
    @DELETE
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{content_id}")
    public void remove(@PathParam("content_id") String contentId) {
        throw new UnsupportedOperationException(this.i18n.tr(
            "Organization-agnostic content write operations are not supported."
        ));
    }
}
File
ContentResource.java
Developer's decision
Version 1
Kind of conflict
Comment
For statement
Method invocation
Method signature
Throw statement
Variable
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    /**
     * Examine the list of products that are about to be imported, and return a set of them
     * that have been modified from their state in the db.
     *
     * Will not return brand new products.
     *
     * @param products The list of yet to be imported products
     * @return a set of all products that exist in the db, but will be changed
     */
    Set getChangedProducts(Set products) {
        Set toReturn = Util.newSet();

        for (Product product : products) {
            Product existing = curator.find(product.getUuid());

            if (existing != null && hasProductChanged(existing, product)) {
                toReturn.add(product);
            }
        }

        return toReturn;
    }

    protected final boolean hasProductChanged(Product existingProd, Product importedProd) {
        // trying to go in order from least to most work.
        if (!existingProd.getName().equals(importedProd.getName())) {
            return true;
        }

        if (!existingProd.getMultiplier().equals(importedProd.getMultiplier())) {
            return true;
        }

        if (existingProd.getAttributes().size() != importedProd.getAttributes().size()) {
            return true;
        }
        if (Sets.intersection(existingProd.getAttributes(),
            importedProd.getAttributes()).size() != existingProd.getAttributes().size()) {
            return true;
        }

        if (existingProd.getProductContent().size() != importedProd.getProductContent().size()) {
            return true;
        }
        if (Sets.intersection(new HashSet(existingProd.getProductContent()),
                new HashSet(importedProd.getProductContent())).size() !=
                existingProd.getProductContent().size()) {
            return true;
        }

        return false;
    }
=======
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
}
Solution content
        }
    }

}
File
ProductImporter.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
            mockPoolCurator, mockSubAdapter, mockProductCurator, entCertAdapterMock, mockEventSink,
            eventFactory, mockConfig, enforcerMock, poolRulesMock, entitlementCurator,
            consumerCuratorMock, certCuratorMock, complianceRules, autobindRules,
<<<<<<< HEAD
            activationKeyRules)
        );
=======
            activationKeyRules, productCuratorMock));
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183

        when(entCertAdapterMock.generateEntitlementCert(any(Entitlement.class),
            any(Subscription.class), any(Product.class))).thenReturn(
Solution content
            mockPoolCurator, mockSubAdapter, mockProductCurator, entCertAdapterMock, mockEventSink,
            eventFactory, mockConfig, enforcerMock, poolRulesMock, entitlementCurator,
            consumerCuratorMock, certCuratorMock, complianceRules, autobindRules,
            activationKeyRules, productCuratorMock)
        );

        when(entCertAdapterMock.generateEntitlementCert(any(Entitlement.class),
            any(Subscription.class), any(Product.class))).thenReturn(
File
PoolManagerTest.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
        recj.execute(jec);

        // verification
<<<<<<< HEAD
        // TODO: This needs to be fixed.
        // verify(pm).regenerateCertificatesOf(eq("foobarbaz"), eq(true));
=======
        verify(pm).regenerateCertificatesOf(eq(subService), eq("foobarbaz"), eq(true));
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    }
}
Solution content
        recj.execute(jec);

        // verification
        // fail("FIX ME");
        // verify(pm).regenerateCertificatesOf(eq(subService), eq("foobarbaz"), eq(true));
    }
}
File
RegenEntitlementCertsJobTest.java
Developer's decision
Manual
Kind of conflict
Comment
Method invocation
Chunk
Conflicting content
    }

    @Test
<<<<<<< HEAD
    public void productIdChangeOnProductPoolAttributeTriggersUpdate() {
        Subscription s = TestUtil.createSubscription(owner, TestUtil.createProduct(owner));
        String testAttributeKey = "multi-entitlement";
        s.getProduct().setAttribute(testAttributeKey, "yes");

        Pool p = TestUtil.copyFromSub(s);
        p.getProduct().setAttribute(testAttributeKey, "yes");

        // Change the sub's product's ID
        String expectedProductId = "NEW_TEST_ID";
        s.getProduct().setId(expectedProductId);

        when(productAdapterMock.getProductById(s.getProduct().getOwner(), s.getProduct().getId()))
            .thenReturn(s.getProduct());

        List existingPools = new LinkedList();
        existingPools.add(p);
        List updates = this.poolRules.updatePools(s, existingPools);

        assertEquals(1, updates.size());
        PoolUpdate update = updates.get(0);
        Pool updatedPool = update.getPool();
        assertEquals(s.getProduct(), updatedPool.getProduct());
        assertTrue(updatedPool.getProduct().hasAttribute(testAttributeKey));
    }

    @Test
=======
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    public void productAttributesCopiedOntoPoolWhenCreatingNewPool() {
        Product product = TestUtil.createProduct(owner);
Solution content
    }

    @Test
    public void productAttributesCopiedOntoPoolWhenCreatingNewPool() {
        Product product = TestUtil.createProduct(owner);
File
PoolRulesTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration
Chunk
Conflicting content
import org.candlepin.model.Environment;
import org.candlepin.model.EnvironmentContent;
import org.candlepin.model.EnvironmentContentCurator;
<<<<<<< HEAD
import org.candlepin.model.Owner;
import org.candlepin.model.OwnerCurator;
import org.candlepin.model.Product;
import org.candlepin.model.ProductCurator;
=======
import org.candlepin.service.ProductServiceAdapter;
import org.candlepin.service.SubscriptionServiceAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
import org.candlepin.service.impl.DefaultUniqueIdGenerator;

import org.junit.Before;
Solution content
import org.candlepin.model.Environment;
import org.candlepin.model.EnvironmentContent;
import org.candlepin.model.EnvironmentContentCurator;
import org.candlepin.model.Owner;
import org.candlepin.model.OwnerCurator;
import org.candlepin.model.Product;
import org.candlepin.model.ProductCurator;
import org.candlepin.service.impl.DefaultUniqueIdGenerator;

import org.junit.Before;
File
ContentResourceTest.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    private I18n i18n;
    private EnvironmentContentCurator envContentCurator;
    private PoolManager poolManager;
<<<<<<< HEAD
    private ProductCurator productCurator;
    private OwnerCurator oc;
=======
    private ProductServiceAdapter productAdapter;
    private SubscriptionServiceAdapter subAdapter;
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183

    @Before
    public void init() {
Solution content
    private I18n i18n;
    private EnvironmentContentCurator envContentCurator;
    private PoolManager poolManager;
    private ProductCurator productCurator;
    private OwnerCurator oc;

    @Before
    public void init() {
File
ContentResourceTest.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
        cc = mock(ContentCurator.class);
        envContentCurator = mock(EnvironmentContentCurator.class);
        poolManager = mock(PoolManager.class);
<<<<<<< HEAD
        oc = mock(OwnerCurator.class);
        productCurator = mock(ProductCurator.class);

        cr = new ContentResource(cc, i18n, new DefaultUniqueIdGenerator(),
            envContentCurator, poolManager, productCurator, oc);

=======
        productAdapter = mock(ProductServiceAdapter.class);
        subAdapter = mock(SubscriptionServiceAdapter.class);
        cr = new ContentResource(cc, i18n, new DefaultUniqueIdGenerator(),
            envContentCurator, poolManager, subAdapter, productAdapter);
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    }

    @Test
Solution content
        cc = mock(ContentCurator.class);
        envContentCurator = mock(EnvironmentContentCurator.class);
        poolManager = mock(PoolManager.class);
        oc = mock(OwnerCurator.class);
        productCurator = mock(ProductCurator.class);

        cr = new ContentResource(
            cc, i18n, new DefaultUniqueIdGenerator(), envContentCurator, poolManager, productCurator, oc
        );
    }

    @Test
File
ContentResourceTest.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        verify(cc).find(eq(contentId));
        verify(cc).createOrUpdate(eq(content));
<<<<<<< HEAD
        verify(productCurator).getProductsWithContent(owner, Arrays.asList(contentId));
        verify(poolManager).regenerateCertificatesOf(eq(owner), eq(productId), eq(true));
=======
        verify(productAdapter).getProductsWithContent(setFrom(contentId));
        verify(poolManager).regenerateCertificatesOf(eq(subAdapter), eq("productid"), eq(true));
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    }

    @Test(expected = UnsupportedOperationException.class)
Solution content
        verify(cc, never()).find(eq(contentId));
        verify(cc, never()).createOrUpdate(eq(content));
        verify(productCurator, never()).getProductsWithContent(owner, Arrays.asList(contentId));
        // verify(poolManager, never()).regenerateCertificatesOf(eq(owner), eq(productId), eq(true));
    }

    @Test(expected = UnsupportedOperationException.class)
File
ContentResourceTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
    }

    @Test
<<<<<<< HEAD
    public void testGetChangedProductsNoNewProducts() {
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Set products = new HashSet();

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(0)).find(oldProduct.getUuid());

        assertTrue(changed.isEmpty());
    }

    @Test
    public void testGetChangedProductsAllBrandNew() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.lookupById(newProduct.getOwner(), newProduct.getId()))
            .thenReturn(null);

        Set changed = importer.getChangedProducts(products);

        assertTrue(changed.isEmpty());
    }

    @Test
    public void testGetChangedProductsAllIdentical() {
        Owner owner = new Owner("Test Corporation");
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Set products = new HashSet();
        products.add(oldProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertTrue(changed.isEmpty());
    }

    @Test
    public void testGetChangedProductsNameChanged() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name new", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid())).thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsMultiplierChanged() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        oldProduct.setMultiplier(1L);
        newProduct.setMultiplier(2L);

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsAttributeAdded() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        newProduct.setAttribute("fake attr", "value");

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsAttributeRemoved() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        oldProduct.setAttribute("fake attr", "value");

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsAttributeModified() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        oldProduct.setAttribute("fake attr", "value");
        newProduct.setAttribute("fake attr", "value new");

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsAttributeSwapped() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        oldProduct.setAttribute("fake attr", "value");
        newProduct.setAttribute("other fake attr", "value");

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsContentAdded() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Content content = new Content();

        newProduct.addContent(content);

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsContentRemoved() {
        Owner owner = new Owner("Test Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Content content = new Content();

        oldProduct.addContent(content);

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsContentSwapped() {
        Owner owner = new Owner("Example-Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Content content = new Content(owner, "foobar", null, null, null, null, null, null, null);
        Content content2 = new Content(owner, "baz", null, null, null, null, null, null, null);

        oldProduct.addContent(content);
        newProduct.addContent(content2);

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
    public void testGetChangedProductsContentEnabledToggled() {
        Owner owner = new Owner("Example-Corporation");
        Product newProduct = TestUtil.createProduct("fake id", "fake name", owner);
        Product oldProduct = TestUtil.createProduct("fake id", "fake name", owner);

        Content content = new Content(owner, "foobar", null, null, null, null, null, null, null);

        oldProduct.addContent(content);
        newProduct.addEnabledContent(content);

        Set products = new HashSet();
        products.add(newProduct);

        when(productCuratorMock.find(oldProduct.getUuid()))
            .thenReturn(oldProduct);

        Set changed = importer.getChangedProducts(products);

        verify(productCuratorMock, times(1)).find(oldProduct.getUuid());

        assertEquals(1, changed.size());
    }

    @Test
=======
>>>>>>> 3b56922c03fe0a58f2a0ddd2082f0ae1c1cfe183
    public void testVendorSetToUnknown() throws Exception {
        Product product = TestUtil.createProduct(owner);
        addNoVendorContentTo(product);
Solution content
    }

    @Test

    public void testVendorSetToUnknown() throws Exception {
        Product product = TestUtil.createProduct(owner);
        addNoVendorContentTo(product);
File
ProductImporterTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration