use of com.alibaba.maxgraph.servers.MaxNode in project GraphScope by alibaba.
the class FfiTest method testFfi.
@Test
public void testFfi() throws Exception {
GraphProvider provider = new MaxTestGraphProvider();
LoadGraphWith.GraphData modern = LoadGraphWith.GraphData.MODERN;
Map<String, Object> conf = new HashMap<>();
conf.put(CommonConfig.STORE_NODE_COUNT.getKey(), "1");
conf.put(CommonConfig.PARTITION_COUNT.getKey(), "1");
Configuration graphConf = provider.newGraphConfiguration("ffi-test", FfiTest.class, "testFfi", conf, modern);
provider.clear(graphConf);
Graph graph = provider.openTestGraph(graphConf);
LoadGraphWith loadGraphWith = new LoadGraphWith() {
@Override
public Class<? extends Annotation> annotationType() {
return null;
}
@Override
public GraphData value() {
return modern;
}
};
provider.loadGraphData(graph, loadGraphWith, FfiTest.class, "testFfi");
MaxNode maxNode = ((MaxTestGraph) graph).getMaxNode();
List<NodeBase> storeNodes = maxNode.getStores();
assertEquals(storeNodes.size(), 1);
Store store = (Store) storeNodes.get(0);
StoreService storeService = store.getStoreService();
JnaGraphStore jnaGraphStore = (JnaGraphStore) storeService.getIdToPartition().get(0);
Pointer wrapperPartitionGraph = GraphLibrary.INSTANCE.createWrapperPartitionGraph(jnaGraphStore.getPointer());
GnnLibrary.INSTANCE.setPartitionGraph(wrapperPartitionGraph);
GnnLibrary.TestResult testResult = new GnnLibrary.TestResult(GnnLibrary.INSTANCE.runLocalTests());
logger.info(testResult.getInfo());
assertTrue(testResult.getFlag());
provider.clear(graph, graphConf);
maxNode.close();
}
Aggregations