Projects >> modeshape >>e2e665fab36a1d35f1399e95433229a0ba27623f

Chunk
Conflicting content
                // reuse the existing storage-related components ...
                this.cache = other.cache;
                this.context = other.context;
<<<<<<< HEAD
                this.database = other.database;
                this.txnMgr = database.getCache().getAdvancedCache().getTransactionManager();
                validateTransactionsEnabled();
=======
                this.connectors = other.connectors;
                this.documentStore = other.documentStore;
                this.txnMgr = documentStore.transactionManager();
>>>>>>> 85b135ae9112fb075018544b8f8166a87a331371
                MonitorFactory monitorFactory = new RepositoryMonitorFactory(this);
                this.transactions = createTransactions(config.getTransactionMode(), monitorFactory, this.txnMgr);
                //suspend any potential existing transaction, so that the initialization is "atomic"
Solution content
                // reuse the existing storage-related components ...
                this.cache = other.cache;
                this.context = other.context;
                this.connectors = other.connectors;
                this.documentStore = other.documentStore;
                this.txnMgr = documentStore.transactionManager();
                validateTransactionsEnabled();
                MonitorFactory monitorFactory = new RepositoryMonitorFactory(this);
                this.transactions = createTransactions(config.getTransactionMode(), monitorFactory, this.txnMgr);
File
JcrRepository.java
Developer's decision
Combination
Kind of conflict
Attribute
Method invocation
Variable
Chunk
Conflicting content
                // find the Schematic database and Infinispan Cache ...
                CacheContainer container = config.getContentCacheContainer();
                String cacheName = config.getCacheName();
<<<<<<< HEAD
                this.database = Schematic.get(container, cacheName);
                assert this.database != null;
                this.txnMgr = this.database.getCache().getAdvancedCache().getTransactionManager();
                validateTransactionsEnabled();
=======
                List connectorComponents = config.getFederation().getConnectors();
                this.connectors = new Connectors(this, connectorComponents);
                SchematicDb database = Schematic.get(container, cacheName);
                this.documentStore = connectors.hasConnectors() ? new FederatedDocumentStore(connectors, database) : new LocalDocumentStore(
                                                                                                                                            database);
                // this.documentStore = new LocalDocumentStore(database);
                this.txnMgr = this.documentStore.transactionManager();
>>>>>>> 85b135ae9112fb075018544b8f8166a87a331371
                MonitorFactory monitorFactory = new RepositoryMonitorFactory(this);
                this.transactions = createTransactions(config.getTransactionMode(), monitorFactory, this.txnMgr);
                //suspend any potential existing transaction, so that the initialization is "atomic"
Solution content
                // find the Schematic database and Infinispan Cache ...
                CacheContainer container = config.getContentCacheContainer();
                String cacheName = config.getCacheName();
                List connectorComponents = config.getFederation().getConnectors();
                this.connectors = new Connectors(this, connectorComponents);
                SchematicDb database = Schematic.get(container, cacheName);
                this.documentStore = connectors.hasConnectors() ? new FederatedDocumentStore(connectors, database) : new LocalDocumentStore(
                                                                                                                                            database);
                // this.documentStore = new LocalDocumentStore(database);
                this.txnMgr = this.documentStore.transactionManager();
                validateTransactionsEnabled();
                MonitorFactory monitorFactory = new RepositoryMonitorFactory(this);
                this.transactions = createTransactions(config.getTransactionMode(), monitorFactory, this.txnMgr);
File
JcrRepository.java
Developer's decision
Combination
Kind of conflict
Assert statement
Attribute
Comment
Method invocation
Variable
Chunk
Conflicting content
package org.modeshape.jcr;

import static junit.framework.Assert.assertEquals;
<<<<<<< HEAD
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
=======
>>>>>>> 85b135ae9112fb075018544b8f8166a87a331371
import javax.jcr.NamespaceRegistry;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
Solution content
package org.modeshape.jcr;

import static junit.framework.Assert.assertEquals;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import javax.jcr.NamespaceRegistry;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
File
JcrNodeTypesTest.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
import javax.jcr.NamespaceRegistry;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
<<<<<<< HEAD
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.NodeTypeManager;
import javax.jcr.nodetype.PropertyDefinition;
=======
>>>>>>> 85b135ae9112fb075018544b8f8166a87a331371
import org.junit.Test;
import org.modeshape.common.FixFor;
Solution content
import javax.jcr.NamespaceRegistry;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.NodeTypeManager;
import javax.jcr.nodetype.PropertyDefinition;
import org.junit.Test;
import org.modeshape.common.FixFor;
File
JcrNodeTypesTest.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
 */
package org.modeshape.jcr;

<<<<<<< HEAD
=======
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
>>>>>>> 85b135ae9112fb075018544b8f8166a87a331371
import java.io.File;
import java.util.UUID;
import javax.jcr.NoSuchWorkspaceException;
Solution content
 */
package org.modeshape.jcr;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.io.File;
import java.util.UUID;
import javax.jcr.NoSuchWorkspaceException;
File
JcrRepositoryStartupTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.junit.Test;
import org.modeshape.common.FixFor;
import org.modeshape.common.util.FileUtil;
<<<<<<< HEAD
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
=======
import org.modeshape.connector.mock.MockConnector;
import org.modeshape.jcr.api.Workspace;
import org.modeshape.jcr.api.federation.FederationManager;
>>>>>>> 85b135ae9112fb075018544b8f8166a87a331371

/**
 * Tests that related to repeatedly starting/stopping repositories (without another repository configured in the @Before and @After
Solution content
import org.junit.Test;
import org.modeshape.common.FixFor;
import org.modeshape.common.util.FileUtil;
import org.modeshape.connector.mock.MockConnector;
import org.modeshape.jcr.api.Workspace;
import org.modeshape.jcr.api.federation.FederationManager;

/**
 * Tests that related to repeatedly starting/stopping repositories (without another repository configured in the @Before and @After
File
JcrRepositoryStartupTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
        }, repositoryConfigFile);
    }

<<<<<<< HEAD
    @FixFor( "MODE-1693" )
    @Test(expected = IllegalStateException.class)
    public void shouldNotStartIfTransactionsArentEnabled() throws Exception {
        startRunStop(null, "config/repo-config-no-transactions.json");
=======
    @Test
    @FixFor( "MODE-1716" )
    public void shouldPersistExternalProjectionToFederatedNodeMappings() throws Exception {
        FileUtil.delete("target/federation_persistent_repository");

        String repositoryConfigFile = "config/repo-config-mock-federation-persistent.json";
        startRunStop(new RepositoryOperation() {
            @Override
            public Void call() throws Exception {
                Session session = repository.login();
                Node testRoot = session.getRootNode().addNode("testRoot");
                session.save();

                FederationManager federationManager = ((Workspace) session.getWorkspace()).getFederationManager();

                federationManager.createExternalProjection("/testRoot", MockConnector.SOURCE_NAME, MockConnector.DOC1_LOCATION, "federated1");
                federationManager.createExternalProjection("/testRoot", MockConnector.SOURCE_NAME, MockConnector.DOC2_LOCATION, null);
                Node doc1Federated = session.getNode("/testRoot/federated1");
                assertNotNull(doc1Federated);
                assertEquals(testRoot.getIdentifier(), doc1Federated.getParent().getIdentifier());

                return null;
            }
        }, repositoryConfigFile);

        startRunStop(new RepositoryOperation() {
            @Override
            public Void call() throws Exception {
                Session session = repository.login();
                Node testRoot = session.getNode("/testRoot");
                assertNotNull(testRoot);

                Node doc1Federated = session.getNode("/testRoot/federated1");
                assertNotNull(doc1Federated);
                assertEquals(testRoot.getIdentifier(), doc1Federated.getParent().getIdentifier());

                Node doc2Federated = session.getNode("/testRoot" + MockConnector.DOC2_LOCATION);
                assertNotNull(doc2Federated);
                assertEquals(testRoot.getIdentifier(), doc2Federated.getParent().getIdentifier());
                return null;
            }
        }, repositoryConfigFile);
>>>>>>> 85b135ae9112fb075018544b8f8166a87a331371
    }
}
Solution content
        }, repositoryConfigFile);
    }

    @FixFor( "MODE-1693" )
    @Test( expected = IllegalStateException.class )
    public void shouldNotStartIfTransactionsArentEnabled() throws Exception {
        startRunStop(null, "config/repo-config-no-transactions.json");
    }

    @Test
    @FixFor( "MODE-1716" )
    public void shouldPersistExternalProjectionToFederatedNodeMappings() throws Exception {
        FileUtil.delete("target/federation_persistent_repository");

        String repositoryConfigFile = "config/repo-config-mock-federation-persistent.json";
        startRunStop(new RepositoryOperation() {
            @Override
            public Void call() throws Exception {
                Session session = repository.login();
                Node testRoot = session.getRootNode().addNode("testRoot");
                session.save();

                FederationManager federationManager = ((Workspace)session.getWorkspace()).getFederationManager();

                federationManager.createExternalProjection("/testRoot",
                                                           MockConnector.SOURCE_NAME,
                                                           MockConnector.DOC1_LOCATION,
                                                           "federated1");
                federationManager.createExternalProjection("/testRoot",
                                                           MockConnector.SOURCE_NAME,
                                                           MockConnector.DOC2_LOCATION,
                                                           null);
                Node doc1Federated = session.getNode("/testRoot/federated1");
                assertNotNull(doc1Federated);
                assertEquals(testRoot.getIdentifier(), doc1Federated.getParent().getIdentifier());

                return null;
            }
        }, repositoryConfigFile);

        startRunStop(new RepositoryOperation() {
            @Override
            public Void call() throws Exception {
                Session session = repository.login();
                Node testRoot = session.getNode("/testRoot");
                assertNotNull(testRoot);

                Node doc1Federated = session.getNode("/testRoot/federated1");
                assertNotNull(doc1Federated);
                assertEquals(testRoot.getIdentifier(), doc1Federated.getParent().getIdentifier());

                Node doc2Federated = session.getNode("/testRoot" + MockConnector.DOC2_LOCATION);
                assertNotNull(doc2Federated);
                assertEquals(testRoot.getIdentifier(), doc2Federated.getParent().getIdentifier());
                return null;
            }
        }, repositoryConfigFile);
    }
}
File
JcrRepositoryStartupTest.java
Developer's decision
Concatenation
Kind of conflict
Annotation
Method invocation
Method signature
Variable