首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >用GraphAware Timetree进行测试

用GraphAware Timetree进行测试
EN

Stack Overflow用户
提问于 2016-11-06 08:24:25
回答 1查看 240关注 0票数 1

我已经开始为GraphAware使用neo4j时间树,到目前为止,它运行得很好。现在,我正在努力解决如何对使用neo4j时间树的代码进行单元/集成测试。

我已经整理了一些代码如下..。但我还是得到了这样的信息:

代码语言:javascript
运行
复制
org.neo4j.ogm.exception.CypherException: Error executing Cypher "Neo.ClientError.Procedure.ProcedureNotFound"; Code: Neo.ClientError.Procedure.ProcedureNotFound; Description: There is no procedure with the name `ga.timetree.events.attach` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.

我是不是走对了路?

代码语言:javascript
运行
复制
package myproject.core;

import java.util.ArrayList;
import java.util.HashMap;

import javax.inject.Inject;

import org.junit.After;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.DynamicLabel;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
import org.neo4j.ogm.testutil.MultiDriverTestClass;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.neo4j.template.Neo4jOperations;
import org.springframework.test.context.junit4.SpringRunner;

import com.graphaware.common.policy.NodeInclusionPolicy;
import com.graphaware.module.timetree.module.TimeTreeConfiguration;
import com.graphaware.module.timetree.module.TimeTreeModule;
import com.graphaware.runtime.GraphAwareRuntime;
import com.graphaware.runtime.GraphAwareRuntimeFactory;

import myproject.core.context.TestPersistenceContext;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestPersistenceContext.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class AbstractTest extends MultiDriverTestClass {

    @Inject
    private Neo4jOperations neo4jOperations;

    public AbstractTest() {
        new SessionFactory("myproject.model.pojos").openSession();

        TimeTreeConfiguration timeTreeConfiguration = TimeTreeConfiguration.defaultConfiguration();
        TimeTreeModule timeTreeModule = new TimeTreeModule("TT.1", timeTreeConfiguration, super.getGraphDatabaseService());

        GraphAwareRuntime runtime = GraphAwareRuntimeFactory.createRuntime(super.getGraphDatabaseService());
        runtime.registerModule(timeTreeModule);
        runtime.start();
    }

    @After
    public void clearDatabase() {
        neo4jOperations.query("match (n) detach delete n;", new HashMap<>());
        neo4jOperations.clear();

    }

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-06 08:49:14

请将AbstractTest()构造函数更改为如下:

代码语言:javascript
运行
复制
public AbstractTest() {
    new SessionFactory("myproject.model.pojos").openSession();

    TimeTreeConfiguration timeTreeConfiguration = TimeTreeConfiguration.defaultConfiguration();
    TimeTreeModule timeTreeModule = new TimeTreeModule("TT.1", timeTreeConfiguration, super.getGraphDatabaseService());

    TimeTreeProcedures.register(super.getGraphDatabaseService());

    GraphAwareRuntime runtime = GraphAwareRuntimeFactory.createRuntime(super.getGraphDatabaseService());
    runtime.registerModule(timeTreeModule);
    runtime.start();
}

注意添加的行:TimeTreeProcedures.register(super.getGraphDatabaseService());

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40447328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档