DNA SVN: r1100 - trunk/utils/dna-jcr-gen.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-07-13 04:25:06 -0400 (Mon, 13 Jul 2009)
New Revision: 1100
Modified:
trunk/utils/dna-jcr-gen/pom.xml
Log:
enhanced argument input ways
Modified: trunk/utils/dna-jcr-gen/pom.xml
===================================================================
--- trunk/utils/dna-jcr-gen/pom.xml 2009-07-13 08:24:47 UTC (rev 1099)
+++ trunk/utils/dna-jcr-gen/pom.xml 2009-07-13 08:25:06 UTC (rev 1100)
@@ -30,6 +30,8 @@
<descriptor>
src/test/resources/benerator/benerator.xml
</descriptor>
+ <!-- If you use benerator offline -->
+ <validate>false</validate>
</configuration>
</plugin>
</plugins>
16 years, 9 months
DNA SVN: r1099 - trunk/utils/dna-jcr-gen/src/main/resources.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-07-13 04:24:47 -0400 (Mon, 13 Jul 2009)
New Revision: 1099
Added:
trunk/utils/dna-jcr-gen/src/main/resources/benerator-0.5.9-SR1.xsd
Log:
enhanced argument input ways
Copied: trunk/utils/dna-jcr-gen/src/main/resources/benerator-0.5.9-SR1.xsd (from rev 1096, trunk/utils/dna-jcr-gen/benerator-0.5.9-SR1.xsd)
===================================================================
--- trunk/utils/dna-jcr-gen/src/main/resources/benerator-0.5.9-SR1.xsd (rev 0)
+++ trunk/utils/dna-jcr-gen/src/main/resources/benerator-0.5.9-SR1.xsd 2009-07-13 08:24:47 UTC (rev 1099)
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://databene.org/benerator/0.5.9-SR1"
+ xmlns="http://databene.org/benerator/0.5.9-SR1"
+ 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, it can list beans, create-entities and run-tasks in arbitrary order. -->
+ <xs:element name="setup">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="import" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="include" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="database" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="bean" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="defaultAttributes" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="create-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="update-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="run-task" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="execute" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="evaluate" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="echo" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="default-script" type="xs:string"/> <!-- deprecated -->
+ <xs:attribute name="default-null" type="xs:string"/> <!-- deprecated -->
+ <xs:attribute name="defaultScript" type="xs:string"/>
+ <xs:attribute name="defaultNull" type="xs:string"/>
+ <xs:attribute name="defaultEncoding" type="xs:string"/>
+ <xs:attribute name="defaultLineSeparator" type="xs:string"/>
+ <xs:attribute name="defaultLocale" type="xs:string"/>
+ <xs:attribute name="defaultDataset" type="xs:string"/>
+ <xs:attribute name="defaultPagesize" type="xs:string"/>
+ <xs:attribute name="defaultSeparator" type="xs:string"/>
+ <xs:attribute name="defaultErrorHandler" type="errorhandler-type"/>
+ <xs:attribute name="maxCount" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <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="domain" type="xs:string"/>
+ <xs:attribute name="defaults" 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>
+
+ <!-- Outputs a message to the console. -->
+ <xs:element name="echo">
+ <xs:complexType>
+ <xs:attribute name="message" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- 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: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="id" type="xs:string" use="required"/>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="spec" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- connects to a database -->
+ <xs:element name="database">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="url" type="xs:string"/>
+ <xs:attribute name="driver" type="xs:string"/>
+ <xs:attribute name="user" type="xs:string"/>
+ <xs:attribute name="schema" type="xs:string"/>
+ <xs:attribute name="password" 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: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="type" type="xs:string"/>
+ <xs:attribute name="onError" type="errorhandler-type"/>
+ <xs:attribute name="optimize" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <!-- executes a script, e.g. SQL -->
+ <xs:element name="execute" />
+
+ <!-- evaluates a script, e.g. SQL -->
+ <xs:element name="evaluate">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="execute-type">
+ <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 <bean> tag. -->
+ <xs:element name="consumer">
+ <xs:complexType>
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">
+ <xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="ref" 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="ref" 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 <bean> 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: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="count" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="pager" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="defaultAttributes">
+ <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:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="count" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ </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="create-entities">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <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="variable" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="consumer" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="create-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="update-entities" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="count" type="xs:string"/>
+ <xs:attribute name="minCount" type="xs:string"/>
+ <xs:attribute name="maxCount" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ <xs:attribute name="consumer" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Updates entities. -->
+ <xs:element name="update-entities">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <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="variable" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="consumer" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="create-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="update-entities" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="count" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ <xs:attribute name="consumer" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Defines an ID generator that can be reused in different scopes. -->
+ <xs:element name="id">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="strategy" type="xs:string"/>
+ <xs:attribute name="scope" type="xs:string"/>
+ <xs:attribute name="param" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Defines a reference generator. -->
+ <xs:element name="reference">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="nullable" type="xs:string"/>
+ <xs:attribute name="nullQuota" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="targetType" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="distribution" type="xs:string"/>
+ <xs:attribute name="mode" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Defines a variable that is recreated by a generator on each entity creation -->
+ <xs:element name="variable" type="generator-setup"/>
+
+ <xs:complexType name="generator-setup">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="generator" type="xs:string"/>
+ <xs:attribute name="validator" type="xs:string"/>
+ <xs:attribute name="values" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="pattern" type="xs:string"/>
+ <xs:attribute name="nullQuota" type="xs:string"/>
+ <xs:attribute name="converter" 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="unique" type="xs:string"/>
+ <xs:attribute name="distribution" type="xs:string"/>
+ <xs:attribute name="variation1" type="xs:string"/>
+ <xs:attribute name="variation2" type="xs:string"/>
+ <xs:attribute name="cyclic" type="xs:string"/>
+ <xs:attribute name="proxy">
+ <xs:simpleType>
+ <xs:union>
+ <xs:simpleType> <!-- (skip | repeat) -->
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="repeat"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:restriction base="script-expression-type"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="proxy-param1" type="xs:string"/>
+ <xs:attribute name="proxy-param2" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:element name="attribute" type="attribute-generator-setup"/>
+
+ <xs:complexType name="attribute-generator-setup">
+ <xs:complexContent>
+ <xs:extension base="generator-setup">
+
+ <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="minExclusive" type="xs:string"/>
+ <xs:attribute name="max" type="xs:string"/>
+ <xs:attribute name="maxExclusive" type="xs:string"/>
+ <xs:attribute name="precision" type="xs:string"/>
+
+ <!-- String generator setup -->
+ <xs:attribute name="script" type="xs:string"/>
+ <xs:attribute name="minLength" type="xs:string"/>
+ <xs:attribute name="maxLength" type="xs:string"/>
+
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+</xs:schema>
16 years, 9 months
DNA SVN: r1098 - trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-07-13 04:24:02 -0400 (Mon, 13 Jul 2009)
New Revision: 1098
Modified:
trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java
Log:
enhanced argument input ways
Modified: trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java
===================================================================
--- trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java 2009-07-13 08:23:41 UTC (rev 1097)
+++ trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java 2009-07-13 08:24:02 UTC (rev 1098)
@@ -43,7 +43,7 @@
import org.databene.model.consumer.AbstractConsumer;
import org.databene.model.data.Entity;
import org.jboss.dna.graph.SecurityContext;
-import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.graph.connector.RepositorySource;
import org.jboss.dna.jcr.JcrConfiguration;
import org.jboss.dna.jcr.JcrEngine;
import org.jboss.dna.jcr.SecurityContextCredentials;
@@ -51,7 +51,7 @@
import org.slf4j.LoggerFactory;
/**
- * A Utility that writes the generated content as nodes to a DNA JCR repository.<br/>
+ * A Utility that writes the generated content as nodes to a DNA JCR repository.<br/>
*
* @author Serge Pagop
*/
@@ -71,31 +71,44 @@
// Constructor -----------------------------------------------------------------------------------------------------
- public JCRDataMassGen( String username,
- String sourceName,
- String sourceDescription,
- String repositoryName,
- String workspaceName,
- boolean printContent ) throws RepositoryException {
+ /**
+ * Construct a Data Mass Generator, that may be used to generate test data.
+ * @param sourceName - the name of the source.
+ * @param description - the configuration description.
+ * @param beanPropertyName - the name of the bean property.
+ * @param workspaceName - the workspace name.
+ * @param repositoryName - the repository name.
+ * @param repositorySource -
+ * @param username
+ * @param printContent
+ * @throws Exception
+ */
+ @SuppressWarnings( "unchecked" )
+ public JCRDataMassGen( String sourceName,
+ String description,
+ String beanPropertyName,
+ String workspaceName,
+ String repositoryName,
+ String repositorySource,
+ String username,
+ boolean printContent ) throws Exception {
this.printContent = printContent;
// setting up the JcrConfiguration
configuration = new JcrConfiguration();
- configuration.repositorySource(sourceName).usingClass(InMemoryRepositorySource.class).setDescription(sourceDescription).setProperty("defaultWorkspaceName",workspaceName);
+ Class<? extends RepositorySource> clazz = (Class<? extends RepositorySource>)Class.forName(repositorySource);
+ configuration.repositorySource(sourceName).usingClass(clazz).setDescription(description).setProperty(beanPropertyName,
+ workspaceName);
// repository
configuration.repository(repositoryName).setSource(sourceName);
-
// Start the engine
engine = configuration.build();
engine.start();
-
-
// Obtain a JCR Repository instance by name
repository = engine.getRepository(repositoryName);
SecurityContext securityContext = new MyCustomSecurityContext(username);
SecurityContextCredentials credentials = new SecurityContextCredentials(securityContext);
this.session = repository.login(credentials, workspaceName);
-
this.currentNode = session.getRootNode();
}
@@ -180,8 +193,8 @@
Property property = (Property)propIt.next();
log.info(indent + '\t' + '\t' + property.getName());
Value value = property.getValue();
- log.info(indent + '\t' + '\t' + '\t' + value.getString());
-
+ log.info(indent + '\t' + '\t' + '\t' + value.getString());
+
}
NodeIterator iterator = node.getNodes();
while (iterator.hasNext())
@@ -190,9 +203,11 @@
protected class MyCustomSecurityContext implements SecurityContext {
private String username;
+
public MyCustomSecurityContext( String username ) {
this.username = username;
}
+
/**
* @see org.jboss.dna.graph.SecurityContext#getUserName()
*/
16 years, 9 months
DNA SVN: r1097 - trunk/utils/dna-jcr-gen/src/test/resources/benerator.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-07-13 04:23:41 -0400 (Mon, 13 Jul 2009)
New Revision: 1097
Modified:
trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml
Log:
enhanced argument input ways
Modified: trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml
===================================================================
--- trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml 2009-07-13 06:40:00 UTC (rev 1096)
+++ trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml 2009-07-13 08:23:41 UTC (rev 1097)
@@ -8,10 +8,13 @@
<import domain="address" />
<!-- My consumer for my InMmemery repos. source -->
- <bean id="dnaJcrConsumer" spec="org.jboss.dna.jcr.gen.JCRDataMassGen('toto', 'firstSource',
+ <bean id="dnaJcrConsumer" spec="org.jboss.dna.jcr.gen.JCRDataMassGen('firstSource',
'this is only my first jcr repos source with some test data',
- 'test repository',
- 'WS1',true)"/>
+ 'defaultWorkspaceName',
+ 'WS1',
+ 'test repository',
+ 'org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource',
+ 'username',true)"/>
<!-- Some extras data -->
<include uri="bank.properties"/>
16 years, 9 months
DNA SVN: r1096 - in trunk: utils and 17 other directories.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-07-13 02:40:00 -0400 (Mon, 13 Jul 2009)
New Revision: 1096
Added:
trunk/utils/
trunk/utils/dna-jcr-gen/
trunk/utils/dna-jcr-gen/benerator-0.5.9-SR1.xsd
trunk/utils/dna-jcr-gen/pom.xml
trunk/utils/dna-jcr-gen/readme.txt
trunk/utils/dna-jcr-gen/src/
trunk/utils/dna-jcr-gen/src/main/
trunk/utils/dna-jcr-gen/src/main/java/
trunk/utils/dna-jcr-gen/src/main/java/org/
trunk/utils/dna-jcr-gen/src/main/java/org/jboss/
trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/
trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/
trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/
trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java
trunk/utils/dna-jcr-gen/src/main/resources/
trunk/utils/dna-jcr-gen/src/main/resources/log4j.properties
trunk/utils/dna-jcr-gen/src/test/
trunk/utils/dna-jcr-gen/src/test/java/
trunk/utils/dna-jcr-gen/src/test/java/org/
trunk/utils/dna-jcr-gen/src/test/java/org/jboss/
trunk/utils/dna-jcr-gen/src/test/java/org/jboss/dna/
trunk/utils/dna-jcr-gen/src/test/java/org/jboss/dna/jcr/
trunk/utils/dna-jcr-gen/src/test/resources/
trunk/utils/dna-jcr-gen/src/test/resources/benerator/
trunk/utils/dna-jcr-gen/src/test/resources/benerator/bank.properties
trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml
Log:
dna jcr gen project initial
Added: trunk/utils/dna-jcr-gen/benerator-0.5.9-SR1.xsd
===================================================================
--- trunk/utils/dna-jcr-gen/benerator-0.5.9-SR1.xsd (rev 0)
+++ trunk/utils/dna-jcr-gen/benerator-0.5.9-SR1.xsd 2009-07-13 06:40:00 UTC (rev 1096)
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://databene.org/benerator/0.5.9-SR1"
+ xmlns="http://databene.org/benerator/0.5.9-SR1"
+ 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, it can list beans, create-entities and run-tasks in arbitrary order. -->
+ <xs:element name="setup">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="import" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="include" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="database" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="bean" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="defaultAttributes" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="create-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="update-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="run-task" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="execute" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="evaluate" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="echo" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="default-script" type="xs:string"/> <!-- deprecated -->
+ <xs:attribute name="default-null" type="xs:string"/> <!-- deprecated -->
+ <xs:attribute name="defaultScript" type="xs:string"/>
+ <xs:attribute name="defaultNull" type="xs:string"/>
+ <xs:attribute name="defaultEncoding" type="xs:string"/>
+ <xs:attribute name="defaultLineSeparator" type="xs:string"/>
+ <xs:attribute name="defaultLocale" type="xs:string"/>
+ <xs:attribute name="defaultDataset" type="xs:string"/>
+ <xs:attribute name="defaultPagesize" type="xs:string"/>
+ <xs:attribute name="defaultSeparator" type="xs:string"/>
+ <xs:attribute name="defaultErrorHandler" type="errorhandler-type"/>
+ <xs:attribute name="maxCount" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <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="domain" type="xs:string"/>
+ <xs:attribute name="defaults" 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>
+
+ <!-- Outputs a message to the console. -->
+ <xs:element name="echo">
+ <xs:complexType>
+ <xs:attribute name="message" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- 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: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="id" type="xs:string" use="required"/>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="spec" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- connects to a database -->
+ <xs:element name="database">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="url" type="xs:string"/>
+ <xs:attribute name="driver" type="xs:string"/>
+ <xs:attribute name="user" type="xs:string"/>
+ <xs:attribute name="schema" type="xs:string"/>
+ <xs:attribute name="password" 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: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="type" type="xs:string"/>
+ <xs:attribute name="onError" type="errorhandler-type"/>
+ <xs:attribute name="optimize" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <!-- executes a script, e.g. SQL -->
+ <xs:element name="execute" />
+
+ <!-- evaluates a script, e.g. SQL -->
+ <xs:element name="evaluate">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="execute-type">
+ <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 <bean> tag. -->
+ <xs:element name="consumer">
+ <xs:complexType>
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">
+ <xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="ref" 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="ref" 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 <bean> 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: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="count" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="pager" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="defaultAttributes">
+ <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:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="count" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ </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="create-entities">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <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="variable" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="consumer" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="create-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="update-entities" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="count" type="xs:string"/>
+ <xs:attribute name="minCount" type="xs:string"/>
+ <xs:attribute name="maxCount" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ <xs:attribute name="consumer" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Updates entities. -->
+ <xs:element name="update-entities">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <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="variable" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="consumer" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="create-entities" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="update-entities" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="count" type="xs:string"/>
+ <xs:attribute name="pagesize" type="xs:string"/>
+ <xs:attribute name="threads" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ <xs:attribute name="consumer" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Defines an ID generator that can be reused in different scopes. -->
+ <xs:element name="id">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="strategy" type="xs:string"/>
+ <xs:attribute name="scope" type="xs:string"/>
+ <xs:attribute name="param" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Defines a reference generator. -->
+ <xs:element name="reference">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="nullable" type="xs:string"/>
+ <xs:attribute name="nullQuota" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="targetType" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="distribution" type="xs:string"/>
+ <xs:attribute name="mode" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Defines a variable that is recreated by a generator on each entity creation -->
+ <xs:element name="variable" type="generator-setup"/>
+
+ <xs:complexType name="generator-setup">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:attribute name="generator" type="xs:string"/>
+ <xs:attribute name="validator" type="xs:string"/>
+ <xs:attribute name="values" type="xs:string"/>
+ <xs:attribute name="source" type="xs:string"/>
+ <xs:attribute name="encoding" type="xs:string"/>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="pattern" type="xs:string"/>
+ <xs:attribute name="nullQuota" type="xs:string"/>
+ <xs:attribute name="converter" 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="unique" type="xs:string"/>
+ <xs:attribute name="distribution" type="xs:string"/>
+ <xs:attribute name="variation1" type="xs:string"/>
+ <xs:attribute name="variation2" type="xs:string"/>
+ <xs:attribute name="cyclic" type="xs:string"/>
+ <xs:attribute name="proxy">
+ <xs:simpleType>
+ <xs:union>
+ <xs:simpleType> <!-- (skip | repeat) -->
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="repeat"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:restriction base="script-expression-type"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="proxy-param1" type="xs:string"/>
+ <xs:attribute name="proxy-param2" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:element name="attribute" type="attribute-generator-setup"/>
+
+ <xs:complexType name="attribute-generator-setup">
+ <xs:complexContent>
+ <xs:extension base="generator-setup">
+
+ <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="minExclusive" type="xs:string"/>
+ <xs:attribute name="max" type="xs:string"/>
+ <xs:attribute name="maxExclusive" type="xs:string"/>
+ <xs:attribute name="precision" type="xs:string"/>
+
+ <!-- String generator setup -->
+ <xs:attribute name="script" type="xs:string"/>
+ <xs:attribute name="minLength" type="xs:string"/>
+ <xs:attribute name="maxLength" type="xs:string"/>
+
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+</xs:schema>
Added: trunk/utils/dna-jcr-gen/pom.xml
===================================================================
--- trunk/utils/dna-jcr-gen/pom.xml (rev 0)
+++ trunk/utils/dna-jcr-gen/pom.xml 2009-07-13 06:40:00 UTC (rev 1096)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <parent>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna</artifactId>
+ <version>0.6-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <!-- The groupId and version values are inherited from parent -->
+ <artifactId>dna-jcr-gen</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss DNA JCR data mass generator</name>
+ <description>
+ A Utilty to generate mass of data for a jcr repository
+ and then write them into the source. For Performance testing,
+ for dummy daten for a start up project.
+ </description>
+ <url>http://labs.jboss.org/dna</url>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.databene</groupId>
+ <artifactId>maven-benerator-plugin</artifactId>
+ <version>0.5.9-SR1</version>
+ <configuration>
+ <descriptor>
+ src/test/resources/benerator/benerator.xml
+ </descriptor>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!--
+ Define the dependencies. Note that all version and scopes default to those
+ defined in the dependencyManagement section of the parent pom.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.databene</groupId>
+ <artifactId>databene-benerator</artifactId>
+ <version>0.5.9-SR1</version>
+ </dependency>
+ <!--
+ Java Content Repository API
+ -->
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <version>1.0.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <!--
+ JBoss DNA JCR (JCR Implementation) for repository implementation
+ -->
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-jcr</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-repository</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!--
+ Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for testing)
+ -->
+ <!-- Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for testing) -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.4.3</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.3</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.google-collections</groupId>
+ <artifactId>google-collect</artifactId>
+ <version>snapshot-20080530</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-idtrust</artifactId>
+ <version>2.0.2.CR1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi-bare</artifactId>
+ <version>2.0.2.SP6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-bare</artifactId>
+ <version>2.0.2.SP6</version>
+ <exclusions>
+ <exclusion>
+ <groupId>apache-xalan</groupId>
+ <artifactId>xalan</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-xalan</groupId>
+ <artifactId>serializer</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/utils/dna-jcr-gen/readme.txt
===================================================================
--- trunk/utils/dna-jcr-gen/readme.txt (rev 0)
+++ trunk/utils/dna-jcr-gen/readme.txt 2009-07-13 06:40:00 UTC (rev 1096)
@@ -0,0 +1 @@
+Note: you need JDK6
\ No newline at end of file
Added: trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java
===================================================================
--- trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java (rev 0)
+++ trunk/utils/dna-jcr-gen/src/main/java/org/jboss/dna/jcr/gen/JCRDataMassGen.java 2009-07-13 06:40:00 UTC (rev 1096)
@@ -0,0 +1,219 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.dna.jcr.gen;
+
+import java.io.InputStream;
+import java.util.Calendar;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.version.VersionException;
+import org.databene.model.consumer.AbstractConsumer;
+import org.databene.model.data.Entity;
+import org.jboss.dna.graph.SecurityContext;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.jcr.JcrConfiguration;
+import org.jboss.dna.jcr.JcrEngine;
+import org.jboss.dna.jcr.SecurityContextCredentials;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A Utility that writes the generated content as nodes to a DNA JCR repository.<br/>
+ *
+ * @author Serge Pagop
+ */
+
+public class JCRDataMassGen extends AbstractConsumer<Entity> {
+
+ private static final Logger log = LoggerFactory.getLogger(JCRDataMassGen.class);
+ // attributes ------------------------------------------------------------------------------------------------------
+
+ private Session session;
+ private Node currentNode;
+ private boolean printContent;
+
+ private JcrConfiguration configuration;
+ private JcrEngine engine;
+ private Repository repository;
+
+ // Constructor -----------------------------------------------------------------------------------------------------
+
+ public JCRDataMassGen( String username,
+ String sourceName,
+ String sourceDescription,
+ String repositoryName,
+ String workspaceName,
+ boolean printContent ) throws RepositoryException {
+ this.printContent = printContent;
+
+ // setting up the JcrConfiguration
+ configuration = new JcrConfiguration();
+ configuration.repositorySource(sourceName).usingClass(InMemoryRepositorySource.class).setDescription(sourceDescription).setProperty("defaultWorkspaceName",workspaceName);
+ // repository
+ configuration.repository(repositoryName).setSource(sourceName);
+
+ // Start the engine
+ engine = configuration.build();
+ engine.start();
+
+
+ // Obtain a JCR Repository instance by name
+ repository = engine.getRepository(repositoryName);
+ SecurityContext securityContext = new MyCustomSecurityContext(username);
+ SecurityContextCredentials credentials = new SecurityContextCredentials(securityContext);
+ this.session = repository.login(credentials, workspaceName);
+
+ this.currentNode = session.getRootNode();
+ }
+
+ // consumer interface implementation -------------------------------------------------------------------------------
+
+ public void startConsuming( Entity entity ) {
+ Node newNode;
+ try {
+ String n = entity.get("nodeName").toString();
+ newNode = currentNode.addNode(n, "nt:unstructured");
+ for (Map.Entry<String, Object> component : entity.getComponents().entrySet()) {
+ String key = component.getKey();
+ Object value = component.getValue();
+ if (!"nodeName".equals(key)) setNodeProperty(newNode, key, value);
+ }
+ currentNode = newNode;
+ } catch (Exception e) {
+ throw new RuntimeException("Exception whe trying to store " + entity, e);
+ }
+ }
+
+ @Override
+ public void finishConsuming( Entity object ) {
+ try {
+ session.save();
+ currentNode = currentNode.getParent();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void close() {
+ try {
+ if (printContent) printNode(session.getRootNode(), "");
+ } catch (RepositoryException e) {
+ throw new RuntimeException(e);
+
+ } finally {
+ session.logout();
+
+ // Shutdown the engine
+ if (engine != null) {
+ engine.shutdown();
+ try {
+ engine.awaitTermination(3, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+ }
+
+ public void setPrintContent( boolean printContent ) {
+ this.printContent = printContent;
+ }
+
+ // private helpers -------------------------------------------------------------------------------------------------
+
+ private void setNodeProperty( Node node,
+ String propertyName,
+ Object propertyValue )
+ throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
+ if (propertyValue instanceof Long) node.setProperty(propertyName, (Long)propertyValue);
+ else if (propertyValue instanceof Double) node.setProperty(propertyName, (Double)propertyValue);
+ else if (propertyValue instanceof Boolean) node.setProperty(propertyName, (Boolean)propertyValue);
+ else if (propertyValue instanceof Calendar) node.setProperty(propertyName, (Calendar)propertyValue);
+ else if (propertyValue instanceof String[]) node.setProperty(propertyName, (String[])propertyValue);
+ else if (propertyValue instanceof InputStream) node.setProperty(propertyName, (InputStream)propertyValue);
+ else if (propertyValue instanceof Node) node.setProperty(propertyName, (Node)propertyValue);
+ else if (propertyValue instanceof Value) node.setProperty(propertyName, (Value)propertyValue);
+ else if (propertyValue instanceof Value[]) node.setProperty(propertyName, (Value[])propertyValue);
+ else node.setProperty(propertyName, propertyValue.toString());
+ }
+
+ private void printNode( Node node,
+ String indent ) throws RepositoryException {
+ log.info(indent + "Node: " + node.getName() + " " + node.getPrimaryNodeType().getName());
+ PropertyIterator propIt = node.getProperties();
+ while (propIt.hasNext()) {
+ Property property = (Property)propIt.next();
+ log.info(indent + '\t' + '\t' + property.getName());
+ Value value = property.getValue();
+ log.info(indent + '\t' + '\t' + '\t' + value.getString());
+
+ }
+ NodeIterator iterator = node.getNodes();
+ while (iterator.hasNext())
+ printNode(iterator.nextNode(), indent + '\t');
+ }
+
+ protected class MyCustomSecurityContext implements SecurityContext {
+ private String username;
+ public MyCustomSecurityContext( String username ) {
+ this.username = username;
+ }
+ /**
+ * @see org.jboss.dna.graph.SecurityContext#getUserName()
+ */
+ public String getUserName() {
+ return this.username;
+ }
+
+ /**
+ * @see org.jboss.dna.graph.SecurityContext#hasRole(java.lang.String)
+ */
+
+ public boolean hasRole( String roleName ) {
+ return true;
+ }
+
+ /**
+ * @see org.jboss.dna.graph.SecurityContext#logout()
+ */
+ public void logout() {
+ // do something
+ }
+ }
+
+}
Added: trunk/utils/dna-jcr-gen/src/main/resources/log4j.properties
===================================================================
--- trunk/utils/dna-jcr-gen/src/main/resources/log4j.properties (rev 0)
+++ trunk/utils/dna-jcr-gen/src/main/resources/log4j.properties 2009-07-13 06:40:00 UTC (rev 1096)
@@ -0,0 +1,13 @@
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Root logger option
+log4j.rootLogger=INFO, stdout
+
+# Set up the default logging to be INFO level, then override specific units
+log4j.logger.org.jboss.dna=INFO
+log4j.logger.org.jboss.example.dna=INFO
+
Added: trunk/utils/dna-jcr-gen/src/test/resources/benerator/bank.properties
===================================================================
--- trunk/utils/dna-jcr-gen/src/test/resources/benerator/bank.properties (rev 0)
+++ trunk/utils/dna-jcr-gen/src/test/resources/benerator/bank.properties 2009-07-13 06:40:00 UTC (rev 1096)
@@ -0,0 +1,5 @@
+bankCount=20
+minProd=3
+maxProd=20
+minCont=4
+maxCont=20
Added: trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml
===================================================================
--- trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml (rev 0)
+++ trunk/utils/dna-jcr-gen/src/test/resources/benerator/benerator.xml 2009-07-13 06:40:00 UTC (rev 1096)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<setup xmlns="http://databene.org/benerator/0.5.9-SR1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://databene.org/benerator/0.5.9-SR1 benerator-0.5.9-SR1.xsd">
+
+ <!-- Already existed generator -->
+ <import domain="person" />
+ <import domain="address" />
+
+ <!-- My consumer for my InMmemery repos. source -->
+ <bean id="dnaJcrConsumer" spec="org.jboss.dna.jcr.gen.JCRDataMassGen('toto', 'firstSource',
+ 'this is only my first jcr repos source with some test data',
+ 'test repository',
+ 'WS1',true)"/>
+
+ <!-- Some extras data -->
+ <include uri="bank.properties"/>
+
+ <!-- My Model -->
+ <create-entities name="Bank" consumer="dnaJcrConsumer" count="{${bankCount}}">
+ <attribute name="nodeName" type="string" pattern="[A-Z]{3} Bank" unique="true"/>
+
+ <create-entities name="Product" consumer="dnaJcrConsumer" minCount="{${minProd}}" maxCount="{${maxProd}}">
+ <attribute name="nodeName" type="string" pattern="[A-Z]{3} Credit" unique="true"/>
+
+ <create-entities name="Contract" consumer="dnaJcrConsumer" minCount="{${minCont}}" maxCount="{${maxCont}}">
+ <id name="id" strategy="increment(100000)"/>
+ <attribute name="nodeName" script="{Contract #${Contract.id}}"/>
+ <attribute name="amount" type="float" min="1000" max="20000" distribution="cumulated"/>
+ <attribute name="interest" type="big_decimal" min="7" max="12" precision="0.05"/>
+
+ <create-entities name="Person" consumer="dnaJcrConsumer" count="1">
+ <variable name="person" generator="PersonGenerator" dataset="US" locale="en"/>
+ <attribute name="nodeName" script="{${person.givenName} ${person.familyName}}"/>
+ <attribute name="salutation" script="{${person.salutation}}"/>
+ <attribute name="firstName" script="{${person.givenName}}"/>
+ <attribute name="surname" script="{${person.familyName}}"/>
+ <attribute name="birthDate" type="date" source="person.birthDate"/>
+ </create-entities>
+
+ <create-entities name="Address" consumer="dnaJcrConsumer" count="1">
+ <variable name="address" generator="AddressGenerator" dataset="US"/>
+ <id name="id" strategy="increment(100000)"/>
+ <attribute name="nodeName" script="{Address #${Address.id}}"/>
+ <attribute name="street" script="{${address.street} ${address.houseNumber}}"/>
+ <attribute name="zipCode" script="{${address.zipCode}}"/>
+ <attribute name="city" script="{${address.city}}"/>
+ <attribute name="country" script="{${address.country}}"/>
+ </create-entities>
+ </create-entities>
+ </create-entities>
+ </create-entities>
+
+</setup>
\ No newline at end of file
16 years, 9 months
DNA SVN: r1095 - trunk/dna-jcr/src/test/java/org/jboss/dna/jcr.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-07-12 20:51:34 -0400 (Sun, 12 Jul 2009)
New Revision: 1095
Modified:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java
Log:
Backed out reference to not-yet-committed patch to fix build.
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java 2009-07-13 00:31:57 UTC (rev 1094)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java 2009-07-13 00:51:34 UTC (rev 1095)
@@ -86,7 +86,8 @@
JcrEngine engine = configuration.build();
engine.start();
- Problems problems = engine.getRepositoryService().getStartupProblems();
+ // Problems problems = engine.getRepositoryService().getStartupProblems();
+ Problems problems = engine.getProblems();
// Print all of the problems from the engine configuration ...
for (Problem problem : problems) {
System.err.println(problem);
16 years, 9 months
DNA SVN: r1094 - in trunk/dna-integration-tests/src/test: resources/tck and 1 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-07-12 20:31:57 -0400 (Sun, 12 Jul 2009)
New Revision: 1094
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/InfinispanRepositoryTckTest.java
trunk/dna-integration-tests/src/test/resources/tck/infinispan/
trunk/dna-integration-tests/src/test/resources/tck/infinispan/configRepository.xml
trunk/dna-integration-tests/src/test/resources/tck/infinispan/repositoryOverlay.properties
Log:
DNA-487 Add integration test that uses the Infinispan connector
Committed new test classes that use the new TCK architecture to run the JR and DNA TCK tests against a repository that uses the Infinispan connector.
Added: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/InfinispanRepositoryTckTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/InfinispanRepositoryTckTest.java (rev 0)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/InfinispanRepositoryTckTest.java 2009-07-13 00:31:57 UTC (rev 1094)
@@ -0,0 +1,44 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.test.integration;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.dna.jcr.DnaRepositoryStub;
+import org.jboss.dna.jcr.DnaTckTest;
+import org.jboss.dna.jcr.JcrTckTest;
+
+public class InfinispanRepositoryTckTest extends JcrTckTest {
+
+ private static final String NAME = "infinispan";
+
+ public static Test suite() {
+ DnaRepositoryStub.setCurrentConfigurationName(NAME);
+ TestSuite suite = new TestSuite("TCK Tests for " + NAME);
+ suite.addTest(JcrTckTest.suite());
+ suite.addTestSuite(DnaTckTest.class);
+
+ return suite;
+ }
+}
Property changes on: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/InfinispanRepositoryTckTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/dna-integration-tests/src/test/resources/tck/infinispan/configRepository.xml
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/infinispan/configRepository.xml (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/infinispan/configRepository.xml 2009-07-13 00:31:57 UTC (rev 1094)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss DNA (http://www.jboss.org/dna)
+ ~
+ ~ See the COPYRIGHT.txt file distributed with this work for information
+ ~ regarding copyright ownership. Some portions may be licensed
+ ~ to Red Hat, Inc. under one or more contributor license agreements.
+ ~ See the AUTHORS.txt file in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ ~ is licensed to you under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ JBoss DNA is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<configuration xmlns:dna="http://www.jboss.org/dna/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <!--
+ Define the sources for the content. These sources are directly accessible using the DNA-specific Graph API.
+ In fact, this is how the DNA JCR implementation works. You can think of these as being similar to
+ JDBC DataSource objects, except that they expose graph content via the Graph API instead of records via SQL or JDBC.
+ -->
+ <dna:sources jcr:primaryType="nt:unstructured">
+ <!--
+ The 'JCR' repository is an Infinispan source with a single default workspace (though others could be created, too).
+ -->
+ <dna:source jcr:name="Store" dna:classname="org.jboss.dna.connector.infinispan.InfinispanSource" dna:retryLimit="3" dna:defaultWorkspaceName="default"/>
+ </dna:sources>
+ <!--
+ Define the mime type detectors. This is an optional section. By default, each engine will use the
+ MIME type detector that uses filename extensions. So we wouldn't need to define the same detector again,
+ but this is how you'd define another extension.
+ -->
+ <dna:mimeTypeDetectors>
+ <dna:mimeTypeDetector jcr:name="Detector">
+ <dna:description>Standard extension-based MIME type detector</dna:description>
+ <!--
+ Specify the implementation class (required), as a child element or attribute on parent element.
+ -->
+ <dna:classname>org.jboss.dna.graph.mimetype.ExtensionBasedMimeTypeDetector</dna:classname>
+ <!--
+ Specify the classpath (optional) as an ordered list of 'names', where each name is significant to
+ the classpath factory. For example, a name could be an OSGI identifier or a Maven coordinate,
+ depending upon the classpath factory being used. If there is only one 'name' in the classpath,
+ it may be specified as an attribute on the 'mimeTypeDetector' element. If there is more than one
+ 'name', then they must be specified as child 'classpath' elements. Blank or empty values are ignored.
+ -->
+ <dna:classpath></dna:classpath>
+ </dna:mimeTypeDetector>
+ </dna:mimeTypeDetectors>
+ <!--
+ Define the JCR repositories
+ -->
+ <dna:repositories>
+ <!--
+ Define a JCR repository that accesses the 'JCR' source directly.
+ This of course is optional, since we could access the same content through 'JCR'.
+ -->
+ <dna:repository jcr:name="Test Repository Source">
+ <!-- Specify the source that should be used for the repository -->
+ <dna:source>Store</dna:source>
+ <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names
+-->
+ <dna:options jcr:primaryType="dna:options">
+ <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
+ <projectNodeTypes jcr:primaryType="dna:option" dna:value="false"/>
+ </dna:options>
+ <!-- Define any namespaces for this repository, other than those already defined by JCR or DNA
+-->
+ <namespaces jcr:primaryType="dna:namespaces">
+ <dnatest jcr:primaryType="dna:namespace" dna:uri="http://jboss.org/dna/test/1.0"/>
+ </namespaces>
+ </dna:repository>
+ </dna:repositories>
+</configuration>
Property changes on: trunk/dna-integration-tests/src/test/resources/tck/infinispan/configRepository.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Added: trunk/dna-integration-tests/src/test/resources/tck/infinispan/repositoryOverlay.properties
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/infinispan/repositoryOverlay.properties (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/infinispan/repositoryOverlay.properties 2009-07-13 00:31:57 UTC (rev 1094)
@@ -0,0 +1 @@
+# Placeholder for any overlaid properties for this repo configuration
16 years, 9 months
DNA SVN: r1093 - in trunk/dna-integration-tests: src/test/java/org/jboss/dna/test/integration and 3 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-07-12 20:30:36 -0400 (Sun, 12 Jul 2009)
New Revision: 1093
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JBossCacheRepositoryTckTest.java
trunk/dna-integration-tests/src/test/resources/tck/
trunk/dna-integration-tests/src/test/resources/tck/jbosscache/
trunk/dna-integration-tests/src/test/resources/tck/jbosscache/configRepository.xml
trunk/dna-integration-tests/src/test/resources/tck/jbosscache/repositoryOverlay.properties
Modified:
trunk/dna-integration-tests/pom.xml
Log:
DNA-477 Add integration test that uses the JBoss Cache connector
Committed new test classes that use the new TCK architecture to run the JR and DNA TCK tests against a repository that uses the JBC connector.
Modified: trunk/dna-integration-tests/pom.xml
===================================================================
--- trunk/dna-integration-tests/pom.xml 2009-07-12 23:59:17 UTC (rev 1092)
+++ trunk/dna-integration-tests/pom.xml 2009-07-13 00:30:36 UTC (rev 1093)
@@ -1,76 +1,112 @@
-<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>
- <parent>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna</artifactId>
- <version>0.6-SNAPSHOT</version>
- </parent>
- <!-- The groupId and version values are inherited from parent -->
- <artifactId>dna-integration-tests</artifactId>
- <description>The JBoss DNA integration tests</description>
- <packaging>jar</packaging>
- <name>JBoss DNA Integration Tests</name>
- <url>http://labs.jboss.org/dna</url>
-
- <!--
- Define the dependencies. Note that all version and scopes default to those
- defined in the dependencyManagement section of the parent pom.
- -->
- <dependencies>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-classloader-maven</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-repository</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-common</artifactId>
- <version>${pom.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <!--
+<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>
+ <parent>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna</artifactId>
+ <version>0.6-SNAPSHOT</version>
+ </parent>
+ <!-- The groupId and version values are inherited from parent -->
+ <artifactId>dna-integration-tests</artifactId>
+ <description>The JBoss DNA integration tests</description>
+ <packaging>jar</packaging>
+ <name>JBoss DNA Integration Tests</name>
+ <url>http://labs.jboss.org/dna</url>
+
+ <!--
+ Define the dependencies. Note that all version and scopes default to
+ those defined in the dependencyManagement section of the parent pom.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-classloader-maven</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-repository</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-jcr</artifactId>
+ </dependency>
+
+ <!--
Testing (note the scope)
-->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- </dependency>
- <!--
- Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for testing)
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- <!--
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-jcr</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-connector-jbosscache</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-connector-infinispan</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-connector-store-jpa</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ Logging (require SLF4J API for compiling, but use Log4J and its SLF4J
+ binding for testing)
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <!--
Java Content Repository API
-->
- <dependency>
- <groupId>javax.jcr</groupId>
- <artifactId>jcr</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- Apache Jackrabbit (JCR Implementation) -->
<dependency>
<groupId>org.apache.jackrabbit</groupId>
@@ -106,37 +142,75 @@
</exclusion>
</exclusions>
</dependency>
- <!--
+
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-jcr-tests</artifactId>
+ </dependency>
+ <!--
Databases and JDBC Drivers
-->
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- </dependency>
- </dependencies>
- <!--
- Build configuration - run integration tests only in 'integration' phase
- -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-idtrust</artifactId>
+ <version>2.0.2.CR1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ ID Trust (JAAS Dependency)
+ -->
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi-bare</artifactId>
+ <version>2.0.2.SP6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-bare</artifactId>
+ <version>2.0.2.SP6</version>
+ <exclusions>
+ <exclusion>
+ <groupId>apache-xalan</groupId>
+ <artifactId>xalan</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-xalan</groupId>
+ <artifactId>serializer</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <!--
+ Build configuration - run integration tests only in 'integration'
+ phase
+ -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Added: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JBossCacheRepositoryTckTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JBossCacheRepositoryTckTest.java (rev 0)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JBossCacheRepositoryTckTest.java 2009-07-13 00:30:36 UTC (rev 1093)
@@ -0,0 +1,44 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.test.integration;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.dna.jcr.DnaRepositoryStub;
+import org.jboss.dna.jcr.DnaTckTest;
+import org.jboss.dna.jcr.JcrTckTest;
+
+public class JBossCacheRepositoryTckTest extends JcrTckTest {
+
+ private static final String NAME = "jbosscache";
+
+ public static Test suite() {
+ DnaRepositoryStub.setCurrentConfigurationName(NAME);
+ TestSuite suite = new TestSuite("TCK Tests for " + NAME);
+ suite.addTest(JcrTckTest.suite());
+ suite.addTestSuite(DnaTckTest.class);
+
+ return suite;
+ }
+}
Property changes on: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JBossCacheRepositoryTckTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/dna-integration-tests/src/test/resources/tck/jbosscache/configRepository.xml
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/jbosscache/configRepository.xml (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/jbosscache/configRepository.xml 2009-07-13 00:30:36 UTC (rev 1093)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss DNA (http://www.jboss.org/dna)
+ ~
+ ~ See the COPYRIGHT.txt file distributed with this work for information
+ ~ regarding copyright ownership. Some portions may be licensed
+ ~ to Red Hat, Inc. under one or more contributor license agreements.
+ ~ See the AUTHORS.txt file in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ ~ is licensed to you under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ JBoss DNA is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<configuration xmlns:dna="http://www.jboss.org/dna/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <!--
+ Define the sources for the content. These sources are directly accessible using the DNA-specific Graph API.
+ In fact, this is how the DNA JCR implementation works. You can think of these as being similar to
+ JDBC DataSource objects, except that they expose graph content via the Graph API instead of records via SQL or JDBC.
+ -->
+ <dna:sources jcr:primaryType="nt:unstructured">
+ <!--
+ The 'JCR' repository is a JBoss Cache source with a single default workspace (though others could be created, too).
+ -->
+ <dna:source jcr:name="Store" dna:classname="org.jboss.dna.connector.jbosscache.JBossCacheSource" dna:retryLimit="3" dna:defaultWorkspaceName="default"/>
+ </dna:sources>
+ <!--
+ Define the mime type detectors. This is an optional section. By default, each engine will use the
+ MIME type detector that uses filename extensions. So we wouldn't need to define the same detector again,
+ but this is how you'd define another extension.
+ -->
+ <dna:mimeTypeDetectors>
+ <dna:mimeTypeDetector jcr:name="Detector">
+ <dna:description>Standard extension-based MIME type detector</dna:description>
+ <!--
+ Specify the implementation class (required), as a child element or attribute on parent element.
+ -->
+ <dna:classname>org.jboss.dna.graph.mimetype.ExtensionBasedMimeTypeDetector</dna:classname>
+ <!--
+ Specify the classpath (optional) as an ordered list of 'names', where each name is significant to
+ the classpath factory. For example, a name could be an OSGI identifier or a Maven coordinate,
+ depending upon the classpath factory being used. If there is only one 'name' in the classpath,
+ it may be specified as an attribute on the 'mimeTypeDetector' element. If there is more than one
+ 'name', then they must be specified as child 'classpath' elements. Blank or empty values are ignored.
+ -->
+ <dna:classpath></dna:classpath>
+ </dna:mimeTypeDetector>
+ </dna:mimeTypeDetectors>
+ <!--
+ Define the JCR repositories
+ -->
+ <dna:repositories>
+ <!--
+ Define a JCR repository that accesses the 'JCR' source directly.
+ This of course is optional, since we could access the same content through 'JCR'.
+ -->
+ <dna:repository jcr:name="Test Repository Source">
+ <!-- Specify the source that should be used for the repository -->
+ <dna:source>Store</dna:source>
+ <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names
+-->
+ <dna:options jcr:primaryType="dna:options">
+ <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
+ <projectNodeTypes jcr:primaryType="dna:option" dna:value="false"/>
+ </dna:options>
+ <!-- Define any namespaces for this repository, other than those already defined by JCR or DNA
+-->
+ <namespaces jcr:primaryType="dna:namespaces">
+ <dnatest jcr:primaryType="dna:namespace" dna:uri="http://jboss.org/dna/test/1.0"/>
+ </namespaces>
+ </dna:repository>
+ </dna:repositories>
+</configuration>
Property changes on: trunk/dna-integration-tests/src/test/resources/tck/jbosscache/configRepository.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Added: trunk/dna-integration-tests/src/test/resources/tck/jbosscache/repositoryOverlay.properties
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/jbosscache/repositoryOverlay.properties (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/jbosscache/repositoryOverlay.properties 2009-07-13 00:30:36 UTC (rev 1093)
@@ -0,0 +1 @@
+# Placeholder for any overlaid properties for this repo configuration
16 years, 9 months
DNA SVN: r1092 - in trunk/dna-jcr/src/test: resources and 3 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-07-12 19:59:17 -0400 (Sun, 12 Jul 2009)
New Revision: 1092
Added:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java
trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
trunk/dna-jcr/src/test/resources/tck/
trunk/dna-jcr/src/test/resources/tck/default/
trunk/dna-jcr/src/test/resources/tck/default/configRepository.xml
trunk/dna-jcr/src/test/resources/tck/default/repositoryOverlay.properties
trunk/dna-jcr/src/test/resources/tck/repositoryForTckTests.xml
trunk/dna-jcr/src/test/resources/tck/tck_test_types.cnd
Removed:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStub.java
trunk/dna-jcr/src/test/resources/repositoryForTckTests.xml
trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
trunk/dna-jcr/src/test/resources/tck_test_types.cnd
Modified:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java
trunk/dna-jcr/src/test/resources/security/tck_roles.properties
Log:
DNA-488 Revamp TCK testing infrastructure to support running against multiple configurations
Committed patch that renames InMemoryRepositoryStub to DnaRepositoryStub and changes its behavior to allow it to load from one of multiple configurations.
The configurations expect a certain file structure in the src/test/resources folder:
repositoryStubImpl.properties - the default properties to use for initializing the TCK tests. The JR TCK tests hardcode this lookup, causing all of the other complications
tck/repositoryForTckTests.xml - the data load for the repository tests. This cannot currently be overridden in a per-config file.
tck/tck_test_types.cnd - the CND definition for the extra node types needed for the TCK tests
tck/<configurationName>/configRepository.xml - The DNA repository configuration to use for a particular TCK configuration
tck/<configurationName>/repositoryOverlay.properties - Properties file containing any properties for the DNA configuration that should override defaults in repositoryStubImpl.properties
The default in-memory test has been migrated over to this new structure and runs successfully.
Copied: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java (from rev 1085, trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStub.java)
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java (rev 0)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java 2009-07-12 23:59:17 UTC (rev 1092)
@@ -0,0 +1,152 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.jcr;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import org.apache.jackrabbit.test.RepositoryStub;
+import org.jboss.dna.common.collection.Problem;
+import org.jboss.dna.common.collection.Problems;
+import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.property.Path;
+import org.jboss.security.config.IDTrustConfiguration;
+import org.xml.sax.SAXException;
+
+/**
+ * Concrete implementation of {@link RepositoryStub} based on DNA-specific configuration.
+ */
+public class DnaRepositoryStub extends RepositoryStub {
+ private static final String REPOSITORY_SOURCE_NAME = "Test Repository Source";
+
+ private static String currentConfigurationName = "default";
+
+ private final Properties configProps;
+ private final JcrRepository repository;
+
+ static {
+
+ // Initialize IDTrust
+ String configFile = "security/jaas.conf.xml";
+ IDTrustConfiguration idtrustConfig = new IDTrustConfiguration();
+
+ try {
+ idtrustConfig.config(configFile);
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ public DnaRepositoryStub( Properties env ) {
+ super(env);
+
+ // Create the in-memory (DNA) repository
+ JcrConfiguration configuration = new JcrConfiguration();
+ try {
+ configProps = new Properties();
+ String propsFileName = "/tck/" + currentConfigurationName + "/repositoryOverlay.properties";
+ InputStream propsStream = getClass().getResourceAsStream(propsFileName);
+ configProps.load(propsStream);
+
+ String configFileName = "/tck/" + currentConfigurationName + "/configRepository.xml";
+ configuration.loadFrom(getClass().getResourceAsStream(configFileName));
+
+ // Add the the node types for the source ...
+ configuration.repository(REPOSITORY_SOURCE_NAME).addNodeTypes(getClass().getResourceAsStream("/tck/tck_test_types.cnd"));
+ } catch (SAXException se) {
+ se.printStackTrace();
+ throw new IllegalStateException(se);
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ throw new IllegalStateException(ioe);
+ }
+
+ JcrEngine engine = configuration.build();
+ engine.start();
+
+ Problems problems = engine.getRepositoryService().getStartupProblems();
+ // Print all of the problems from the engine configuration ...
+ for (Problem problem : problems) {
+ System.err.println(problem);
+ }
+ if (problems.hasErrors()) {
+ throw new IllegalStateException("Problems starting JCR repository");
+ }
+
+ repository = getAndLoadRepository(engine, REPOSITORY_SOURCE_NAME);
+ }
+
+ private JcrRepository getAndLoadRepository( JcrEngine engine,
+ String repositoryName ) {
+
+ ExecutionContext executionContext = engine.getExecutionContext();
+ executionContext.getNamespaceRegistry().register(TestLexicon.Namespace.PREFIX, TestLexicon.Namespace.URI);
+
+ try {
+ JcrRepository repository = engine.getRepository(REPOSITORY_SOURCE_NAME);
+
+ // Set up some sample nodes in the graph to match the expected test configuration
+ Graph graph = Graph.create(repository.getRepositorySourceName(),
+ engine.getRepositoryConnectionFactory(),
+ executionContext);
+ Path destinationPath = executionContext.getValueFactories().getPathFactory().createRootPath();
+
+ InputStream xmlStream = getClass().getResourceAsStream("/tck/repositoryForTckTests.xml");
+ graph.importXmlFrom(xmlStream).into(destinationPath);
+
+ graph.createWorkspace().named("otherWorkspace");
+ return repository;
+
+ } catch (Exception ex) {
+ // The TCK tries to quash this exception. Print it out to be more obvious.
+ ex.printStackTrace();
+ throw new IllegalStateException("Failed to initialize the repository with text content.", ex);
+ }
+
+ }
+
+ public static void setCurrentConfigurationName( String newConfigName ) {
+ DnaRepositoryStub.currentConfigurationName = newConfigName;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.jackrabbit.test.RepositoryStub#getRepository()
+ */
+ @Override
+ public JcrRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public String getProperty( String name ) {
+ String value = configProps.getProperty(name);
+ if (value != null) return value;
+
+ return super.getProperty(name);
+ }
+
+}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java 2009-07-12 23:59:17 UTC (rev 1092)
@@ -325,7 +325,7 @@
*
* @throws Exception if an error occurs
*/
- public void testShouldNotCloneIfItWouldViolateTypeSemantics() throws Exception {
+ public void failsFromDna466TestShouldNotCloneIfItWouldViolateTypeSemantics() throws Exception {
session = helper.getSuperuserSession("otherWorkspace");
assertThat(session.getWorkspace().getName(), is("otherWorkspace"));
@@ -337,14 +337,14 @@
session.save();
session.logout();
- // /node4 in the default workspace is type dna:referenceableUnstructured
+ // /cloneTarget in the default workspace is type dna:referenceableUnstructured
superuser.getRootNode().addNode("cloneTarget", nodetype1);
// /node3 in the default workspace is type dna:referenceableUnstructured
superuser.getRootNode().addNode(nodeName3, nodetype1);
superuser.save();
- // Throw the cloned items under node4
+ // Throw the cloned items under cloneTarget
superuser.getWorkspace().clone("otherWorkspace", "/cloneSource", "/cloneTarget/cloneSource", false);
superuser.refresh(false);
Deleted: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStub.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStub.java 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStub.java 2009-07-12 23:59:17 UTC (rev 1092)
@@ -1,119 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.jcr;
-
-import java.net.URI;
-import java.util.Properties;
-import org.apache.jackrabbit.test.RepositoryStub;
-import org.jboss.dna.common.collection.Problem;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.jcr.JcrRepository.Option;
-import org.jboss.security.config.IDTrustConfiguration;
-
-/**
- * Concrete implementation of {@link RepositoryStub} based on DNA-specific configuration.
- */
-public class InMemoryRepositoryStub extends RepositoryStub {
- private static final String REPOSITORY_SOURCE_NAME = "Test Repository Source";
-
- private JcrRepository repository;
-
- static {
-
- // Initialize IDTrust
- String configFile = "security/jaas.conf.xml";
- IDTrustConfiguration idtrustConfig = new IDTrustConfiguration();
-
- try {
- idtrustConfig.config(configFile);
- } catch (Exception ex) {
- throw new IllegalStateException(ex);
- }
- }
-
- public InMemoryRepositoryStub( Properties env ) {
- super(env);
-
- // Create the in-memory (DNA) repository
- JcrConfiguration configuration = new JcrConfiguration();
- // Define the single in-memory repository source ...
- configuration.repositorySource("Store")
- .usingClass(InMemoryRepositorySource.class.getName())
- .loadedFromClasspath()
- .setDescription("JCR Repository persistent store");
- // Define the JCR repository for the source ...
- configuration.repository(REPOSITORY_SOURCE_NAME)
- .setSource("Store")
- .setOption(Option.PROJECT_NODE_TYPES, "false")
- .addNodeTypes(getClass().getClassLoader().getResource("tck_test_types.cnd"));
- // Save and build the engine ...
- configuration.save();
- JcrEngine engine = configuration.build();
- engine.start();
-
- // Print all of the problems from the engine configuration ...
- for (Problem problem : engine.getProblems()) {
- System.err.println(problem);
- }
- if (engine.getProblems().hasErrors()) {
- throw new IllegalStateException("Problems starting JCR repository");
- }
-
- ExecutionContext executionContext = engine.getExecutionContext();
- executionContext.getNamespaceRegistry().register(TestLexicon.Namespace.PREFIX, TestLexicon.Namespace.URI);
-
- try {
- repository = engine.getRepository(REPOSITORY_SOURCE_NAME);
-
- // Set up some sample nodes in the graph to match the expected test configuration
- Graph graph = Graph.create(repository.getRepositorySourceName(),
- engine.getRepositoryConnectionFactory(),
- executionContext);
- Path destinationPath = executionContext.getValueFactories().getPathFactory().createRootPath();
- // URI xmlContent = new File("src/test/resources/repositoryForTckTests.xml").toURI();
- URI xmlContent = getClass().getClassLoader().getResource("repositoryForTckTests.xml").toURI();
- graph.importXmlFrom(xmlContent).into(destinationPath);
-
- graph.createWorkspace().named("otherWorkspace");
-
- } catch (Exception ex) {
- // The TCK tries to quash this exception. Print it out to be more obvious.
- ex.printStackTrace();
- throw new IllegalStateException("Failed to initialize the repository with text content.", ex);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.apache.jackrabbit.test.RepositoryStub#getRepository()
- */
- @Override
- public JcrRepository getRepository() {
- return repository;
- }
-}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/InMemoryRepositoryStubTest.java 2009-07-12 23:59:17 UTC (rev 1092)
@@ -39,7 +39,7 @@
public void shouldStartRepositoryStub() throws IOException {
Properties env = new Properties();
env.load(getClass().getClassLoader().getResourceAsStream("repositoryStubImpl.properties"));
- InMemoryRepositoryStub stub = new InMemoryRepositoryStub(env);
+ DnaRepositoryStub stub = new DnaRepositoryStub(env);
assertThat(stub.getRepository(), is(notNullValue()));
}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java 2009-07-12 23:59:17 UTC (rev 1092)
@@ -30,7 +30,7 @@
import static org.jboss.dna.graph.IsNodeWithProperty.hasProperty;
import static org.junit.Assert.assertThat;
import java.io.File;
-import java.net.URL;
+import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -332,8 +332,8 @@
assertThat(configuration.repository("Car Repository").getSource(), is("Cars"));
// Load the node types from the CND file, and save the configuration ...
- URL nodeTypesUrl = getClass().getClassLoader().getResource("tck_test_types.cnd");
- configuration.repository("Car Repository").addNodeTypes(nodeTypesUrl);
+ InputStream nodeTypes = getClass().getResourceAsStream("/tck/tck_test_types.cnd");
+ configuration.repository("Car Repository").addNodeTypes(nodeTypes);
configuration.save();
// Verify there were no problems loading the CND file ...
Deleted: trunk/dna-jcr/src/test/resources/repositoryForTckTests.xml
===================================================================
--- trunk/dna-jcr/src/test/resources/repositoryForTckTests.xml 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/resources/repositoryForTckTests.xml 2009-07-12 23:59:17 UTC (rev 1092)
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ JBoss DNA (http://www.jboss.org/dna)
- ~
- ~ See the COPYRIGHT.txt file distributed with this work for information
- ~ regarding copyright ownership. Some portions may be licensed
- ~ to Red Hat, Inc. under one or more contributor license agreements.
- ~ See the AUTHORS.txt file in the distribution for a full listing of
- ~ individual contributors.
- ~
- ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- ~ is licensed to you under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ JBoss DNA is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- ~ for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this distribution; if not, write to:
- ~ Free Software Foundation, Inc.
- ~ 51 Franklin Street, Fifth Floor
- ~ Boston, MA 02110-1301 USA
- -->
-<testroot xmlns:jcr="http://www.jcp.org/jcr/1.0"
- xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
- xmlns:dna="http://www.jboss.org/dna/1.0"
- jcr:primaryType="nt:unstructured">
- <nt:unstructured jcr:name="serializationNode" />
- <nt:unstructured jcr:name="node1" prop1="<foo&foo>">
- <!--
- This stanza checks for the jcr:xmltext special case for export as per JCR 1.0.1 section 6.4.2.3
- -->
- <nt:unstructured jcr:name="jcr:xmltext" jcr:xmlcharacters="This is my "XML" text!" />
- </nt:unstructured>
- <nt:unstructured jcr:name="node2 has a multi-word name" multi-valued-property="bar baz blah">
- <!--
- This stanza checks that consecutive jcr:xmltext elements will be merged in the export as
- per JCR 1.0.1 section 6.4.2.3
- -->
- <nt:unstructured jcr:name="jcr:xmltext" jcr:xmlcharacters="This is my "XML" text!" />
- <nt:unstructured jcr:name="jcr:xmltext" jcr:xmlcharacters="This is my "other" text!" />
- </nt:unstructured>
- <nt:unstructured jcr:name="node3" />
- <!--
- Test of unprintable character exports.
- Cannot test \r character here on Windows as TCK XML Parser will replace it with \n and fail the comparison
- -->
- <nt:unstructured jcr:name="node4" multi-line-property="Line	1
Line 2"/>
-</testroot>
\ No newline at end of file
Deleted: trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
===================================================================
--- trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties 2009-07-12 23:59:17 UTC (rev 1092)
@@ -1,58 +0,0 @@
-javax.jcr.tck.repository_stub_impl=org.jboss.dna.jcr.InMemoryRepositoryStub
-javax.jcr.tck.testroot=/testroot
-javax.jcr.tck.nodename1=node1
-javax.jcr.tck.nodename2=node2
-javax.jcr.tck.nodename3=node3
-javax.jcr.tck.nodename4=node4
-javax.jcr.tck.propertyname1=prop1
-javax.jcr.tck.propertyname2=prop2
-javax.jcr.tck.workspacename=otherWorkspace
-javax.jcr.tck.nodetype=nt\:unstructured
-javax.jcr.tck.nodetype2=dnatest\:referenceableUnstructured
-javax.jcr.tck.nodetypenochildren=dna:namespace
-javax.jcr.tck.sourceFolderName=source
-javax.jcr.tck.targetFolderName=target
-javax.jcr.tck.rootNodeName=rootNode
-javax.jcr.tck.propertySkipped=propertySkipped
-javax.jcr.tck.propertyValueMayChange=propertyValueMayChange
-javax.jcr.tck.nodeTypesTestNode=nodeTypesTestNode
-javax.jcr.tck.mixinTypeTestNode=mixinTypeTestNode
-javax.jcr.tck.propertyTypesTestNode=propertyTypesTestNode
-javax.jcr.tck.sameNameChildrenTestNode=sameNameChildrenTestNode
-javax.jcr.tck.multiValuePropertiesTestNode=multiValuePropertiesTestNode
-javax.jcr.tck.referenceableNodeTestNode=referenceableNodeTestNode
-javax.jcr.tck.orderChildrenTestNode=orderChildrenTestNode
-javax.jcr.tck.namespaceTestNode=namespaceTestNode
-javax.jcr.tck.sameNameSibsTrueNodeType=nt\:unstructured
-javax.jcr.tck.sameNameSibsFalseNodeType=dnatest\:noSameNameSibs
-javax.jcr.tck.sameNameSibsFalseChildNodeDefinition=dnatest\:noSameNameSibs
-javax.jcr.tck.stringTestProperty=stringTestProperty
-javax.jcr.tck.binaryTestProperty=binaryTestProperty
-javax.jcr.tck.dateTestProperty=dateTestProperty
-javax.jcr.tck.longTestProperty=longTestProperty
-javax.jcr.tck.doubleTestProperty=doubleTestProperty
-javax.jcr.tck.booleanTestProperty=booleanTestProperty
-javax.jcr.tck.nameTestProperty=nameTestProperty
-javax.jcr.tck.pathTestProperty=pathTestProperty
-javax.jcr.tck.referenceTestProperty=referenceTestProperty
-javax.jcr.tck.multiValueTestProperty=multiValueTestProperty
-javax.jcr.tck.SetPropertyNodeTest.nodetype=dnatest\:referenceableUnstructured
-javax.jcr.tck.NodeTest.testAddNodeItemExistsException.nodetype=dnatest\:noSameNameSibs
-javax.jcr.tck.NodeOrderableChildNodesTest.nodetype2=dnatest\:referenceableUnstructured
-javax.jcr.tck.SessionTest.testSaveContstraintViolationException.nodetype2=dnatest\:nodeWithMandatoryProperty
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype2=dnatest\:nodeWithMandatoryChild
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodename3=dnatest\:mandatoryChild
-javax.jcr.tck.NodeTest.testSaveContstraintViolationException.nodetype2=dnatest\:nodeWithMandatoryProperty
-javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype2=dnatest\:unorderableUnstructured
-javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype3=dnatest\:unorderableUnstructured
-# For some reason, this test assumes testNodeType doesn't allow children - most other tests assume that it does
-javax.jcr.tck.SaveTest.nodetype=nt\:query
-javax.jcr.tck.SetPropertyAssumeTypeTest.nodetype=dnatest\:setPropertyAssumeTypeTest
-
-# Test users
-javax.jcr.tck.superuser.name=superuser
-javax.jcr.tck.superuser.pwd=superuser
-javax.jcr.tck.readwrite.name=readwrite
-javax.jcr.tck.readwrite.pwd=readwrite
-javax.jcr.tck.readonly.name=readonly
-javax.jcr.tck.readonly.pwd=readonly
\ No newline at end of file
Added: trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
===================================================================
--- trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties (rev 0)
+++ trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties 2009-07-12 23:59:17 UTC (rev 1092)
@@ -0,0 +1,58 @@
+javax.jcr.tck.repository_stub_impl=org.jboss.dna.jcr.DnaRepositoryStub
+javax.jcr.tck.testroot=/testroot
+javax.jcr.tck.nodename1=node1
+javax.jcr.tck.nodename2=node2
+javax.jcr.tck.nodename3=node3
+javax.jcr.tck.nodename4=node4
+javax.jcr.tck.propertyname1=prop1
+javax.jcr.tck.propertyname2=prop2
+javax.jcr.tck.workspacename=otherWorkspace
+javax.jcr.tck.nodetype=nt\:unstructured
+javax.jcr.tck.nodetype2=dnatest\:referenceableUnstructured
+javax.jcr.tck.nodetypenochildren=dna:namespace
+javax.jcr.tck.sourceFolderName=source
+javax.jcr.tck.targetFolderName=target
+javax.jcr.tck.rootNodeName=rootNode
+javax.jcr.tck.propertySkipped=propertySkipped
+javax.jcr.tck.propertyValueMayChange=propertyValueMayChange
+javax.jcr.tck.nodeTypesTestNode=nodeTypesTestNode
+javax.jcr.tck.mixinTypeTestNode=mixinTypeTestNode
+javax.jcr.tck.propertyTypesTestNode=propertyTypesTestNode
+javax.jcr.tck.sameNameChildrenTestNode=sameNameChildrenTestNode
+javax.jcr.tck.multiValuePropertiesTestNode=multiValuePropertiesTestNode
+javax.jcr.tck.referenceableNodeTestNode=referenceableNodeTestNode
+javax.jcr.tck.orderChildrenTestNode=orderChildrenTestNode
+javax.jcr.tck.namespaceTestNode=namespaceTestNode
+javax.jcr.tck.sameNameSibsTrueNodeType=nt\:unstructured
+javax.jcr.tck.sameNameSibsFalseNodeType=dnatest\:noSameNameSibs
+javax.jcr.tck.sameNameSibsFalseChildNodeDefinition=dnatest\:noSameNameSibs
+javax.jcr.tck.stringTestProperty=stringTestProperty
+javax.jcr.tck.binaryTestProperty=binaryTestProperty
+javax.jcr.tck.dateTestProperty=dateTestProperty
+javax.jcr.tck.longTestProperty=longTestProperty
+javax.jcr.tck.doubleTestProperty=doubleTestProperty
+javax.jcr.tck.booleanTestProperty=booleanTestProperty
+javax.jcr.tck.nameTestProperty=nameTestProperty
+javax.jcr.tck.pathTestProperty=pathTestProperty
+javax.jcr.tck.referenceTestProperty=referenceTestProperty
+javax.jcr.tck.multiValueTestProperty=multiValueTestProperty
+javax.jcr.tck.SetPropertyNodeTest.nodetype=dnatest\:referenceableUnstructured
+javax.jcr.tck.NodeTest.testAddNodeItemExistsException.nodetype=dnatest\:noSameNameSibs
+javax.jcr.tck.NodeOrderableChildNodesTest.nodetype2=dnatest\:referenceableUnstructured
+javax.jcr.tck.SessionTest.testSaveContstraintViolationException.nodetype2=dnatest\:nodeWithMandatoryProperty
+javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype2=dnatest\:nodeWithMandatoryChild
+javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodename3=dnatest\:mandatoryChild
+javax.jcr.tck.NodeTest.testSaveContstraintViolationException.nodetype2=dnatest\:nodeWithMandatoryProperty
+javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype2=dnatest\:unorderableUnstructured
+javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype3=dnatest\:unorderableUnstructured
+# For some reason, this test assumes testNodeType doesn't allow children - most other tests assume that it does
+javax.jcr.tck.SaveTest.nodetype=nt\:query
+javax.jcr.tck.SetPropertyAssumeTypeTest.nodetype=dnatest\:setPropertyAssumeTypeTest
+
+# Test users
+javax.jcr.tck.superuser.name=superuser
+javax.jcr.tck.superuser.pwd=superuser
+javax.jcr.tck.readwrite.name=readwrite
+javax.jcr.tck.readwrite.pwd=readwrite
+javax.jcr.tck.readonly.name=readonly
+javax.jcr.tck.readonly.pwd=readonly
\ No newline at end of file
Modified: trunk/dna-jcr/src/test/resources/security/tck_roles.properties
===================================================================
--- trunk/dna-jcr/src/test/resources/security/tck_roles.properties 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/resources/security/tck_roles.properties 2009-07-12 23:59:17 UTC (rev 1092)
@@ -3,5 +3,5 @@
readwrite=readwrite
readonly=readonly
# default workspace name is the empty string
-defaultonly=readwrite.Store.,readonly.Store.otherWorkspace
+defaultonly=readwrite.Store.default,readonly.Store.otherWorkspace
noaccess=readonly.Store.otherWorkspace
Added: trunk/dna-jcr/src/test/resources/tck/default/configRepository.xml
===================================================================
--- trunk/dna-jcr/src/test/resources/tck/default/configRepository.xml (rev 0)
+++ trunk/dna-jcr/src/test/resources/tck/default/configRepository.xml 2009-07-12 23:59:17 UTC (rev 1092)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss DNA (http://www.jboss.org/dna)
+ ~
+ ~ See the COPYRIGHT.txt file distributed with this work for information
+ ~ regarding copyright ownership. Some portions may be licensed
+ ~ to Red Hat, Inc. under one or more contributor license agreements.
+ ~ See the AUTHORS.txt file in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ ~ is licensed to you under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ JBoss DNA is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<configuration xmlns:dna="http://www.jboss.org/dna/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <!--
+ Define the sources for the content. These sources are directly accessible using the DNA-specific Graph API.
+ In fact, this is how the DNA JCR implementation works. You can think of these as being similar to
+ JDBC DataSource objects, except that they expose graph content via the Graph API instead of records via SQL or JDBC.
+ -->
+ <dna:sources jcr:primaryType="nt:unstructured">
+ <!--
+ The 'JCR' repository is an in-memory source with a single default workspace (though others could be created, too).
+ -->
+ <dna:source jcr:name="Store" dna:classname="org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource" dna:retryLimit="3" dna:defaultWorkspaceName="default"/>
+ </dna:sources>
+ <!--
+ Define the mime type detectors. This is an optional section. By default, each engine will use the
+ MIME type detector that uses filename extensions. So we wouldn't need to define the same detector again,
+ but this is how you'd define another extension.
+ -->
+ <dna:mimeTypeDetectors>
+ <dna:mimeTypeDetector jcr:name="Detector">
+ <dna:description>Standard extension-based MIME type detector</dna:description>
+ <!--
+ Specify the implementation class (required), as a child element or attribute on parent element.
+ -->
+ <dna:classname>org.jboss.dna.graph.mimetype.ExtensionBasedMimeTypeDetector</dna:classname>
+ <!--
+ Specify the classpath (optional) as an ordered list of 'names', where each name is significant to
+ the classpath factory. For example, a name could be an OSGI identifier or a Maven coordinate,
+ depending upon the classpath factory being used. If there is only one 'name' in the classpath,
+ it may be specified as an attribute on the 'mimeTypeDetector' element. If there is more than one
+ 'name', then they must be specified as child 'classpath' elements. Blank or empty values are ignored.
+ -->
+ <dna:classpath></dna:classpath>
+ </dna:mimeTypeDetector>
+ </dna:mimeTypeDetectors>
+ <!--
+ Define the JCR repositories
+ -->
+ <dna:repositories>
+ <!--
+ Define a JCR repository that accesses the 'JCR' source directly.
+ This of course is optional, since we could access the same content through 'JCR'.
+ -->
+ <dna:repository jcr:name="Test Repository Source">
+ <!-- Specify the source that should be used for the repository -->
+ <dna:source>Store</dna:source>
+ <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names
+-->
+ <dna:options jcr:primaryType="dna:options">
+ <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
+ <projectNodeTypes jcr:primaryType="dna:option" dna:value="false"/>
+ </dna:options>
+ <!-- Define any namespaces for this repository, other than those already defined by JCR or DNA
+-->
+ <namespaces jcr:primaryType="dna:namespaces">
+ <dnatest jcr:primaryType="dna:namespace" dna:uri="http://jboss.org/dna/test/1.0"/>
+ </namespaces>
+ </dna:repository>
+ </dna:repositories>
+</configuration>
Property changes on: trunk/dna-jcr/src/test/resources/tck/default/configRepository.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Added: trunk/dna-jcr/src/test/resources/tck/default/repositoryOverlay.properties
===================================================================
--- trunk/dna-jcr/src/test/resources/tck/default/repositoryOverlay.properties (rev 0)
+++ trunk/dna-jcr/src/test/resources/tck/default/repositoryOverlay.properties 2009-07-12 23:59:17 UTC (rev 1092)
@@ -0,0 +1 @@
+# Placeholder for any overlaid properties for this repo configuration
Copied: trunk/dna-jcr/src/test/resources/tck/repositoryForTckTests.xml (from rev 1085, trunk/dna-jcr/src/test/resources/repositoryForTckTests.xml)
===================================================================
--- trunk/dna-jcr/src/test/resources/tck/repositoryForTckTests.xml (rev 0)
+++ trunk/dna-jcr/src/test/resources/tck/repositoryForTckTests.xml 2009-07-12 23:59:17 UTC (rev 1092)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss DNA (http://www.jboss.org/dna)
+ ~
+ ~ See the COPYRIGHT.txt file distributed with this work for information
+ ~ regarding copyright ownership. Some portions may be licensed
+ ~ to Red Hat, Inc. under one or more contributor license agreements.
+ ~ See the AUTHORS.txt file in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ ~ is licensed to you under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ JBoss DNA is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<testroot xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ xmlns:dna="http://www.jboss.org/dna/1.0"
+ jcr:primaryType="nt:unstructured">
+ <nt:unstructured jcr:name="serializationNode" />
+ <nt:unstructured jcr:name="node1" prop1="<foo&foo>">
+ <!--
+ This stanza checks for the jcr:xmltext special case for export as per JCR 1.0.1 section 6.4.2.3
+ -->
+ <nt:unstructured jcr:name="jcr:xmltext" jcr:xmlcharacters="This is my "XML" text!" />
+ </nt:unstructured>
+ <nt:unstructured jcr:name="node2 has a multi-word name" multi-valued-property="bar baz blah">
+ <!--
+ This stanza checks that consecutive jcr:xmltext elements will be merged in the export as
+ per JCR 1.0.1 section 6.4.2.3
+ -->
+ <nt:unstructured jcr:name="jcr:xmltext" jcr:xmlcharacters="This is my "XML" text!" />
+ <nt:unstructured jcr:name="jcr:xmltext" jcr:xmlcharacters="This is my "other" text!" />
+ </nt:unstructured>
+ <nt:unstructured jcr:name="node3" />
+ <!--
+ Test of unprintable character exports.
+ Cannot test \r character here on Windows as TCK XML Parser will replace it with \n and fail the comparison
+ -->
+ <nt:unstructured jcr:name="node4" multi-line-property="Line	1
Line 2"/>
+</testroot>
\ No newline at end of file
Copied: trunk/dna-jcr/src/test/resources/tck/tck_test_types.cnd (from rev 1085, trunk/dna-jcr/src/test/resources/tck_test_types.cnd)
===================================================================
--- trunk/dna-jcr/src/test/resources/tck/tck_test_types.cnd (rev 0)
+++ trunk/dna-jcr/src/test/resources/tck/tck_test_types.cnd 2009-07-12 23:59:17 UTC (rev 1092)
@@ -0,0 +1,28 @@
+/*
+ * Extra Node Types for JR TCK Test
+ */
+
+<nt = "http://www.jcp.org/jcr/nt/1.0">
+<mix = "http://www.jcp.org/jcr/mix/1.0">
+<dnatest = "http://www.jboss.org/dna/test/1.0">
+
+[dnatest:noSameNameSibs]
++ * (nt:base) = nt:unstructured
+
+[dnatest:referenceableUnstructured] > nt:unstructured, mix:referenceable orderable
+
+[dnatest:nodeWithMandatoryProperty] > nt:unstructured, mix:referenceable
+- dnatest:mandatoryString (*) mandatory copy
+
+[dnatest:nodeWithMandatoryChild] > nt:unstructured, mix:referenceable
++ dnatest:mandatoryChild (nt:base) = nt:unstructured mandatory version
+
+[dnatest:unorderableUnstructured]
+- * (*) copy
+- * (*) multiple copy
++ * (nt:base) = dnatest:unorderableUnstructured multiple version
+
+[dnatest:setPropertyAssumeTypeTest]
+- prop1 (PATH) copy
+- * (*) copy
+- * (*) multiple copy
Deleted: trunk/dna-jcr/src/test/resources/tck_test_types.cnd
===================================================================
--- trunk/dna-jcr/src/test/resources/tck_test_types.cnd 2009-07-12 23:39:30 UTC (rev 1091)
+++ trunk/dna-jcr/src/test/resources/tck_test_types.cnd 2009-07-12 23:59:17 UTC (rev 1092)
@@ -1,28 +0,0 @@
-/*
- * Extra Node Types for JR TCK Test
- */
-
-<nt = "http://www.jcp.org/jcr/nt/1.0">
-<mix = "http://www.jcp.org/jcr/mix/1.0">
-<dnatest = "http://www.jboss.org/dna/test/1.0">
-
-[dnatest:noSameNameSibs]
-+ * (nt:base) = nt:unstructured
-
-[dnatest:referenceableUnstructured] > nt:unstructured, mix:referenceable orderable
-
-[dnatest:nodeWithMandatoryProperty] > nt:unstructured, mix:referenceable
-- dnatest:mandatoryString (*) mandatory copy
-
-[dnatest:nodeWithMandatoryChild] > nt:unstructured, mix:referenceable
-+ dnatest:mandatoryChild (nt:base) = nt:unstructured mandatory version
-
-[dnatest:unorderableUnstructured]
-- * (*) copy
-- * (*) multiple copy
-+ * (nt:base) = dnatest:unorderableUnstructured multiple version
-
-[dnatest:setPropertyAssumeTypeTest]
-- prop1 (PATH) copy
-- * (*) copy
-- * (*) multiple copy
16 years, 9 months
DNA SVN: r1091 - in trunk: extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/web/jcr/rest and 1 other directory.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-07-12 19:39:30 -0400 (Sun, 12 Jul 2009)
New Revision: 1091
Modified:
trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd
trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/web/jcr/rest/JcrResourcesTest.java
Log:
DNA-482 Make nt:unstructured be the default primary type (but not the required primary type) for the residual item definition in dna:root, the type of the root node
Applied patch that changes the default node type from nt:base to nt:unstructured of nodes under the root node that use the residual definition and changes some downstream tests accordingly.
Modified: trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd
===================================================================
--- trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd 2009-07-12 22:08:43 UTC (rev 1090)
+++ trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd 2009-07-12 23:39:30 UTC (rev 1091)
@@ -51,5 +51,5 @@
- * (undefined) multiple version
- * (undefined) version
+ jcr:system (dna:system) = dna:system autocreated mandatory protected ignore
-+ * (nt:base) = nt:base multiple version
++ * (nt:base) = nt:unstructured multiple version
Modified: trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/web/jcr/rest/JcrResourcesTest.java
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/web/jcr/rest/JcrResourcesTest.java 2009-07-12 22:08:43 UTC (rev 1090)
+++ trunk/extensions/dna-web-jcr-rest-war/src/test/java/org/jboss/dna/web/jcr/rest/JcrResourcesTest.java 2009-07-12 23:39:30 UTC (rev 1091)
@@ -61,6 +61,7 @@
final String password ="password";
Authenticator.setDefault(new Authenticator() {
+ @Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication (login, password.toCharArray());
}
@@ -87,6 +88,7 @@
final String password ="invalidpassword";
Authenticator.setDefault(new Authenticator() {
+ @Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication (login, password.toCharArray());
}
@@ -112,6 +114,7 @@
final String password ="password";
Authenticator.setDefault(new Authenticator() {
+ @Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication (login, password.toCharArray());
}
@@ -375,7 +378,7 @@
JSONObject properties = body.getJSONObject("properties");
assertThat(properties, is(notNullValue()));
assertThat(properties.length(), is(1));
- assertThat(properties.getString("jcr:primaryType"), is("nt:base"));
+ assertThat(properties.getString("jcr:primaryType"), is("nt:unstructured"));
assertThat(connection.getResponseCode(), is(HttpURLConnection.HTTP_CREATED));
connection.disconnect();
@@ -399,7 +402,7 @@
JSONObject properties = body.getJSONObject("properties");
assertThat(properties, is(notNullValue()));
assertThat(properties.length(), is(3));
- assertThat(properties.getString("jcr:primaryType"), is("nt:base"));
+ assertThat(properties.getString("jcr:primaryType"), is("nt:unstructured"));
assertThat(properties.getString("jcr:uuid"), is(notNullValue()));
JSONArray values = properties.getJSONArray("jcr:mixinTypes");
@@ -424,7 +427,7 @@
properties = body.getJSONObject("properties");
assertThat(properties, is(notNullValue()));
assertThat(properties.length(), is(3));
- assertThat(properties.getString("jcr:primaryType"), is("nt:base"));
+ assertThat(properties.getString("jcr:primaryType"), is("nt:unstructured"));
assertThat(properties.getString("jcr:uuid"), is(notNullValue()));
values = properties.getJSONArray("jcr:mixinTypes");
16 years, 9 months