Search in sources :

Example 6 with TitanManagement

use of com.thinkaurelius.titan.core.schema.TitanManagement in project titan by thinkaurelius.

the class AbstractTitanGraphProvider method loadGraphData.

@Override
public void loadGraphData(final Graph g, final LoadGraphWith loadGraphWith, final Class testClass, final String testName) {
    if (loadGraphWith != null) {
        this.createIndices((TitanGraph) g, loadGraphWith.value());
    } else {
        if (TransactionTest.class.equals(testClass) && testName.equalsIgnoreCase("shouldExecuteWithCompetingThreads")) {
            TitanManagement mgmt = ((TitanGraph) g).openManagement();
            mgmt.makePropertyKey("blah").dataType(Double.class).make();
            mgmt.makePropertyKey("bloop").dataType(Integer.class).make();
            mgmt.makePropertyKey("test").dataType(Object.class).make();
            mgmt.makeEdgeLabel("friend").make();
            mgmt.commit();
        }
    }
    super.loadGraphData(g, loadGraphWith, testClass, testName);
}
Also used : StandardTitanGraph(com.thinkaurelius.titan.graphdb.database.StandardTitanGraph) TitanGraph(com.thinkaurelius.titan.core.TitanGraph) TransactionTest(org.apache.tinkerpop.gremlin.structure.TransactionTest) TitanManagement(com.thinkaurelius.titan.core.schema.TitanManagement)

Example 7 with TitanManagement

use of com.thinkaurelius.titan.core.schema.TitanManagement in project titan by thinkaurelius.

the class ManagementTest method testReservedNamesRejectedForEdgeLabels.

@Test
public void testReservedNamesRejectedForEdgeLabels() {
    for (String s : ILLEGAL_USER_DEFINED_NAMES) {
        TitanManagement tm = graph.openManagement();
        try {
            tm.makeEdgeLabel(s);
            Assert.fail("Edge label \"" + s + "\" must be rejected");
        } catch (IllegalArgumentException e) {
            log.debug("Caught expected exception", e);
        } finally {
            tm.commit();
        }
    }
}
Also used : TitanManagement(com.thinkaurelius.titan.core.schema.TitanManagement) Test(org.junit.Test) TitanGraphBaseTest(com.thinkaurelius.titan.graphdb.TitanGraphBaseTest)

Example 8 with TitanManagement

use of com.thinkaurelius.titan.core.schema.TitanManagement in project titan by thinkaurelius.

the class ManagementTest method testReservedNamesRejectedForVertexLabels.

@Test
public void testReservedNamesRejectedForVertexLabels() {
    for (String s : ILLEGAL_USER_DEFINED_NAMES) {
        TitanManagement tm = graph.openManagement();
        VertexLabelMaker vlm = null;
        try {
            vlm = tm.makeVertexLabel(s);
            Assert.fail("Vertex label \"" + s + "\" must be rejected");
        } catch (IllegalArgumentException e) {
            log.debug("Caught expected exception", e);
        } finally {
            tm.commit();
        }
    }
}
Also used : VertexLabelMaker(com.thinkaurelius.titan.core.schema.VertexLabelMaker) TitanManagement(com.thinkaurelius.titan.core.schema.TitanManagement) Test(org.junit.Test) TitanGraphBaseTest(com.thinkaurelius.titan.graphdb.TitanGraphBaseTest)

Example 9 with TitanManagement

use of com.thinkaurelius.titan.core.schema.TitanManagement in project incubator-atlas by apache.

the class Titan1GraphDatabase method validateIndexBackend.

static void validateIndexBackend(Configuration config) {
    String configuredIndexBackend = config.getString(INDEX_BACKEND_CONF);
    TitanManagement managementSystem = getGraphInstance().openManagement();
    String currentIndexBackend = managementSystem.get(INDEX_BACKEND_CONF);
    managementSystem.commit();
    if (!configuredIndexBackend.equals(currentIndexBackend)) {
        throw new RuntimeException("Configured Index Backend " + configuredIndexBackend + " differs from earlier configured Index Backend " + currentIndexBackend + ". Aborting!");
    }
}
Also used : TitanManagement(com.thinkaurelius.titan.core.schema.TitanManagement)

Example 10 with TitanManagement

use of com.thinkaurelius.titan.core.schema.TitanManagement in project incubator-atlas by apache.

the class Titan0GraphDatabase method validateIndexBackend.

static void validateIndexBackend(Configuration config) {
    String configuredIndexBackend = config.getString(INDEX_BACKEND_CONF);
    TitanManagement managementSystem = null;
    try {
        managementSystem = getGraphInstance().getManagementSystem();
        String currentIndexBackend = managementSystem.get(INDEX_BACKEND_CONF);
        if (!equals(configuredIndexBackend, currentIndexBackend)) {
            throw new RuntimeException("Configured Index Backend " + configuredIndexBackend + " differs from earlier configured Index Backend " + currentIndexBackend + ". Aborting!");
        }
    } finally {
        if (managementSystem != null) {
            managementSystem.commit();
        }
    }
}
Also used : TitanManagement(com.thinkaurelius.titan.core.schema.TitanManagement)

Aggregations

TitanManagement (com.thinkaurelius.titan.core.schema.TitanManagement)21 Test (org.junit.Test)8 TitanGraphBaseTest (com.thinkaurelius.titan.graphdb.TitanGraphBaseTest)7 PropertyKey (com.thinkaurelius.titan.core.PropertyKey)6 TitanGraphIndex (com.thinkaurelius.titan.core.schema.TitanGraphIndex)6 ScanMetrics (com.thinkaurelius.titan.diskstorage.keycolumnvalue.scan.ScanMetrics)5 StandardTitanGraph (com.thinkaurelius.titan.graphdb.database.StandardTitanGraph)5 RelationTypeIndex (com.thinkaurelius.titan.core.schema.RelationTypeIndex)4 EdgeLabel (com.thinkaurelius.titan.core.EdgeLabel)3 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)3 RelationType (com.thinkaurelius.titan.core.RelationType)2 TitanException (com.thinkaurelius.titan.core.TitanException)2 TitanGraph (com.thinkaurelius.titan.core.TitanGraph)2 TitanVertex (com.thinkaurelius.titan.core.TitanVertex)2 SchemaStatus (com.thinkaurelius.titan.core.schema.SchemaStatus)2 Timer (com.thinkaurelius.titan.diskstorage.util.time.Timer)2 HashMap (java.util.HashMap)2 Function (com.google.common.base.Function)1 TitanEdge (com.thinkaurelius.titan.core.TitanEdge)1 TitanTransaction (com.thinkaurelius.titan.core.TitanTransaction)1