Search in sources :

Example 1 with LabelIndex

use of org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex in project neo4j by neo4j.

the class DropOtherLabelIndexesIT method shouldDropUnselectedLabelIndexes.

/**
     * Flip between different label index providers and assert that the unselected label indexes
     * gets deleted so that the selected index will not miss updates if it wasn't the selected index in all sessions.
     */
@Test
public void shouldDropUnselectedLabelIndexes() throws Exception {
    // GIVEN
    LabelIndex[] types = LabelIndex.values();
    Set<Node> expectedNodes = new HashSet<>();
    for (int i = 0; i < 5; i++) {
        // WHEN
        GraphDatabaseService db = db(random.among(types));
        Node node = createNode(db);
        expectedNodes.add(node);
        // THEN
        assertNodes(db, expectedNodes);
        db.shutdown();
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) Node(org.neo4j.graphdb.Node) LabelIndex(org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with LabelIndex

use of org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex in project neo4j by neo4j.

the class BackupLabelIndexIT method shouldHandleBackingUpFromSourceThatSwitchesLabelIndexProviderBackupHasDifferentIndexAlsoInternally.

@Test
public void shouldHandleBackingUpFromSourceThatSwitchesLabelIndexProviderBackupHasDifferentIndexAlsoInternally() throws Exception {
    // GIVEN
    LabelIndex[] types = LabelIndex.values();
    Set<Node> expectedNodes = new HashSet<>();
    for (int i = 0; i < 5; i++) {
        // WHEN
        LabelIndex index = random.among(types);
        db = db(sourceDir, index, true);
        Node node = createNode(db);
        expectedNodes.add(node);
        // THEN
        LabelIndex backupIndex = random.among(types);
        backupTo(backupIndex, backupDir);
        LabelIndex backupDbIndex = random.among(types);
        backupDb = db(backupDir, backupDbIndex, false);
        assertNodes(backupDb, expectedNodes);
        shutdownDbs();
    }
}
Also used : Node(org.neo4j.graphdb.Node) LabelIndex(org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with LabelIndex

use of org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex in project neo4j by neo4j.

the class BackupLabelIndexIT method shouldHandleBackingUpFromSourceThatSwitchesLabelIndexProviderAllIndexConfigMatching.

@Test
public void shouldHandleBackingUpFromSourceThatSwitchesLabelIndexProviderAllIndexConfigMatching() throws Exception {
    // GIVEN
    LabelIndex[] types = LabelIndex.values();
    Set<Node> expectedNodes = new HashSet<>();
    for (int i = 0; i < 5; i++) {
        // WHEN
        LabelIndex index = random.among(types);
        db = db(sourceDir, index, true);
        Node node = createNode(db);
        expectedNodes.add(node);
        // THEN
        backupTo(index, backupDir);
        backupDb = db(backupDir, index, false);
        assertNodes(backupDb, expectedNodes);
        shutdownDbs();
    }
}
Also used : Node(org.neo4j.graphdb.Node) LabelIndex(org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 4 with LabelIndex

use of org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex in project neo4j by neo4j.

the class BackupLabelIndexIT method shouldHandleBackingUpFromSourceThatSwitchesLabelIndexProviderBackupHasDifferentIndex.

@Test
public void shouldHandleBackingUpFromSourceThatSwitchesLabelIndexProviderBackupHasDifferentIndex() throws Exception {
    // GIVEN
    LabelIndex[] types = LabelIndex.values();
    Set<Node> expectedNodes = new HashSet<>();
    for (int i = 0; i < 5; i++) {
        // WHEN
        LabelIndex index = random.among(types);
        db = db(sourceDir, index, true);
        Node node = createNode(db);
        expectedNodes.add(node);
        // THEN
        LabelIndex indexForBackup = random.among(types);
        backupTo(indexForBackup, backupDir);
        backupDb = db(backupDir, indexForBackup, false);
        assertNodes(backupDb, expectedNodes);
        shutdownDbs();
    }
}
Also used : Node(org.neo4j.graphdb.Node) LabelIndex(org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

HashSet (java.util.HashSet)4 Test (org.junit.Test)4 Node (org.neo4j.graphdb.Node)4 LabelIndex (org.neo4j.graphdb.factory.GraphDatabaseSettings.LabelIndex)4 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1