我正在使用Neo4j和Node.js來構建REST API。如何在同一臺計算機上安裝2個Neo4j數據庫:dev和test
我想寫這個API的一些測試。如何在這些測試中使用「測試數據庫」?
使用MySQL或MongoDB,我會擺弄資源URL以使用不同的數據庫,如「app-test」vs「app」。
在neo4j中做這件事的智能方法是什麼?
謝謝!
解決方案:這是我做過什麼:
做了一個目錄DB /測試。在該目錄,把:
- 2的bash腳本如下
- 一個test.zip你想要的數據庫備份
install.sh
#!/bin/bash
VERSION=neo4j-community-2.1.5
# Download a copy of the server
wget http://dist.neo4j.org/$VERSION-unix.tar.gz
# Unpack it here
tar -xvzf $VERSION-unix.tar.gz
# Change the default port to http->7475 https->7476
sed -i.bak s/7474/7475/g $VERSION/conf/neo4j-server.properties
sed -i.bak s/7473/7476/g $VERSION/conf/neo4j-server.properties
restart.sh
#!/bin/bash
VERSION=neo4j-community-2.1.5
echo === stop the server
$VERSION/bin/neo4j stop
echo --- replace the database
rm -rf $VERSION/data/graph.db
unzip -q test.zip -d $VERSION/data/graph.db
echo --- start the server
$VERSION/bin/neo4j start
然後將它添加到g使用grunt-run運行的runtfile:
run: {
restartTestDb: {
exec: 'cd db/test && ./restart.sh',
}
},
Works。
視頻直播哎,我沒有嘗試這一點,但它看起來很酷。 – 2014-11-04 23:32:37