Projects >> candlepin >>e63f62d5a1b6110a2a643a0d7f716c0cf5fa9263

Chunk
Conflicting content
    }

    public String toString() {
<<<<<<< HEAD
        return String.format(
            "Pool[id: %s, owner: %s, product: %s, quantity: %d, expires: %s]",
            this.getId(),
            this.owner,
            this.getProductId(),
            this.getQuantity(),
            this.getEndDate()
        );
    }

    @JsonIgnore
    public Set getProvidedProducts() {
        return this.providedProducts;
=======
        return "Pool";
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446
    }

    public void addProvidedProduct(Product provided) {
Solution content
    }

    public String toString() {
        return String.format(
            "Pool",
            this.getType(),
            this.getProductId(),
            this.getProductName(),
            this.getId(),
            this.getQuantity()
        );
    }

    @JsonIgnore
    public Set getProvidedProducts() {
        return this.providedProducts;
    }

    public void addProvidedProduct(Product provided) {
File
Pool.java
Developer's decision
Manual
Kind of conflict
Annotation
Attribute
Method invocation
Method signature
Return statement
Chunk
Conflicting content
    private boolean shouldGenerateV3(Entitlement entitlement) {
        Consumer consumer = entitlement.getConsumer();
<<<<<<< HEAD

        if (consumer.getType().isManifest()) {
            for (ConsumerCapability capability : consumer.getCapabilities()) {
                if ("cert_v3".equals(capability.getName())) {
                    return true;
                }
            }
            return false;
        }
        else if (consumer.getType().getLabel().equals(
            ConsumerTypeEnum.HYPERVISOR.getLabel())) {
            // Hypervisors in this context don't use content, so allow v3
            return true;
        }
        else {
            String entitlementVersion = consumer.getFact("system.certificate_version");
            log.debug("Entitlement version: {}", entitlementVersion);

            return entitlementVersion != null && entitlementVersion.startsWith("3.");
        }
=======
        return consumer.isCertV3Capable();
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446
    }

    /**
Solution content
    private boolean shouldGenerateV3(Entitlement entitlement) {
        Consumer consumer = entitlement.getConsumer();
        return consumer != null && consumer.isCertV3Capable();
    }

    /**
File
DefaultEntitlementCertServiceAdapter.java
Developer's decision
Manual
Kind of conflict
If statement
Method invocation
Return statement
Chunk
Conflicting content
                if (StringUtils.isBlank(c.getVendor())) {
                    c.setVendor("unknown");
                }
<<<<<<< HEAD
                c.setOwner(o);
=======

                /*
                 * On standalone servers we will set metadata expire to 1 second so
                 * clients an immediately get changes to content when published on the
                 * server. We would use 0, but the client plugin interprets this as unset
                 * and ignores it completely resulting in the default yum values being
                 * used.
                 *
                 * We know this is a standalone server due to the fact that import is
                 * being used, so there is no need to guard this behavior.
                 */
                c.setMetadataExpire(new Long(1));

>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446
                contentCurator.createOrUpdate(c);
            }
Solution content
                if (StringUtils.isBlank(c.getVendor())) {
                    c.setVendor("unknown");
                }

                c.setOwner(o);

                /*
                 * On standalone servers we will set metadata expire to 1 second so
                 * clients an immediately get changes to content when published on the
                 * server. We would use 0, but the client plugin interprets this as unset
                 * and ignores it completely resulting in the default yum values being
                 * used.
                 *
                 * We know this is a standalone server due to the fact that import is
                 * being used, so there is no need to guard this behavior.
                 */
                c.setMetadataExpire(new Long(1));

                contentCurator.createOrUpdate(c);
            }
File
ProductImporter.java
Developer's decision
Concatenation
Kind of conflict
Comment
Method invocation
Chunk
Conflicting content
package org.candlepin.policy;

import static org.junit.Assert.*;
<<<<<<< HEAD
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
=======
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.when;
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

import org.candlepin.common.config.Configuration;
import org.candlepin.config.ConfigProperties;
Solution content
package org.candlepin.policy;

import static org.junit.Assert.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;

import org.candlepin.common.config.Configuration;
import org.candlepin.config.ConfigProperties;
File
AutobindRulesTest.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    @Test
    public void testSelectBestPoolsFiltersTooMuchContent() {
<<<<<<< HEAD
        Product mktProduct = new Product(productId, "A test product", owner);
        Product engProduct = new Product(Integer.toString(TestUtil.randomInt()),
            "An ENG product", owner);

        Set productContent = new HashSet();
        for (int i = 0; i < X509ExtensionUtil.V1_CONTENT_LIMIT + 1; i++) {
            productContent.add(new Content(this.owner, "fake" + i, "fake" + i,
                "fake" + i, "yum", "vendor", "", "", ""));
        }

        engProduct.setContent(productContent);
        Pool pool = TestUtil.createPool(owner, mktProduct);
        pool.setId("DEAD-BEEF");
        pool.addProvidedProduct(engProduct);
=======
        Pool pool = createV3OnlyPool();
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

        List pools = new LinkedList();
        pools.add(pool);
Solution content
    @Test
    public void testSelectBestPoolsFiltersTooMuchContent() {
        Pool pool = createV3OnlyPool();

        List pools = new LinkedList();
        pools.add(pool);
File
AutobindRulesTest.java
Developer's decision
Version 2
Kind of conflict
For statement
Method invocation
Variable
Chunk
Conflicting content
        List pools = new LinkedList();

    }

    @Test
<<<<<<< HEAD
    public void testSelectBestPoolsLotsOfContentV2Client() {
        Product mktProduct = new Product(
            productId,
            "A test product",
            owner
        );
        Product engProduct = new Product(
            Integer.toString(TestUtil.randomInt()),
            "An ENG product",
            owner
        );
=======
    public void testSelectBestPoolsDoesntFilterTooMuchContentForHypervisor() {
        Pool pool = createV3OnlyPool();

        List pools = new LinkedList();
        pools.add(pool);

        // Create a hypervisor consumer which does *not* have a certificate version fact.
        // This replicates the real world scenario for virt-who created hypervisors.
        consumer = new Consumer("test consumer", "test user", owner,
                new ConsumerType(ConsumerTypeEnum.HYPERVISOR));

        List results = autobindRules.selectBestPools(consumer,
                new String[]{ productId }, pools, compliance, null, new HashSet(),
                false);
        assertEquals(1, results.size());
    }

    @Test
    public void testSelectBestPoolsLotsOfContentV3Client() {
        Pool pool = createV3OnlyPool();
        pools.add(pool);

        // Shouldn't throw an exception as we do for certv1 clients.
        consumer.setFact("system.certificate_version", "3.5");
        List bestPools = autobindRules.selectBestPools(consumer,
            new String[]{ productId }, pools, compliance, null, new HashSet(),
            false);
        assertEquals(1, bestPools.size());
    }


    /*
     * Create a pool with too much content for a V1 certificate, consumer must be V3
     * capable.
     */
    public Pool createV3OnlyPool() {
        Product mktProduct = new Product(productId, "A test product");
        Product engProduct = new Product(Integer.toString(TestUtil.randomInt()),
            "An ENG product");
        when(this.prodAdapter.getProductById(productId)).thenReturn(mktProduct);
        when(this.prodAdapter.getProductById(engProduct.getId())).thenReturn(engProduct);
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

        Set productContent = new HashSet();
        for (int i = 0; i < X509ExtensionUtil.V1_CONTENT_LIMIT + 1; i++) {
Solution content
    }

    @Test
    public void testSelectBestPoolsLotsOfContentV2Client() {
        Product mktProduct = new Product(
            productId,
            "A test product",
            owner
        );
        Product engProduct = new Product(
            Integer.toString(TestUtil.randomInt()),
            "An ENG product",
            owner
        );
    }

    public void testSelectBestPoolsDoesntFilterTooMuchContentForHypervisor() {
        Pool pool = createV3OnlyPool();

        List pools = new LinkedList();
        pools.add(pool);

        // Create a hypervisor consumer which does *not* have a certificate version fact.
        // This replicates the real world scenario for virt-who created hypervisors.
        consumer = new Consumer("test consumer", "test user", owner,
                new ConsumerType(ConsumerTypeEnum.HYPERVISOR));

        List results = autobindRules.selectBestPools(consumer,
                new String[]{ productId }, pools, compliance, null, new HashSet(),
                false);
        assertEquals(1, results.size());
    }

    @Test
    public void testSelectBestPoolsLotsOfContentV3Client() {
        Pool pool = createV3OnlyPool();

        List pools = new LinkedList();
        pools.add(pool);

        // Shouldn't throw an exception as we do for certv1 clients.
        consumer.setFact("system.certificate_version", "3.5");
        List bestPools = autobindRules.selectBestPools(consumer,
            new String[]{ productId }, pools, compliance, null, new HashSet(),
            false);
        assertEquals(1, bestPools.size());
    }


    /*
     * Create a pool with too much content for a V1 certificate, consumer must be V3
     * capable.
     */
    public Pool createV3OnlyPool() {
        Product mktProduct = new Product(productId, "A test product", owner);
        Product engProduct = new Product(
            Integer.toString(TestUtil.randomInt()), "An ENG product", owner
        );

        Set productContent = new HashSet();
        for (int i = 0; i < X509ExtensionUtil.V1_CONTENT_LIMIT + 1; i++) {
File
AutobindRulesTest.java
Developer's decision
Manual
Kind of conflict
Annotation
Comment
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
        engProduct.setContent(productContent);
        Pool pool = TestUtil.createPool(owner, mktProduct);
        pool.setId("DEAD-BEEF");
<<<<<<< HEAD
        pool.addProvidedProduct(engProduct);

        List pools = new LinkedList();
        pools.add(pool);

        // Shouldn't throw an exception as we do for certv1 clients.
        consumer.setFact("system.certificate_version", "2.5");
        List bestPools = autobindRules.selectBestPools(consumer,
            new String[]{ productId }, pools, compliance, null, new HashSet(),
            false);
        assertEquals(1, bestPools.size());
=======
        pool.addProvidedProduct(new ProvidedProduct(engProduct.getId(),
            engProduct.getName()));
        return pool;
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446
    }

    @Test
Solution content
        engProduct.setContent(productContent);
        Pool pool = TestUtil.createPool(owner, mktProduct);
        pool.setId("DEAD-BEEF");

        pool.addProvidedProduct(engProduct);

        return pool;
    }

    @Test
File
AutobindRulesTest.java
Developer's decision
Combination
Kind of conflict
Comment
Method invocation
Return statement
Variable
Chunk
Conflicting content
        return e;
    }

<<<<<<< HEAD
    private Consumer mockConsumer(Product... installedProducts) {
=======
    private Entitlement mockUnmappedGuestEntitlement(Consumer consumer, String productId,
            DateRange range, String ... providedProductIds) {

        consumer.setFact("virt.is_guest", "True");
        Entitlement e = mockEntitlement(consumer, productId, range, providedProductIds);
        Pool p = e.getPool();
        Date endDateOverride = new Date(consumer.getCreated().getTime() +
                (24 * 60 * 60 * 1000));
        e.setEndDateOverride(endDateOverride);

        // Setup the attributes for stacking:
        p.setAttribute("virt_only", "true");
        p.setAttribute("unmapped_guests_only", "true");
        p.addProductAttribute(new ProductPoolAttribute("virt_limit", "unlimited",
                productId));

        return e;
    }

    private Consumer mockConsumer(String ... installedProducts) {
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446
        Consumer c = new Consumer();
        c.setType(new ConsumerType(ConsumerType.ConsumerTypeEnum.SYSTEM));
        for (Product product : installedProducts) {
Solution content
        return e;
    }

    private Entitlement mockUnmappedGuestEntitlement(Consumer consumer, Product product,
            DateRange range, Product ... providedProducts) {

        consumer.setFact("virt.is_guest", "True");
        Entitlement e = mockEntitlement(consumer, product, range, providedProducts);
        Pool p = e.getPool();
        Date endDateOverride = new Date(consumer.getCreated().getTime() + (24 * 60 * 60 * 1000));
        e.setEndDateOverride(endDateOverride);

        // Setup the attributes for stacking:
        p.setAttribute("virt_only", "true");
        p.setAttribute("unmapped_guests_only", "true");
        product.setAttribute("virt_limit", "unlimited");

        return e;
    }
    private Consumer mockConsumer(Product... installedProducts) {
        Consumer c = new Consumer();
        c.setType(new ConsumerType(ConsumerType.ConsumerTypeEnum.SYSTEM));
        for (Product product : installedProducts) {
File
InstalledProductStatusCalculatorTest.java
Developer's decision
Manual
Kind of conflict
Method declaration
Method signature
Chunk
Conflicting content
        // Environment, with promoted content:
        Environment e = new Environment("env1", "Env 1", owner);
<<<<<<< HEAD
        e.getEnvironmentContent().add(new EnvironmentContent(e, content, true));
        when(entitlement.getConsumer().getEnvironment()).thenReturn(e);
=======
        e.getEnvironmentContent().add(new EnvironmentContent(e, content.getId(), true));
        consumer.setEnvironment(e);
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

        Map promotedContent =
            new HashMap();
Solution content
        // Environment, with promoted content:
        Environment e = new Environment("env1", "Env 1", owner);

        e.getEnvironmentContent().add(new EnvironmentContent(e, content, true));
        this.consumer.setEnvironment(e);

        Map promotedContent =
            new HashMap();
File
DefaultEntitlementCertServiceAdapterTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
        // Setup an environment for the consumer:
        Environment e = new Environment("env1", "Awesome Environment #1", owner);
<<<<<<< HEAD
        e.getEnvironmentContent().add(new EnvironmentContent(e, content, true));
        when(entitlement.getConsumer().getEnvironment()).thenReturn(e);
=======
        e.getEnvironmentContent().add(new EnvironmentContent(e, content.getId(), true));
        consumer.setEnvironment(e);
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

        certServiceAdapter.createX509Certificate(entitlement,
            product, new HashSet(), new BigInteger("1234"), keyPair, true);
Solution content
        // Setup an environment for the consumer:
        Environment e = new Environment("env1", "Awesome Environment #1", owner);
        e.getEnvironmentContent().add(new EnvironmentContent(e, content, true));
        this.consumer.setEnvironment(e);

        certServiceAdapter.createX509Certificate(entitlement,
            product, new HashSet(), new BigInteger("1234"), keyPair, true);
File
DefaultEntitlementCertServiceAdapterTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
        // Setup an environment for the consumer:
        Environment e = new Environment("env1", "Awesome Environment #1", owner);
<<<<<<< HEAD
        e.getEnvironmentContent().add(new EnvironmentContent(e, content, true));
        when(entitlement.getConsumer().getEnvironment()).thenReturn(e);
=======
        e.getEnvironmentContent().add(new EnvironmentContent(e, content.getId(), true));
        consumer.setEnvironment(e);
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

        certServiceAdapter.createX509Certificate(entitlement,
            product, new HashSet(), new BigInteger("1234"), keyPair, true);
Solution content
        // Setup an environment for the consumer:
        Environment e = new Environment("env1", "Awesome Environment #1", owner);
        e.getEnvironmentContent().add(new EnvironmentContent(e, content, true));
        this.consumer.setEnvironment(e);

        certServiceAdapter.createX509Certificate(entitlement,
            product, new HashSet(), new BigInteger("1234"), keyPair, true);
File
DefaultEntitlementCertServiceAdapterTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
    public void testPrepareV3EntitlementDataForBooleans() throws IOException {
        Set products = new HashSet();
        products.add(product);
<<<<<<< HEAD
        when(entitlement.getConsumer().getFact("system.certificate_version")).thenReturn("3.2");
        when(entitlement.getConsumer().getUuid()).thenReturn("test-consumer");
        when(entitlement.getConsumer().getFact("uname.machine")).thenReturn("x86_64");
=======
        consumer.setFact("system.certificate_version", "3.2");
        consumer.setFact("uname.machine", "x86_64");
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

        pool.getProduct().setAttribute("management_enabled", "1");
        entitlement.getPool().setAttribute("virt_only", "1");
Solution content
    public void testPrepareV3EntitlementDataForBooleans() throws IOException {
        Set products = new HashSet();
        products.add(product);

        consumer.setUuid("test-consumer");
        consumer.setFact("system.certificate_version", "3.2");
        consumer.setFact("uname.machine", "x86_64");

        pool.getProduct().setAttribute("management_enabled", "1");
        entitlement.getPool().setAttribute("virt_only", "1");
File
DefaultEntitlementCertServiceAdapterTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
                CONTENT_TYPE, CONTENT_VENDOR, url, CONTENT_GPG_URL, ARCH_LABEL));
        }
        extremeProduct.setContent(extremeContent);
<<<<<<< HEAD
        when(entitlement.getConsumer().getFact("system.certificate_version"))
            .thenReturn("3.2");
        when(entitlement.getConsumer().getUuid()).thenReturn("test-consumer");
        when(productAdapter.getProductById(eq(extremeProduct.getOwner()), eq(extremeProduct.getId())))
            .thenReturn(extremeProduct);
=======
        consumer.setFact("system.certificate_version", "3.2");
        when(productAdapter.getProductById(eq(extremeProduct.getId()))).thenReturn(extremeProduct);
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

        certServiceAdapter.prepareV3Extensions(entitlement, "prefix", null);
        Set byteExtensions =
Solution content
                CONTENT_TYPE, CONTENT_VENDOR, url, CONTENT_GPG_URL, ARCH_LABEL));
        }
        extremeProduct.setContent(extremeContent);

        consumer.setUuid("test-consumer");
        consumer.setFact("system.certificate_version", "3.2");
        consumer.setFact("uname.machine", "x86_64");

        when(productAdapter.getProductById(eq(extremeProduct.getOwner()), eq(extremeProduct.getId())))
            .thenReturn(extremeProduct);

        certServiceAdapter.prepareV3Extensions(entitlement, "prefix", null);
        Set byteExtensions =
File
DefaultEntitlementCertServiceAdapterTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
 */
package org.candlepin.sync;

<<<<<<< HEAD
import static org.junit.Assert.assertEquals;
=======
import static org.junit.Assert.*;
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446
import static org.mockito.Mockito.*;

import org.candlepin.common.config.MapConfiguration;
Solution content
 */
package org.candlepin.sync;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import org.candlepin.common.config.MapConfiguration;
File
ProductImporterTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    private ProductImporter importer;
    private ProductCurator productCuratorMock;
    private ContentCurator contentCuratorMock;
<<<<<<< HEAD
    private Owner owner = new Owner("Test Corporation");
=======
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446

    @Before
    public void setUp() throws IOException {
Solution content
    private ProductImporter importer;
    private ProductCurator productCuratorMock;
    private ContentCurator contentCuratorMock;
    private Owner owner = new Owner("Test Corporation");

    @Before
    public void setUp() throws IOException {
File
ProductImporterTest.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    }

    // Returns the Content object added
<<<<<<< HEAD
    private void addContentTo(Product p) {
        Owner owner = new Owner("Example-Corporation");
        Content c = new Content(owner, "name", "100130", "label", "type",
=======
    private Content addContentTo(Product p) {
        Content c = new Content("name", "100130", "label", "type",
>>>>>>> 5ebe95155048987c164e34261dc6730f07f7f446
            "vendor", "url", "gpgurl", "arch");
        c.setMetadataExpire(1000L);
        p.getProductContent().add(new ProductContent(p, c, true));
Solution content
    }

    // Returns the Content object added
    private Content addContentTo(Product p) {
        Owner owner = new Owner("Example-Corporation");
        Content c = new Content(
            owner, "name", "100130", "label", "type", "vendor", "url", "gpgurl", "arch"
        );

        c.setMetadataExpire(1000L);
        p.getProductContent().add(new ProductContent(p, c, true));
File
ProductImporterTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Method signature
Variable