Skip to content

Instantly share code, notes, and snippets.

@uchia-itachi
Created October 4, 2019 11:06
Show Gist options
  • Save uchia-itachi/95015be5c46a827c05fe76ca77a7b408 to your computer and use it in GitHub Desktop.
Save uchia-itachi/95015be5c46a827c05fe76ca77a7b408 to your computer and use it in GitHub Desktop.
Setup for Databene Benerator framework for Data sythesization
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://databene.org/benerator/0.9.8"
xmlns="http://databene.org/benerator/0.9.8"
elementFormDefault="qualified">
<xs:annotation>
<xs:documentation>The Benerator schema describes the generation setup for Benerator.</xs:documentation>
<xs:appinfo/>
</xs:annotation>
<xs:simpleType name="script-expression-type">
<xs:restriction base="xs:string">
<xs:pattern value="\{.*\}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="errorhandler-type">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="fatal"/>
<xs:enumeration value="error"/>
<xs:enumeration value="warn"/>
<xs:enumeration value="info"/>
<xs:enumeration value="debug"/>
<xs:enumeration value="trace"/>
<xs:enumeration value="ignore"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="script-expression-type"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- The document root. -->
<xs:element name="setup">
<xs:complexType>
<xs:complexContent>
<xs:extension base="block-statement">
<xs:attribute name="defaultScript" type="xs:string"/>
<xs:attribute name="defaultNull" type="xs:boolean"/>
<xs:attribute name="defaultEncoding" type="xs:string"/>
<xs:attribute name="defaultLineSeparator" type="xs:string"/>
<xs:attribute name="defaultTimeZone" type="xs:string"/>
<xs:attribute name="defaultLocale" type="xs:string"/>
<xs:attribute name="defaultDataset" type="xs:string"/>
<xs:attribute name="defaultPageSize" type="xs:long"/>
<xs:attribute name="defaultSeparator" type="xs:string"/>
<xs:attribute name="defaultOneToOne" type="xs:boolean"/>
<xs:attribute name="defaultErrorHandler" type="errorhandler-type"/>
<xs:attribute name="defaultImports" type="xs:boolean"/>
<xs:attribute name="maxCount" type="xs:long"/>
<xs:attribute name="generatorFactory" type="xs:string"/>
<xs:attribute name="acceptUnknownSimpleTypes" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="block-statement">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="import" minOccurs="0" />
<xs:element ref="template" minOccurs="0" />
<xs:element ref="comment" minOccurs="0" />
<xs:element ref="include" minOccurs="0" />
<xs:element ref="setting" minOccurs="0" />
<xs:element ref="database" minOccurs="0" />
<xs:element ref="domtree" minOccurs="0" />
<xs:element ref="bean" minOccurs="0" />
<xs:element ref="defaultComponents" minOccurs="0" />
<xs:element ref="generate" minOccurs="0" />
<xs:element ref="iterate" minOccurs="0" />
<xs:element ref="run-task" minOccurs="0" />
<xs:element ref="execute" minOccurs="0" />
<xs:element ref="evaluate" minOccurs="0" />
<xs:element ref="echo" minOccurs="0" />
<xs:element ref="error" minOccurs="0" />
<xs:element ref="if" minOccurs="0" />
<xs:element ref="while" minOccurs="0" />
<xs:element ref="wait" minOccurs="0" />
<xs:element ref="beep" minOccurs="0" />
<xs:element ref="dbsanity" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:element name="comment" type="xs:string" />
<!-- Imports classes. -->
<xs:element name="import">
<xs:complexType>
<xs:attribute name="class" type="xs:string"/>
<xs:attribute name="domains" type="xs:string"/>
<xs:attribute name="platforms" type="xs:string"/>
<xs:attribute name="defaults" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Transcoding features. -->
<xs:element name="transcodingTask">
<xs:complexType>
<xs:sequence>
<xs:element ref="transcode" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="identity" type="xs:string"/>
<xs:attribute name="defaultSource" type="xs:string"/>
<xs:attribute name="target" type="xs:string"/>
<xs:attribute name="pageSize" type="xs:string"/>
<xs:attribute name="onError" type="errorhandler-type"/>
</xs:complexType>
</xs:element>
<xs:element name="transcode">
<xs:complexType>
<xs:sequence>
<xs:element ref="comment" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="id" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="attribute" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="reference" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="part" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="variable" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="source" type="xs:string"/>
<xs:attribute name="selector" type="xs:string"/>
<xs:attribute name="target" type="xs:string"/>
<xs:attribute name="pageSize" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Includes a properties file. -->
<xs:element name="include">
<xs:complexType>
<xs:attribute name="uri" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="while">
<xs:complexType>
<xs:complexContent>
<xs:extension base="block-statement">
<xs:attribute name="test" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="if">
<xs:complexType>
<xs:complexContent>
<xs:extension base="block-statement">
<xs:sequence>
<xs:element ref="then" minOccurs="0" maxOccurs="1"/>
<xs:element ref="else" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="test" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="then" type="block-statement" />
<xs:element name="else" type="block-statement" />
<!-- Outputs a message to the console. -->
<xs:element name="echo">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="message" type="xs:string" />
<xs:attribute name="type" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Outputs a message to the console. -->
<xs:element name="error">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="code" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Waits for a configurable number of milliseconds. -->
<xs:element name="wait">
<xs:complexType>
<xs:attribute name="duration" type="xs:string"/>
<xs:attribute name="min" type="xs:string"/>
<xs:attribute name="max" type="xs:string"/>
<xs:attribute name="granularity" type="xs:string"/>
<xs:attribute name="distribution" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Emit a beep. -->
<xs:element name="beep" />
<xs:element name="dbsanity">
<xs:complexType>
<xs:attribute name="environment" type="xs:string" use="required"/>
<xs:attribute name="appVersion" type="xs:string"/>
<xs:attribute name="in" type="xs:string"/>
<xs:attribute name="out" type="xs:string"/>
<xs:attribute name="tables" type="xs:NMTOKENS"/>
<xs:attribute name="skin" type="dbsanity-skin"/>
<xs:attribute name="locale" type="xs:string"/>
<xs:attribute name="mode" type="dbsanity-mode"/>
<xs:attribute name="onError" type="errorhandler-type"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="dbsanity-skin">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="online"/>
<xs:enumeration value="offline"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="script-expression-type"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="dbsanity-mode">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="silent"/>
<xs:enumeration value="verbose"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="script-expression-type"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- Instantiates a JavaBean of the given class.
If the 'id' is set, the bean is put into the context with that name.
If the JavaBean itself has a property named 'id', this one is set to the value specified here. -->
<xs:element name="bean">
<xs:complexType>
<xs:complexContent>
<xs:extension base="bean-type">
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="bean-type">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="class" type="xs:string"/>
<xs:attribute name="spec" type="xs:string"/>
</xs:complexType>
<!-- connects to a database -->
<xs:element name="database">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="environment" type="xs:string"/>
<xs:attribute name="url" type="xs:string"/>
<xs:attribute name="driver" type="xs:string"/>
<xs:attribute name="user" type="xs:string"/>
<xs:attribute name="password" type="xs:string"/>
<xs:attribute name="catalog" type="xs:string"/>
<xs:attribute name="schema" type="xs:string"/>
<xs:attribute name="tableFilter" type="xs:string"/>
<xs:attribute name="includeTables" type="xs:string"/>
<xs:attribute name="excludeTables" type="xs:string"/>
<xs:attribute name="batch" type="xs:string"/>
<xs:attribute name="fetchSize" type="xs:string"/>
<xs:attribute name="readOnly" type="xs:string"/>
<xs:attribute name="lazy" type="xs:string"/>
<xs:attribute name="metaCache" type="xs:string"/>
<xs:attribute name="acceptUnknownColumnTypes" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- creates a DOM Tree -->
<xs:element name="domtree">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="inputUri" type="xs:string" use="required"/>
<xs:attribute name="outputUri" type="xs:string"/>
<xs:attribute name="namespaceAware" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:complexType name="execute-type">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="uri" type="xs:string"/>
<xs:attribute name="encoding" type="xs:string"/>
<xs:attribute name="target" type="xs:string"/>
<xs:attribute name="separator" type="xs:string"/>
<xs:attribute name="type" type="data-type"/>
<xs:attribute name="onError" type="errorhandler-type"/>
<xs:attribute name="optimize" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="data-type">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="boolean"/>
<xs:enumeration value="byte"/>
<xs:enumeration value="short"/>
<xs:enumeration value="int"/>
<xs:enumeration value="long"/>
<xs:enumeration value="big_integer"/>
<xs:enumeration value="float"/>
<xs:enumeration value="double"/>
<xs:enumeration value="big_decimal"/>
<xs:enumeration value="boolean"/>
<xs:enumeration value="char"/>
<xs:enumeration value="date"/>
<xs:enumeration value="timestamp"/>
<xs:enumeration value="string"/>
<xs:enumeration value="object"/>
<xs:enumeration value="binary"/>
<xs:enumeration value="entity"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="script-expression-type"/>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- executes a script, e.g. SQL -->
<xs:element name="execute" type="execute-type" />
<!-- evaluates a script, e.g. SQL -->
<xs:element name="evaluate">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="execute-type">
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="assert" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Declares a JavaBean to be used as consumer, either by referencing an object from the context (ref)
or by instantiating a JavaBean like with the &lt;bean&gt; tag. -->
<xs:element name="consumer">
<xs:complexType>
<xs:complexContent>
<xs:extension base="bean-type">
<xs:attribute name="ref" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="setting"> <!-- TODO unify with property -->
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="bean" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="idref" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="value" type="xs:string"/>
<xs:attribute name="default" type="xs:string"/>
<xs:attribute name="ref" type="xs:string"/>
<xs:attribute name="source" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Sets a JavaBean's property to the simple property specified as 'value' attribute
or to the object stored in the context with the 'ref'. -->
<xs:element name="property">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="bean" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="idref" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="value" type="xs:string"/>
<xs:attribute name="default" type="xs:string"/>
<xs:attribute name="ref" type="xs:string"/>
<xs:attribute name="source" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Represents a reference to a JavaBean (of the name specified by the 'bean' attribute) from the context. -->
<xs:element name="idref">
<xs:complexType>
<xs:attribute name="bean" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Instantiates and executes a JavaBean that implements the Task interface.
Properties are handled like in the &lt;bean&gt; tag.
The task is executed 'count' times in a number of 'threads' parallel threads.
Invocations are executed in groups of size 'pageSize'. -->
<xs:element name="run-task">
<xs:complexType>
<xs:complexContent>
<xs:extension base="bean-type">
<xs:attributeGroup ref="execution-attrs" />
<xs:attribute name="threads" type="xs:string"/>
<!-- TODO v0.8 support min/maxCount? -->
<xs:attribute name="pager" type="xs:string"/> <!-- TODO v0.7 move 'pager' to 'executor-attrs'? -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="defaultComponents">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="id" minOccurs="0" maxOccurs="1"/>
<xs:element ref="attribute" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="reference" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="part" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="template"> <!-- TODO v0.8 keep this? -->
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="comment" minOccurs="0" />
<xs:element ref="id" minOccurs="0" />
<xs:element ref="compositeId" minOccurs="0" />
<xs:element ref="attribute" minOccurs="0" />
<xs:element ref="reference" minOccurs="0" />
<xs:element ref="part" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="variable" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="data-type"/>
</xs:complexType>
</xs:element>
<!-- Creates entities. If a 'count' is provided the corresponding number of entities is created.
If no count is provided, entities are created as long as each involved generator is available. -->
<xs:element name="generate">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="comment" minOccurs="0" />
<xs:element ref="value" minOccurs="0" />
<xs:element ref="id" minOccurs="0" />
<xs:element ref="compositeId" minOccurs="0" />
<xs:element ref="attribute" minOccurs="0" />
<xs:element ref="reference" minOccurs="0" />
<xs:element ref="part" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="variable" minOccurs="0" />
<xs:element ref="consumer" minOccurs="0" />
<xs:element ref="generate" minOccurs="0" />
<xs:element ref="iterate" minOccurs="0" />
<xs:element ref="execute" minOccurs="0" />
<xs:element ref="wait" minOccurs="0" />
<xs:element ref="if" minOccurs="0" />
<xs:element ref="while" minOccurs="0" />
</xs:sequence>
<xs:attributeGroup ref="generator-attrs" />
<xs:attribute name="minCount" type="xs:string"/>
<xs:attribute name="maxCount" type="xs:string"/>
<xs:attribute name="countDistribution" type="xs:string"/>
<xs:attributeGroup ref="execution-attrs" />
<xs:attribute name="template" type="xs:string"/>
<xs:attribute name="consumer" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Updates entities. -->
<xs:element name="iterate">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="comment" minOccurs="0" />
<xs:element ref="id" minOccurs="0" />
<xs:element ref="attribute" minOccurs="0" />
<xs:element ref="reference" minOccurs="0" />
<xs:element ref="part" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="variable" minOccurs="0" />
<xs:element ref="consumer" minOccurs="0" />
<xs:element ref="generate" minOccurs="0" />
<xs:element ref="iterate" minOccurs="0" />
<xs:element ref="execute" minOccurs="0" />
</xs:sequence>
<xs:attributeGroup ref="iterator-attrs" />
<xs:attributeGroup ref="execution-attrs" />
<xs:attribute name="template" type="xs:string"/>
<xs:attribute name="consumer" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="execution-attrs">
<xs:attribute name="count" type="xs:string"/>
<xs:attribute name="pageSize" type="xs:string"/>
<xs:attribute name="stats" type="xs:string"/>
<xs:attribute name="onError" type="errorhandler-type"/>
</xs:attributeGroup>
<!-- Defines a variable that is recreated by a generator on each entity creation -->
<xs:element name="variable">
<xs:complexType>
<xs:attributeGroup ref="component-generator-attrs" />
</xs:complexType>
</xs:element>
<xs:element name="value">
<xs:complexType>
<xs:attributeGroup ref="component-generator-attrs" />
</xs:complexType>
</xs:element>
<xs:element name="attribute">
<xs:complexType>
<xs:attributeGroup ref="component-generator-attrs" />
</xs:complexType>
</xs:element>
<xs:element name="part">
<xs:complexType>
<xs:attributeGroup ref="component-generator-attrs" />
<xs:attribute name="container">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="list"/>
<xs:enumeration value="set"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<!-- Defines an ID generator. -->
<xs:element name="id">
<xs:complexType>
<xs:attributeGroup ref="component-generator-attrs" />
</xs:complexType>
</xs:element>
<xs:element name="compositeId">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="attribute" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="reference" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="compositeReference" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="reference">
<xs:complexType>
<xs:attributeGroup ref="reference-generator-attrs" />
</xs:complexType>
</xs:element>
<xs:element name="compositeReference">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="attribute" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="reference" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="compositeReference" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="reference-generator-attrs">
<xs:attributeGroup ref="component-generator-attrs" />
<xs:attribute name="targetType" type="xs:string" />
</xs:attributeGroup>
<xs:attributeGroup name="component-generator-attrs">
<xs:attributeGroup ref="simple-type-generator-attrs" />
<xs:attributeGroup ref="iterator-only-attrs" />
</xs:attributeGroup>
<xs:attributeGroup name="simple-type-generator-attrs">
<xs:attributeGroup ref="generator-attrs" />
<xs:attribute name="condition" type="xs:string"/>
<xs:attribute name="uniqueKey" type="xs:string"/>
<xs:attribute name="nullable" type="xs:string"/>
<xs:attribute name="mode" type="xs:string"/>
<!-- boolean generator setup -->
<xs:attribute name="trueQuota" type="xs:string"/>
<!-- number generator setup -->
<xs:attribute name="min" type="xs:string"/>
<xs:attribute name="minInclusive" type="xs:string"/>
<xs:attribute name="max" type="xs:string"/>
<xs:attribute name="maxInclusive" type="xs:string"/>
<xs:attribute name="granularity" type="xs:string"/>
<!-- String generator setup -->
<xs:attribute name="pattern" type="xs:string"/>
<xs:attribute name="script" type="xs:string"/>
<xs:attribute name="minLength" type="xs:string"/>
<xs:attribute name="maxLength" type="xs:string"/>
<!-- Sample-based generator setup -->
<xs:attribute name="constant" type="xs:string"/>
<xs:attribute name="values" type="xs:string"/>
<xs:attribute name="map" type="xs:string" />
</xs:attributeGroup>
<xs:attributeGroup name="generator-attrs">
<xs:attributeGroup ref="common-creator-attrs" />
<xs:attribute name="generator" type="xs:string"/>
<xs:attribute name="validator" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="iterator-attrs">
<xs:attributeGroup ref="common-creator-attrs" />
<xs:attributeGroup ref="iterator-only-attrs" />
</xs:attributeGroup>
<xs:attributeGroup name="iterator-only-attrs">
<xs:attribute name="source" type="xs:string"/>
<xs:attribute name="separator" type="xs:string"/>
<xs:attribute name="format" type="format-type"/>
<xs:attribute name="rowBased" type="xs:string"/>
<xs:attribute name="emptyMarker" type="xs:string"/>
<xs:attribute name="encoding" type="xs:string"/>
<xs:attribute name="segment" type="xs:string"/>
<xs:attribute name="selector" type="xs:string"/>
<xs:attribute name="subSelector" type="xs:string"/>
<xs:attribute name="dataset" type="xs:string"/>
<xs:attribute name="nesting" type="xs:string"/>
<xs:attribute name="locale" type="xs:string"/>
<xs:attribute name="filter" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="common-creator-attrs">
<!-- elementary definitions -->
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="data-type"/>
<xs:attribute name="scope" type="xs:string"/>
<!-- wrappers -->
<xs:attribute name="converter" type="xs:string"/>
<xs:attribute name="nullQuota" type="xs:string"/>
<xs:attribute name="unique" type="xs:string"/>
<xs:attribute name="distribution" type="xs:string"/>
<xs:attribute name="cyclic" type="xs:string"/>
<xs:attribute name="offset" type="xs:string"/>
</xs:attributeGroup>
<xs:simpleType name="format-type">
<xs:restriction base="xs:string">
<xs:enumeration value="formatted"/>
<xs:enumeration value="raw"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<setup xmlns="http://databene.org/benerator/0.9.8"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://databene.org/benerator/0.9.8 benerator-0.9.8.xsd"
defaultEncoding="UTF-8"
defaultDataset="IN"
defaultLocale="en_IN"
defaultLineSeparator="\n">
<import platforms="csv"/>
<echo message="Starting test data generation..." />
<!--
Below is a database configuration, where the benerator is connecting to a postgres.
-->
<database id="db"
url="jdbc:postgresql://localhost:5432/postgres"
driver="org.postgresql.Driver"
schema="inventory"
catalog="postgres"
user="postgres"
password="postgres"
/>
<!--
This bean segment is used to create csv entity which we can use as consumer to import generated data to a new csv file.
<bean id="out" class="CSVEntityExporter">
<property name="uri" value="customers.csv" />
<property name="columns" value="id,first_name,last_name,email" />
</bean>
-->
<!--
generate command is used to to generate the data for tables where,
type = table name for which data is to be generated.
count = number of rows to be generated.
consumer = where we want to push our generated data.it can be either id of database,bean or ConsoleExporter.
attribute = represent the column of the table , if we want to generate random data without any order we do not need to insert attribute for that column.
-->
<generate type="customers" count="25000" consumer="db">
<id name="id" type="int" generator="new IncrementalIdGenerator(7008)"/>
<attribute name="email" type="string" unique="true" pattern="[1-9]*@zemo.com"/>
<attribute name="first_name" type="string" maxLength="5"/>
<attribute name="last_name" type="string" maxLength="5"/>
</generate>
<generate type="products" count="25000" consumer="db">
<id name="id" type="int" generator="new IncrementalIdGenerator(1110)"/>
<attribute name="name" type="string" unique="true" maxLength="5"/>
<attribute name="description" type="string" maxLength="10"/>
<attribute name="weigth" type="long" max="20"/>
</generate>
<generate type="products_on_hand" count="25000" consumer="db">
<id name="product_id" type="int" generator="new IncrementalIdGenerator(1110)"/>
<attribute name="quant ity" type="int" generator="new IncrementalIdGenerator(1110)"/>
</generate>
</setup>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.databene.domain</groupId>
<artifactId>lorem</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>project-name data generation project</name>
<description>Start generating transactions by typing 'mvn benerator:generate' on the command line.</description>
<!-- mvn dependency:purge-local-repository -->
<properties>
<maven-compiler-plugin.version>3.0</maven-compiler-plugin.version>
<maven-benerator-plugin.version>0.7.7</maven-benerator-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>net._01001111</groupId>
<artifactId>jlorem</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.databene</groupId>
<artifactId>databene-benerator</artifactId>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>org.databene</groupId>
<artifactId>dbsanity</artifactId>
<version>0.9.4</version>
</dependency>
<dependency>
<groupId>org.databene</groupId>
<artifactId>jdbacl</artifactId>
<version>0.8.19</version>
</dependency>
<dependency>
<groupId>org.databene</groupId>
<artifactId>databene-webdecs</artifactId>
<version>0.6.10</version>
</dependency>
<dependency>
<groupId>org.databene</groupId>
<artifactId>databene-commons</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.databene</groupId>
<artifactId>contiperf</artifactId>
<version>1.07</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.databene</groupId>
<artifactId>benerator-maven-plugin</artifactId>
<version>0.9.8</version>
<configuration>
<descriptor>benerator.xml</descriptor>
<encoding>UTF-8</encoding>
<validate>true</validate>
<dbUrl>jdbc:postgresql://172.17.0.1:5432/postgres</dbUrl>
<dbDriver>org.postgresql.Driver</dbDriver>
<dbSchema>postgres </dbSchema>
<dbUser>postgres</dbUser>
<dbPassword>postgres</dbPassword>
</configuration>
<dependencies>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment