当前位置: 首页>>代码示例>>Java>>正文


Java Gremlin类代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.util.Gremlin的典型用法代码示例。如果您正苦于以下问题:Java Gremlin类的具体用法?Java Gremlin怎么用?Java Gremlin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Gremlin类属于org.apache.tinkerpop.gremlin.util包,在下文中一共展示了Gremlin类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractExpression

import org.apache.tinkerpop.gremlin.util.Gremlin; //导入依赖的package包/类
private static GremlinExpression extractExpression(AnnotatedElement<?> typeExpression) {
Query gremlin = typeExpression.getAnnotation(Query.class);
if (gremlin == null) {
    throw new XOException(typeExpression + " must be annotated with " + Gremlin.class.getName());
}
return new GremlinExpression(gremlin);
   }
 
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:8,代码来源:GremlinExpression.java

示例2: shouldImportWildcardMethod

import org.apache.tinkerpop.gremlin.util.Gremlin; //导入依赖的package包/类
@Test
public void shouldImportWildcardMethod() throws Exception {
    final Method zeroArgs = Gremlin.class.getMethod("version");
    final ImportGremlinPlugin module = ImportGremlinPlugin.build()
            .methodImports(Collections.singletonList(Gremlin.class.getCanonicalName() + "#*")).create();

    final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
    assertEquals(1, module.getCustomizers().get().length);
    assertThat(customizer.getMethodImports(), hasItems(zeroArgs));

    // will also have the static main() method
    assertEquals(2, customizer.getMethodImports().size());
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:14,代码来源:ImportGremlinPluginTest.java

示例3: shouldImportZeroArgMethod

import org.apache.tinkerpop.gremlin.util.Gremlin; //导入依赖的package包/类
@Test
public void shouldImportZeroArgMethod() throws Exception {
    final Method zeroArgs = Gremlin.class.getMethod("version");
    final ImportGremlinPlugin module = ImportGremlinPlugin.build()
            .methodImports(Collections.singletonList(toMethodDescriptor(zeroArgs))).create();

    final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
    assertEquals(1, module.getCustomizers().get().length);
    assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
    assertEquals(1, customizer.getMethodImports().size());
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:12,代码来源:ImportGremlinPluginTest.java

示例4: shouldCopyDirectoriesCorrectly

import org.apache.tinkerpop.gremlin.util.Gremlin; //导入依赖的package包/类
@Test
public void shouldCopyDirectoriesCorrectly() throws Exception {
    final String hdfsName = this.getClass().getSimpleName() + "-hdfs";
    final String localName = this.getClass().getSimpleName() + "-local";
    final FileSystem fs = FileSystem.get(new Configuration());
    if (!new File(System.getProperty("java.io.tmpdir") + "/" + localName).exists())
        assertTrue(new File(System.getProperty("java.io.tmpdir") + "/" + localName).mkdir());
    File tempFile1 = new File(System.getProperty("java.io.tmpdir") + "/" + localName + "/test1.txt");
    File tempFile2 = new File(System.getProperty("java.io.tmpdir") + "/" + localName + "/test2.txt");
    assertTrue(tempFile1.createNewFile());
    assertTrue(tempFile2.createNewFile());
    assertTrue(tempFile1.exists());
    assertTrue(tempFile2.exists());
    if (fs.exists(new Path("target/" + hdfsName)))
        assertTrue(fs.delete(new Path("target/" + hdfsName), true));
    fs.copyFromLocalFile(true, new Path(tempFile1.getAbsolutePath()), new Path("target/" + hdfsName + "/test1.dat"));
    fs.copyFromLocalFile(true, new Path(tempFile2.getAbsolutePath()), new Path("target/" + hdfsName + "/test2.dat"));
    assertTrue(fs.exists(new Path("target/" + hdfsName + "/test1.dat")));
    assertTrue(fs.exists(new Path("target/" + hdfsName + "/test2.dat")));
    assertTrue(fs.exists(new Path("target/" + hdfsName)));
    assertTrue(fs.isDirectory(new Path("target/" + hdfsName)));
    assertFalse(tempFile1.exists());
    assertFalse(tempFile2.exists());
    assertTrue(new File(System.getProperty("java.io.tmpdir") + "/" + localName).exists());
    assertTrue(new File(System.getProperty("java.io.tmpdir") + "/" + localName).delete());
    assertTrue(fs.exists(new Path("target/" + hdfsName + "/test1.dat")));
    assertTrue(fs.exists(new Path("target/" + hdfsName + "/test2.dat")));
    assertTrue(fs.exists(new Path("target/" + hdfsName)));
    assertTrue(fs.isDirectory(new Path("target/" + hdfsName)));
    /////
    final String hadoopGremlinLibsRemote = "hadoop-gremlin-" + Gremlin.version() + "-libs";
    final File localDirectory = new File(System.getProperty("java.io.tmpdir") + "/" + hadoopGremlinLibsRemote);
    final File localLibDirectory = new File(localDirectory.getAbsolutePath() + "/" + hdfsName);
    if (localLibDirectory.exists()) {
        Stream.of(localLibDirectory.listFiles()).forEach(File::delete);
        assertTrue(localLibDirectory.delete());
    }
    assertFalse(localLibDirectory.exists());
    assertEquals(localLibDirectory, AbstractHadoopGraphComputer.copyDirectoryIfNonExistent(fs, "target/" + hdfsName));
    assertTrue(localLibDirectory.exists());
    assertTrue(localLibDirectory.isDirectory());
    assertEquals(2, Stream.of(localLibDirectory.listFiles()).filter(file -> file.getName().endsWith(".dat")).count());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:44,代码来源:AbstractHadoopGraphComputerTest.java

示例5: versionOp

import org.apache.tinkerpop.gremlin.util.Gremlin; //导入依赖的package包/类
public static void versionOp(final Context context) {
    final ChannelHandlerContext ctx = context.getChannelHandlerContext();
    final RequestMessage msg = context.getRequestMessage();
    context.getChannelHandlerContext().writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SUCCESS).result(Gremlin.version()), ctx.voidPromise());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:6,代码来源:ControlOps.java

示例6: getEngineVersion

import org.apache.tinkerpop.gremlin.util.Gremlin; //导入依赖的package包/类
@Override
public String getEngineVersion() {
    return Gremlin.version();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:5,代码来源:GremlinGroovyScriptEngineFactory.java

示例7: getLanguageVersion

import org.apache.tinkerpop.gremlin.util.Gremlin; //导入依赖的package包/类
@Override
public String getLanguageVersion() {
    return Gremlin.version();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:5,代码来源:GremlinGroovyScriptEngineFactory.java


注:本文中的org.apache.tinkerpop.gremlin.util.Gremlin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。