Skip to content

Instantly share code, notes, and snippets.

@vishwassharma
Created June 23, 2012 01:09
Show Gist options
  • Select an option

  • Save vishwassharma/2976087 to your computer and use it in GitHub Desktop.

Select an option

Save vishwassharma/2976087 to your computer and use it in GitHub Desktop.
Lorem Ipsum For MongoDB
<?xml version="1.0" encoding="UTF-8"?>
<setup xmlns="http://databene.org/benerator/0.7.6"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://databene.org/benerator/0.7.6 benerator-0.7.6.xsd"
defaultEncoding="UTF-8"
defaultDataset="IN"
defaultLocale="en_IN"
defaultLineSeparator="\n">
<import platforms='mongodb'/>
<import domains="person, address"/>
<mongodb id='db' environment='mymongo' />
<generate type='seeker' minCount='10' consumer='db'>
<variable name="person" generator="PersonGenerator"/>
<variable name="address" generator="AddressGenerator" dataset="US" locale="us" />
<attribute name="name" type="string" script="{ftl:${person.givenName} ${person.familyName}}" />
<attribute name="email" type="string" script="{person.email}" />
<attribute name="gender" type="string" script="{person.gender}"/>
<attribute name="birthDate" type="date" script="{person.birthDate}"/>
<attribute name="mobilephone" script="address.mobilePhone" />
<attribute name="city" script="address.city.name" />
<!--<attribute name='age' type='int' min='18' max='78' />-->
<!--<part name='resume' container='list' count='2'>-->
<!--<attribute name='street' script="{mobile.mobilePhone}"/>-->
<!--<attribute name='houseNo' type='int' min='2' max='9' />-->
<!--</part>-->
<!--<part name="address">-->
<!--<attribute name="place" type="string" script="{address.street}" />-->
<!--</part>-->
<!--<echo message="running the 'Hello World' example..." />-->
<!--<generate name="greeting" count="5" consumer="ConsoleExporter">-->
<!--<attribute name="salutation" values="'Hello','Howdy','Hi'"/>-->
<!--<attribute name="name" values="'World','Earth','Planet'" />-->
<!--</generate>-->
<!--<generate name="message" count="10" consumer="ConsoleExporter">-->
<!--<variable name="person" generator="PersonGenerator"/>-->
<!--<variable name="salutation" values="'Hello','Howdy','Hi'"/>-->
<!--<attribute name="text" script="{ftl:${salutation} ${person.givenName}!}" />-->
</generate>
</setup>
db_url=127.0.0.1:27017
db_catalog=<your_db_name>
{ "_id" : { "$oid" : "4fe5222e44ae7050adf462f8"} , "name" : "Bishen Dutta" , "email" : "[email protected]" , "gender" : "MALE" , "birthDate" : "1967-12-22T23:36:40" , "resume" : [ { "street" : "Irjrm Street" , "houseNo" : 3} , { "street" : "Qpbfv Street" , "houseNo" : 5}] , "message" : { "place" : "IKLAXBVIB" , "yiu" : "NDGPIZVFZHUXVIVHRIYSDL"}}
Install Java
Install databene
http://databene.org/
To install databene create a folder to known location
and add the path to bashrc file
+ export BENERATOR_HOME='/path/to/databene/folder'
+ export PATH=$PATH:$BENERATOR_HOME/bin
After this you will have benerator setup
Create a new folder somewhere
then cp the xml file which is below
and also in the same folder cp the properties file.
Edit these two files as you need them.
Still if you are having some trouble use benerator-wizard.sh .. to get the scaffolding and .. you are done :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment