mgmt.rollback(); // Let an exception here propagate up the stack
public SchemaContainer(TitanGraph graph) { vertexLabels = Maps.newHashMap(); relationTypes = Maps.newHashMap(); TitanManagement mgmt = graph.openManagement(); try { for (VertexLabel vl : mgmt.getVertexLabels()) { VertexLabelDefinition vld = new VertexLabelDefinition(vl); vertexLabels.put(vld.getName(),vld); } for (EdgeLabel el : mgmt.getRelationTypes(EdgeLabel.class)) { EdgeLabelDefinition eld = new EdgeLabelDefinition(el); relationTypes.put(eld.getName(),eld); } for (PropertyKey pk : mgmt.getRelationTypes(PropertyKey.class)) { PropertyKeyDefinition pkd = new PropertyKeyDefinition(pk); relationTypes.put(pkd.getName(), pkd); } } finally { mgmt.rollback(); } }
public void close() { if (mgmt!=null && mgmt.isOpen()) mgmt.rollback(); if (null != tx && tx.isOpen()) tx.commit(); if (null != graph && graph.isOpen()) graph.close(); }
public void clopen(Object... settings) { config = getConfiguration(); if (mgmt!=null && mgmt.isOpen()) mgmt.rollback(); if (null != tx && tx.isOpen()) tx.commit(); if (settings!=null && settings.length>0) { Map<TestConfigOption,Object> options = validateConfigOptions(settings); TitanManagement gconf = null; ModifiableConfiguration lconf = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS,config, BasicConfiguration.Restriction.LOCAL); for (Map.Entry<TestConfigOption,Object> option : options.entrySet()) { if (option.getKey().option.isLocal()) { lconf.set(option.getKey().option,option.getValue(),option.getKey().umbrella); } else { if (gconf==null) gconf = graph.openManagement(); gconf.set(ConfigElement.getPath(option.getKey().option,option.getKey().umbrella),option.getValue()); } } if (gconf!=null) gconf.commit(); lconf.close(); } if (null != graph && graph.isOpen()) graph.close(); Preconditions.checkNotNull(config); open(config); }
mgmt.rollback(); // Let an exception here propagate up the stack
m2.rollback(); g2.close();
@Test public void testGettingUndefinedVertexLabelTTL() { if (!features.hasCellTTL()) { return; } // getTTL should return a null duration on an extant type without a TTL mgmt.makeVertexLabel("foo").make(); mgmt.commit(); graph.tx().rollback(); // Check getTTL on vertex label mgmt = graph.openManagement(); assertEquals(Duration.ZERO, mgmt.getTTL(mgmt.getVertexLabel("foo"))); mgmt.rollback(); }
@Test public void testGettingUndefinedEdgeLabelTTL() { if (!features.hasCellTTL()) { return; } // getTTL should return a null duration on an extant type without a TTL mgmt.makeEdgeLabel("likes").make(); mgmt.commit(); graph.tx().rollback(); // Check getTTL on edge label mgmt = graph.openManagement(); assertEquals(Duration.ZERO, mgmt.getTTL(mgmt.getEdgeLabel("likes"))); mgmt.rollback(); }
if (mgmt != null && mgmt.isOpen()) mgmt.rollback();
@Test public void testVLabelOnOrderedStorage() { final String label = "pl"; mgmt.makeVertexLabel(label).partition().make(); mgmt.commit(); graph.tx().rollback(); graph.addVertex(label); graph.tx().commit(); mgmt = graph.openManagement(); VertexLabel vl = mgmt.getVertexLabel(label); assertTrue(vl.isPartitioned()); mgmt.rollback(); }
mgmt.rollback(); assertTrue(ManagementSystem.awaitGraphIndexStatus(graph, "theIndex").status(SchemaStatus.REGISTERED) .timeout(TestGraphConfigs.getSchemaConvergenceTime(ChronoUnit.SECONDS), ChronoUnit.SECONDS)
@Override public void rollback() { management.rollback(); }
@Override public void rollback() { management.rollback(); }
@Override public void close() { if (mgmt!=null && mgmt.isOpen()) mgmt.rollback(); if (null != bgraph) bgraph.commit(); //bgraph.shutdown(); super.close(); }
public Titan0Graph() { //determine multi-properties once at startup TitanManagement mgmt = null; try { mgmt = Titan0GraphDatabase.getGraphInstance().getManagementSystem(); Iterable<PropertyKey> keys = mgmt.getRelationTypes(PropertyKey.class); multiProperties = Collections.synchronizedSet(new HashSet<String>()); for(PropertyKey key : keys) { if (key.getCardinality() != Cardinality.SINGLE) { multiProperties.add(key.getName()); } } } finally { if (mgmt != null) { mgmt.rollback(); } } }
public Titan1Graph() { //determine multi-properties once at startup TitanManagement mgmt = null; try { mgmt = Titan1GraphDatabase.getGraphInstance().openManagement(); Iterable<PropertyKey> keys = mgmt.getRelationTypes(PropertyKey.class); multiProperties = new HashSet<>(); for (PropertyKey key : keys) { if (key.cardinality() != Cardinality.SINGLE) { multiProperties.add(key.name()); } } } finally { if (mgmt != null) { mgmt.rollback(); } } }
public void close() { if (mgmt!=null && mgmt.isOpen()) mgmt.rollback(); if (null != tx && tx.isOpen()) tx.commit(); if (null != graph && graph.isOpen()) graph.shutdown(); }
@Test @Category({ OrderedKeyStoreTests.class }) public void testVLabelOnOrderedStorage() { final String label = "pl"; mgmt.makeVertexLabel(label).partition().make(); mgmt.commit(); graph.rollback(); graph.addVertexWithLabel(label); graph.commit(); mgmt = graph.getManagementSystem(); VertexLabel vl = mgmt.getVertexLabel(label); assertTrue(vl.isPartitioned()); mgmt.rollback(); }