UsageYou can use the Data Generator as a unmanged plugin or in a unit test scenario. Since version 3+ of neo4j it is also possible to use fkr functions and procedures this is explained in the readme. |
Unmanaged PluginTo getting started do the following:
You are now ready to create your own property files in the ddgres directory. You can use the help or use an already existing load definition file as a template. In a typical scenario multiple load definition files are created to generate a data set. Keep the load definition files small! As you have seen above, the unmanaged plugin is called via an url. However to make scripts which call the ump you can make use of curl. Curl will display the text returned as soon as the ump puts it in the response. The browser instead may wait with showing the response until the processing is finished. The url to call the plugin is build up as follows: To load an example data set you can use the following curl line. Note this will actual load data into the database! curl -g http://localhost:7474/testdata/tdg/pfile/tdgexample.props Version 0.9.1 of neo4j-faker must run on Neo4j version 4 and higher. Neo4j version 4 can run multiple databases at the same time. You can specify in the url the parameter 'dbname' to generate data in that specific database. If ommitted then the default database will be taken. f curl -g http://localhost:7474/testdata/tdg/pfile/tdgexample.props?dbname=mydb |
Embedded |
It is possible to Use the TestDataLoader with the following constructors
public TestDataLoader(GraphDatabaseService database ,Properties genProperties ,ExecutionEngine engine ,Writer writer ,String TDGRoot) or public TestDataLoader(GraphDatabaseService database ,Properties genProperties ,ExecutionEngine engine ,String TDGRoot) The TDGRoot is a filepath to the parent directory of the ddgres directory If the call is done without the Writer, then the output will be placed in the system output Here a coding example: String tdgroot = "/opt/test/tdg";// this is the test datagen 'root' directory. String propsOne = "fraud_one.props"; String propsTwo = "fraud_two.props"; String propsThree = "fraud_three.props"; TestDataLoader tdg = new TestDataLoader(database, TDGUtils.loadProperties(tdgroot, propsOne), engine, tdgroot); tdg.loadData(); tdg = new TestDataLoader(database, TDGUtils.loadProperties(tdgroot, propsTwo), engine, tdgroot); tdg.loadData(); tdg = new TestDataLoader(database, TDGUtils.loadProperties(tdgroot, propsThree), engine, tdgroot); tdg.loadData(); |
File Descriptions |
All the files and directories are in the plugins directory of the neo4j server. Or an to be configured directory when using the tool embedded. doc/ : Directory with the help files for the Data Generator. dist/neo4jFaker-<version>.jar : The logic for the test data generator dist/ddgres/ : Directory for all the resources. Property and list files. dist/ddgres/First_Names.csv : Used by the person name generator dist/ddgres/Last_Names.csv : Used by the person name generator dist/ddgres/cities.txt : A list with distinct US city names. Used in the example. dist/ddgres/tdgexample.props : This is an example test data definition file |