Search in sources :

Example 26 with JanusGraphManagement

use of org.janusgraph.core.schema.JanusGraphManagement in project janusgraph by JanusGraph.

the class ManagementTest method testReservedNamesRejectedForEdgeLabels.

@Test
public void testReservedNamesRejectedForEdgeLabels() {
    for (String s : ILLEGAL_USER_DEFINED_NAMES) {
        JanusGraphManagement 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 : JanusGraphManagement(org.janusgraph.core.schema.JanusGraphManagement) JanusGraphBaseTest(org.janusgraph.graphdb.JanusGraphBaseTest) Test(org.junit.Test)

Example 27 with JanusGraphManagement

use of org.janusgraph.core.schema.JanusGraphManagement in project janusgraph by JanusGraph.

the class EdgeSerializerTest method testValueOrdering.

@Test
public void testValueOrdering() {
    StandardJanusGraph graph = (StandardJanusGraph) StorageSetup.getInMemoryGraph();
    JanusGraphManagement management = graph.openManagement();
    management.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make();
    for (int i = 1; i <= 5; i++) management.makePropertyKey("key" + i).dataType(Integer.class).make();
    management.commit();
    JanusGraphVertex v1 = graph.addVertex(), v2 = graph.addVertex();
    JanusGraphEdge e1 = v1.addEdge("father", v2);
    for (int i = 1; i <= 5; i++) e1.property("key" + i, i);
    graph.tx().commit();
    e1.remove();
    graph.tx().commit();
}
Also used : JanusGraphManagement(org.janusgraph.core.schema.JanusGraphManagement) JanusGraphEdge(org.janusgraph.core.JanusGraphEdge) JanusGraphVertex(org.janusgraph.core.JanusGraphVertex) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Test(org.junit.Test)

Aggregations

JanusGraphManagement (org.janusgraph.core.schema.JanusGraphManagement)27 PropertyKey (org.janusgraph.core.PropertyKey)10 Test (org.junit.Test)10 JanusGraphIndex (org.janusgraph.core.schema.JanusGraphIndex)9 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)8 JanusGraphBaseTest (org.janusgraph.graphdb.JanusGraphBaseTest)7 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)6 JanusGraph (org.janusgraph.core.JanusGraph)5 EdgeLabel (org.janusgraph.core.EdgeLabel)4 ScanMetrics (org.janusgraph.diskstorage.keycolumnvalue.scan.ScanMetrics)4 ResourceBundle (java.util.ResourceBundle)3 JanusGraphVertex (org.janusgraph.core.JanusGraphVertex)3 RelationType (org.janusgraph.core.RelationType)3 RelationTypeIndex (org.janusgraph.core.schema.RelationTypeIndex)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 GraphTraversalSource (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource)2 JanusGraphException (org.janusgraph.core.JanusGraphException)2 Geoshape (org.janusgraph.core.attribute.Geoshape)2 SchemaStatus (org.janusgraph.core.schema.SchemaStatus)2