DNA SVN: r1409 - trunk/docs/reference/src/main/docbook/en-US/content/connectors.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-05 19:11:37 -0500 (Sat, 05 Dec 2009)
New Revision: 1409
Modified:
trunk/docs/reference/src/main/docbook/en-US/content/connectors/federation.xml
Log:
Found two typos while skimming the doc
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/federation.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/federation.xml 2009-12-05 23:21:03 UTC (rev 1408)
+++ trunk/docs/reference/src/main/docbook/en-US/content/connectors/federation.xml 2009-12-06 00:11:37 UTC (rev 1409)
@@ -318,7 +318,7 @@
<sect1>
<title>Processing flow</title>
<para>
- This connctor executes &Requests; against the federated repository by
+ This connector executes &Request;s against the federated repository by
projecting them into requests against the underlying sources that are being federated.
</para>
<para>
14 years, 5 months
DNA SVN: r1408 - in trunk: docs/reference/src/main/docbook/en-US and 4 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-05 18:21:03 -0500 (Sat, 05 Dec 2009)
New Revision: 1408
Modified:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml
trunk/docs/reference/src/main/docbook/en-US/custom.dtd
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java
Log:
DNA-577
Applied patch that changes the default setting in JpaSource and updates the reference guide. I changed the sub-sections to be of style <sect1> instead of <sect2> to be compliant with the DTD for the enclosing <chapter> tag. This cleans up an error in the Eclipse Docbook editor.
The patch also re-adds a test that was overridden a few months ago when DNA-466 was still open and cleans up some of the existing connector-level tests for the simple model.
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-12-05 02:53:36 UTC (rev 1407)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java 2009-12-05 23:21:03 UTC (rev 1408)
@@ -370,7 +370,7 @@
*
* @throws Exception if an error occurs
*/
- public void failsFromDna466TestShouldNotCloneIfItWouldViolateTypeSemantics() throws Exception {
+ public void testShouldNotCloneIfItWouldViolateTypeSemantics() throws Exception {
session = helper.getSuperuserSession("otherWorkspace");
assertThat(session.getWorkspace().getName(), is("otherWorkspace"));
@@ -432,5 +432,4 @@
}
}
-
}
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml 2009-12-05 02:53:36 UTC (rev 1407)
+++ trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml 2009-12-05 23:21:03 UTC (rev 1408)
@@ -56,9 +56,9 @@
<entry>The name of the repository source, which is used by the &RepositoryService; when obtaining a &RepositoryConnection; by name.</entry>
</row>
<row>
- <entry>supportsUpdates</entry>
+ <entry>supportsUpdates (Basic Model Only)</entry>
<entry>Determines whether the content in the database is can be updated ("true"), or if the content may only be read ("false").
- The default value is "true".</entry>
+ The default value is "true". This property is ignored by the Simple Model (q.v., the model property below)</entry>
</row>
<row>
<entry>rootNodeUuid</entry>
@@ -104,7 +104,7 @@
<row>
<entry>driverClassloaderName</entry>
<entry>
- The name of the <link linkend="class_loader_factory">class loader or classpath</link> that should be used to load the JDBC driver class.
+ The name of the <!-- link linkend="class_loader_factory" -->class loader or classpath<!-- /link --> that should be used to load the JDBC driver class.
This is not required if the DataSource is found in JNDI.
</entry>
</row>
@@ -173,11 +173,12 @@
</entry>
</row>
<row>
- <entry>referentialIntegrityEnforced</entry>
+ <entry>referentialIntegrityEnforced (Basic Model Only)</entry>
<entry>
An advanced boolean property that dictates whether the database's referential integrity should be enabled, or false if this checking
is not to be used. While referential integrity does help to ensure the consistency of the records, it does add work to update
- operations and can impact performance.
+ operations and can impact performance. The Simple Model (q.v., the "model" property below) ignores this property and does not support
+ this feature.
The default value is "true".
</entry>
</row>
@@ -202,8 +203,13 @@
<row>
<entry>model</entry>
<entry>
- An advanced property that dictates the type of storage schema that is used. Currently, the only supported value is "Basic",
- which is also the default.
+ An advanced property that dictates the type of storage schema that is used. Currently, the only supported values are "Basic" and "Simple".
+ The Basic model supports a read-only mode (q.v., the "supportsUpdates" property) and database-level
+ enforcement of referential integrity (q.v., the "referentialIntegrityEnforced" property above), but does not fully support all JCR functions.
+ As a result, the Simple model is now the default model, but DNA repositories that were created under the Basic model will continue to use
+ the "Basic" model regardless of the value of this property. Repositories can be converted from the Basic model to the Simple model by exporting
+ them to an XML file as a system view through the JCR interface and then importing them into a new repository created with the model property set
+ to "Simple".
</entry>
</row>
<row>
@@ -278,11 +284,11 @@
<para>
Running this executable will create two files in the output directory (or the current directory if no output directory
was specified): create.dna-jpa-connector.ddl and drop.dna-jpa-connector.ddl. The former contains the DDL to create or replace the tables,
- foreign keys, indices, and sequences needed by the JPA connector and the latter containts the DDL to drop any tables, foreign keys, indices, and
+ foreign keys, indices, and sequences needed by the JPA connector and the latter contains the DDL to drop any tables, foreign keys, indices, and
sequences needed by the JPA connector.
</para>
- <sect2>
+ <sect1>
<title>Basic Model</title>
<para>
This database schema model stores node properties as opaque records and children as transparent records.
@@ -293,6 +299,11 @@
<itemizedlist>
<listitem>
<para>
+ Workspaces - the set of workspaces and their names.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
Namespaces - the set of namespace URIs used in paths, property names, and property values.
</para>
</listitem>
@@ -326,13 +337,6 @@
Subgraph - a working area for efficiently computing the space of a subgraph; see below
</para>
</listitem>
- <!--listitem>
- <para>
- Change log - a record of the changes that have been made to the repository. This is used to distribute change events across
- multiple distributed processes, and to allow a recently-connected client to identify the set of changes that have been made
- since a particular time or date. Changes are serialized into a binary, compressed format.
- </para>
- </listitem-->
<listitem>
<para>
Options - the parameters for this store's configuration (common to all models)
@@ -350,7 +354,7 @@
nodes. When finished, the mechanism deletes the records in the working area associated with the subgraph query.
</para>
<para>
- This subgraph query mechanism is extremely efficient, performing one join/insert statement <i>per level of the subgraph</i>,
+ This subgraph query mechanism is extremely efficient, performing one join/insert statement <emphasis>per level of the subgraph</emphasis>,
and is completely independent of the number of nodes in the subgraph. For example, consider a subgraph of node A, where A has
10 children, and each child contains 10 children, and each grandchild contains 10 children. This subgraph has a total of 1111
nodes (1 root + 10 children + 10*10 grandchildren + 10*10*10 great-grandchildren). Finding the nodes in this subgraph would
@@ -367,6 +371,64 @@
requests requires knowledge of the subgraph, and in fact all but the &ReadBranchRequest; need to know the complete
subgraph.
</para>
- </sect2>
+ </sect1>
+ <sect1>
+ <title>Simple Model</title>
+ <para>
+ This database schema model stores node properties as opaque records in the same row as transparent values like the node's namespace, local name,
+ and same-name-sibling index. Large property values are stored separately. It is a small evolution of the design from the Basic model.
+ </para>
+ <para>
+ The set of tables used in this model includes:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Workspaces - the set of workspaces and their names.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Namespaces - the set of namespace URIs used in paths, property names, and property values.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Nodes - the nodes in the repository, where each node and its properties are represented by a single record. This approach makes it
+ possible to efficiently work with nodes containing large numbers of children, where adding and removing child nodes is largely
+ independent of the number of children. Since the primary consumer of DNA graph information is the JCR layer, and the JCR layer always
+ retrieves the nodes' properties for retrieved nodes, the properties have been moved in-row with the nodes. Properties are still store
+ in an opaque, serialized (and optionally compressed) form.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Large values - property values larger than a certain size will be broken out into this table, where they are tracked by
+ their SHA-1 has and shared by all properties that have that same value. The values are stored in a binary (and optionally
+ compressed) form. This is equivalent to the Basic model's approach for storing large values.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Subgraph - a working area for efficiently computing the space of a subgraph; see below
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Options - the parameters for this store's configuration (common to all models)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ Just like the Basic model, this model contains two tables that are used in an efficient mechanism to find all of the nodes in the subgraph below
+ a certain node. The subgraph tables work so similarly in the Simple model that the description from the Basic model still applies.
+ </para>
+ <para>
+ In the Simple model, subgraph queries are used to efficiently process a number of different requests, including &ReadBranchRequest;
+ and &DeleteBranchRequest;. Processing each of these kinds of
+ requests requires knowledge of the subgraph, and in fact all but the &ReadBranchRequest; need to know the complete
+ subgraph.
+ </para>
+ </sect1>
</chapter>
Modified: trunk/docs/reference/src/main/docbook/en-US/custom.dtd
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-05 02:53:36 UTC (rev 1407)
+++ trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-05 23:21:03 UTC (rev 1408)
@@ -60,6 +60,7 @@
<!ENTITY BigDecimal "<ulink url='&Java;java/math/BigDecimal.html'><classname>BigDecimal</classname></ulink>">
<!ENTITY Calendar "<ulink url='&Java;java/util/Calendar.html'><classname>Calendar</classname></ulink>">
<!ENTITY Date "<ulink url='&Java;java/util/Date.html'><classname>Date</classname></ulink>">
+<!ENTITY EntityManagerFactory "<ulink url='&Java;javax/persistence/EntityManagerFactory.html'><classname>EntityManagerFactory</classname></ulink>">
<!-- Types in JCR API -->
@@ -139,6 +140,8 @@
<!ENTITY RemovePropertyRequest "<ulink url='&API;graph/request/RemovePropertyRequest.html'><classname>RemovePropertyRequest</classname></ulink>">
<!ENTITY CreateNodeRequest "<ulink url='&API;graph/request/CreateNodeRequest.html'><classname>CreateNodeRequest</classname></ulink>">
<!ENTITY CopyBranchRequest "<ulink url='&API;graph/request/CopyBranchRequest.html'><classname>CopyBranchRequest</classname></ulink>">
+<!ENTITY ReadBranchRequest "<ulink url='&API;graph/request/ReadBranchRequest.html'><classname>ReadBranchRequest</classname></ulink>">
+<!ENTITY MoveBranchRequest "<ulink url='&API;graph/request/MoveBranchRequest.html'><classname>MoveBranchRequest</classname></ulink>">
<!ENTITY DeleteBranchRequest "<ulink url='&API;graph/request/DeleteBranchRequest.html'><classname>DeleteBranchRequest</classname></ulink>">
<!ENTITY InvalidRequestException "<ulink url='&API;graph/request/InvalidRequestException.html'><classname>InvalidRequestException</classname></ulink>">
<!ENTITY InvalidWorkspaceException "<ulink url='&API;graph/request/InvalidWorkspaceException.html'><classname>InvalidWorkspaceException</classname></ulink>">
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-12-05 02:53:36 UTC (rev 1407)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-12-05 23:21:03 UTC (rev 1408)
@@ -79,7 +79,7 @@
private static final Model[] ALL_ARRAY = new Model[] {BASIC, SIMPLE};
private static final List<Model> MODIFIABLE_MODELS = new ArrayList<Model>(Arrays.asList(ALL_ARRAY));
public static final Collection<Model> ALL = Collections.unmodifiableCollection(MODIFIABLE_MODELS);
- public static final Model DEFAULT = BASIC;
+ public static final Model DEFAULT = SIMPLE;
public static boolean addModel( Model model ) {
CheckArg.isNotNull(model, "modelName");
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java 2009-12-05 02:53:36 UTC (rev 1407)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java 2009-12-05 23:21:03 UTC (rev 1408)
@@ -42,6 +42,7 @@
// Set the connection properties to be an in-memory HSQL database ...
JpaSource source = new JpaSource();
source.setName(sourceName);
+ source.setModel(JpaSource.Models.BASIC.getName());
source.setDialect(properties.getProperty("jpaSource.dialect"));
source.setDriverClassName(properties.getProperty("jpaSource.driverClassName"));
source.setUsername(properties.getProperty("jpaSource.username"));
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java 2009-12-05 02:53:36 UTC (rev 1407)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java 2009-12-05 23:21:03 UTC (rev 1408)
@@ -25,14 +25,10 @@
import org.jboss.dna.common.statistic.Stopwatch;
import org.jboss.dna.connector.store.jpa.JpaSource;
-import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.connector.store.jpa.TestEnvironment;
import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.Subgraph;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.RepositorySource;
import org.jboss.dna.graph.connector.test.ReadableConnectorTest;
-import org.jboss.dna.graph.observe.Observer;
public class SimpleJpaConnectorReadableTest extends ReadableConnectorTest {
@@ -44,40 +40,12 @@
@Override
protected RepositorySource setUpSource() {
// Set the connection properties using the environment defined in the POM files ...
- JpaSource source = new JpaSource();
-
+ JpaSource source = TestEnvironment.configureJpaSource("Test Repository", this);
source.setModel(JpaSource.Models.SIMPLE.getName());
- source.setName("SimpleJpaSource");
- source.setDialect("org.hibernate.dialect.HSQLDialect");
- source.setDriverClassName("org.hsqldb.jdbcDriver");
- source.setUsername("sa");
- source.setPassword("");
- source.setUrl("jdbc:hsqldb:mem:test");
- source.setShowSql(false);
- source.setAutoGenerateSchema("create");
- source.initialize(new RepositoryContext() {
+ // Override the inherited properties ...
+ source.setCompressData(true);
- private final ExecutionContext context = new ExecutionContext();
-
- public Subgraph getConfiguration( int depth ) {
- return null;
- }
-
- public ExecutionContext getExecutionContext() {
- return context;
- }
-
- public Observer getObserver() {
- return null;
- }
-
- public RepositoryConnectionFactory getRepositoryConnectionFactory() {
- return null;
- }
-
- });
-
return source;
}
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java 2009-12-05 02:53:36 UTC (rev 1407)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java 2009-12-05 23:21:03 UTC (rev 1408)
@@ -24,14 +24,10 @@
package org.jboss.dna.connector.store.jpa.model.simple;
import org.jboss.dna.connector.store.jpa.JpaSource;
-import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.connector.store.jpa.TestEnvironment;
import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.Subgraph;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.RepositorySource;
import org.jboss.dna.graph.connector.test.WritableConnectorTest;
-import org.jboss.dna.graph.observe.Observer;
public class SimpleJpaConnectorWritableTest extends WritableConnectorTest {
@@ -43,41 +39,12 @@
@Override
protected RepositorySource setUpSource() {
// Set the connection properties using the environment defined in the POM files ...
- JpaSource source = new JpaSource();
-
+ JpaSource source = TestEnvironment.configureJpaSource("Test Repository", this);
source.setModel(JpaSource.Models.SIMPLE.getName());
- source.setName("SimpleJpaSource");
- source.setDialect("org.hibernate.dialect.HSQLDialect");
- source.setDriverClassName("org.hsqldb.jdbcDriver");
- source.setUsername("sa");
- source.setPassword("");
- source.setUrl("jdbc:hsqldb:mem:test");
- source.setShowSql(false);
- source.setAutoGenerateSchema("create");
- source.setReferentialIntegrityEnforced(false);
- source.initialize(new RepositoryContext() {
+ // Override the inherited properties ...
+ source.setCompressData(true);
- private final ExecutionContext context = new ExecutionContext();
-
- public Subgraph getConfiguration( int depth ) {
- return null;
- }
-
- public ExecutionContext getExecutionContext() {
- return context;
- }
-
- public Observer getObserver() {
- return null;
- }
-
- public RepositoryConnectionFactory getRepositoryConnectionFactory() {
- return null;
- }
-
- });
-
return source;
}
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java 2009-12-05 02:53:36 UTC (rev 1407)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java 2009-12-05 23:21:03 UTC (rev 1408)
@@ -49,7 +49,7 @@
source.setDriverClassName("org.hsqldb.jdbcDriver");
source.setUsername("sa");
source.setPassword("");
- source.setUrl("jdbc:hsqldb:.");
+ source.setUrl("jdbc:hsqldb:mem:.");
source.setShowSql(true);
source.setAutoGenerateSchema("create");
14 years, 5 months
DNA SVN: r1407 - in trunk: dna-graph/src/main/java/org/jboss/dna/graph/request/processor and 7 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-04 21:53:36 -0500 (Fri, 04 Dec 2009)
New Revision: 1407
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/SimpleJpaRepositoryTckTest.java
trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/
trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/configRepository.xml
trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/repositoryOverlay.properties
Removed:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceId.java
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java
trunk/dna-integration-tests/src/test/resources/log4j.properties
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnection.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaRepository.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleRequestProcessor.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SubgraphQuery.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/package-info.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicCreateWorkspacesTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicNoCreateWorkspaceTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/NodeEntityTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleCreateWorkspacesTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleNoCreateWorkspaceTest.java
Log:
DNA-546 JCR Workspace and Session Imports Can Fail on JPA Connector
Applied patch that cleans up the simple JPA model by fixing the last broken test, removing semi-implemented referential integrity checks, adding copyright headers to a number of files, and adding a full TCK integration test.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -446,7 +446,48 @@
MapNode newParent,
Name desiredName,
boolean recursive ) {
- return copyNode(context, original, newWorkspace, newParent, desiredName, true, new HashMap<UUID, UUID>());
+
+ Map<UUID, UUID> oldToNewUuids = new HashMap<UUID, UUID>();
+ MapNode copyRoot = copyNode(context, original, newWorkspace, newParent, desiredName, true, oldToNewUuids);
+
+ // Now, adjust any references in the new subgraph to objects in the original subgraph
+ // (because they were internal references, and need to be internal to the new subgraph)
+ PropertyFactory propertyFactory = context.getPropertyFactory();
+ UuidFactory uuidFactory = context.getValueFactories().getUuidFactory();
+ ValueFactory<Reference> referenceFactory = context.getValueFactories().getReferenceFactory();
+ for (Map.Entry<UUID, UUID> oldToNew : oldToNewUuids.entrySet()) {
+ MapNode oldNode = this.getNode(oldToNew.getKey());
+ MapNode newNode = newWorkspace.getNode(oldToNew.getValue());
+ assert oldNode != null;
+ assert newNode != null;
+ // Iterate over the properties of the new ...
+ for (Map.Entry<Name, Property> entry : newNode.getProperties().entrySet()) {
+ Property property = entry.getValue();
+ // Now see if any of the property values are references ...
+ List<Object> newValues = new ArrayList<Object>();
+ boolean foundReference = false;
+ for (Iterator<?> iter = property.getValues(); iter.hasNext();) {
+ Object value = iter.next();
+ PropertyType type = PropertyType.discoverType(value);
+ if (type == PropertyType.REFERENCE) {
+ UUID oldReferencedUuid = uuidFactory.create(value);
+ UUID newReferencedUuid = oldToNewUuids.get(oldReferencedUuid);
+ if (newReferencedUuid != null) {
+ newValues.add(referenceFactory.create(newReferencedUuid));
+ foundReference = true;
+ }
+ } else {
+ newValues.add(value);
+ }
+ }
+ // If we found at least one reference, we have to build a new Property object ...
+ if (foundReference) {
+ Property newProperty = propertyFactory.create(property.getName(), newValues);
+ entry.setValue(newProperty);
+ }
+ }
+ }
+ return copyRoot;
}
/**
@@ -494,47 +535,6 @@
}
}
- if (!reuseUuids) {
- assert oldToNewUuids != null;
- // Now, adjust any references in the new subgraph to objects in the original subgraph
- // (because they were internal references, and need to be internal to the new subgraph)
- PropertyFactory propertyFactory = context.getPropertyFactory();
- UuidFactory uuidFactory = context.getValueFactories().getUuidFactory();
- ValueFactory<Reference> referenceFactory = context.getValueFactories().getReferenceFactory();
- for (Map.Entry<UUID, UUID> oldToNew : oldToNewUuids.entrySet()) {
- MapNode oldNode = this.getNode(oldToNew.getKey());
- MapNode newNode = newWorkspace.getNode(oldToNew.getValue());
- assert oldNode != null;
- assert newNode != null;
- // Iterate over the properties of the new ...
- for (Map.Entry<Name, Property> entry : newNode.getProperties().entrySet()) {
- Property property = entry.getValue();
- // Now see if any of the property values are references ...
- List<Object> newValues = new ArrayList<Object>();
- boolean foundReference = false;
- for (Iterator<?> iter = property.getValues(); iter.hasNext();) {
- Object value = iter.next();
- PropertyType type = PropertyType.discoverType(value);
- if (type == PropertyType.REFERENCE) {
- UUID oldReferencedUuid = uuidFactory.create(value);
- UUID newReferencedUuid = oldToNewUuids.get(oldReferencedUuid);
- if (newReferencedUuid != null) {
- newValues.add(referenceFactory.create(newReferencedUuid));
- foundReference = true;
- }
- } else {
- newValues.add(value);
- }
- }
- // If we found at least one reference, we have to build a new Property object ...
- if (foundReference) {
- Property newProperty = propertyFactory.create(property.getName(), newValues);
- entry.setValue(newProperty);
- }
- }
- }
- }
-
return copy;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -92,7 +92,7 @@
public void process( VerifyWorkspaceRequest request ) {
logger.log(level, GraphI18n.executingRequest, request);
delegate.process(request);
- logger.log(level, GraphI18n.executedRequest, request);
+ // logger.log(level, GraphI18n.executedRequest, request);
}
/**
@@ -452,7 +452,7 @@
public void close() {
logger.log(level, GraphI18n.closingRequestProcessor);
delegate.close();
- logger.log(level, GraphI18n.closingRequestProcessor);
+ logger.log(level, GraphI18n.closedRequestProcessor);
}
}
Added: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/SimpleJpaRepositoryTckTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/SimpleJpaRepositoryTckTest.java (rev 0)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/SimpleJpaRepositoryTckTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+public class SimpleJpaRepositoryTckTest {
+ public static Test suite() {
+ return AbstractRepositoryTckTest.readWriteRepositorySuite("simple-jpa");
+ }
+}
Property changes on: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/SimpleJpaRepositoryTckTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/dna-integration-tests/src/test/resources/log4j.properties
===================================================================
--- trunk/dna-integration-tests/src/test/resources/log4j.properties 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/dna-integration-tests/src/test/resources/log4j.properties 2009-12-05 02:53:36 UTC (rev 1407)
@@ -4,17 +4,37 @@
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+# Direct log messages to a file
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=/tck.log
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} [%t] %m%n
+#log4j.appender.file.layout.ConversionPattern=%5p [%c{1}] %m%n
+
# Root logger option
-log4j.rootLogger=INFO, stdout
+log4j.rootLogger=WARN, file
# Set up the default logging to be INFO level, then override specific units
-log4j.logger.org.jboss.dna=INFO
+log4j.logger.org.jboss.dna=WARN
log4j.logger.org.junit=DEBUG
# log4j.logger.org.jboss.dna.tests.integration.jackrabbit.JackrabbitMySqlStressTest=DEBUG
-log4j.logger.org.hibernate=WARN, stdout
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.pretty.Printer=WARN
+log4j.logger.org.hibernate.engine.Collections=WARN
+log4j.logger.org.hibernate.cfg=WARN
+log4j.logger.org.hibernate.tool.hbm2ddl.SchemaExport=WARN
+log4j.logger.org.hibernate.persister.entity.AbstractEntityPersister=WARN
+log4j.logger.org.hibernate.event.def.AbstractFlushingEventListener=WARN
+log4j.logger.org.hibernate.engine.TwoPhaseLoad=WARN
+log4j.logger.org.hibernate.jdbc.AbstractBatcher=WARN
+log4j.logger.org.hibernate.hql.ast=WARN
+log4j.logger.org.hibernate.engine.loading.CollectionLoadContext=WARN
# Jackrabbit logging
log4j.logger.org.apache.jackrabbit=WARN, stdout
log4j.logger.org.apache.derby=INFO, stdout
+
+log4j.logger.org.jboss.dna.connector.store=DEBUG
Added: trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/configRepository.xml
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/configRepository.xml (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/configRepository.xml 2009-12-05 02:53:36 UTC (rev 1407)
@@ -0,0 +1,96 @@
+<?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.store.jpa.JpaSource"
+ dna:dialect="org.hibernate.dialect.HSQLDialect"
+ dna:model="Simple"
+ dna:driverClassName="org.hsqldb.jdbcDriver"
+ dna:username="sa"
+ dna:password=""
+ dna:url="jdbc:hsqldb:mem:."
+ dna:predefinedWorkspaceNames="otherWorkspace"
+ dna:showSql="false"
+ dna:autoGenerateSchema="create"
+ dna:maximumConnectionsInPool="5"
+ 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/simple-jpa/configRepository.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Added: trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/repositoryOverlay.properties
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/repositoryOverlay.properties (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/simple-jpa/repositoryOverlay.properties 2009-12-05 02:53:36 UTC (rev 1407)
@@ -0,0 +1 @@
+# Placeholder for any overlaid properties for this repo configuration
Deleted: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceEntity.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceEntity.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceEntity.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,211 +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.connector.store.jpa.model.simple;
-
-import java.util.Collection;
-import java.util.List;
-import javax.persistence.Entity;
-import javax.persistence.EntityManager;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import javax.persistence.Table;
-import org.hibernate.annotations.Index;
-
-/**
- * A record of a reference from one node to another.
- */
-@Entity
-@Table( name = "DNA_SIMPLE_REFERENCES" )
-(a)org.hibernate.annotations.Table( appliesTo = "DNA_SIMPLE_REFERENCES", indexes = {
- @Index( name = "REFINDEX_INX", columnNames = {"WORKSPACE_ID", "FROM_UUID", "TO_UUID"} ),
- @Index( name = "REFTOUUID_INX", columnNames = {"WORKSPACE_ID", "TO_UUID"} )} )
-@NamedQueries( {
- @NamedQuery( name = "ReferenceEntity.removeReferencesFrom", query = "delete ReferenceEntity where id.workspaceId = :workspaceId and id.fromUuidString = :fromUuid" ),
- @NamedQuery( name = "ReferenceEntity.removeNonEnforcedReferences", query = "delete ReferenceEntity as ref where ref.id.workspaceId = :workspaceId and ref.id.fromUuidString not in ( select props.id.uuidString from PropertiesEntity props where props.referentialIntegrityEnforced = true and props.id.workspaceId = :workspaceId )" ),
- @NamedQuery( name = "ReferenceEntity.countUnresolveReferences", query = "select count(*) from ReferenceEntity as ref where ref.id.workspaceId = :workspaceId and ref.id.toUuidString not in ( select props.id.uuidString from PropertiesEntity props where props.referentialIntegrityEnforced = true and props.id.workspaceId = :workspaceId )" ),
- @NamedQuery( name = "ReferenceEntity.getUnresolveReferences", query = "select ref from ReferenceEntity as ref where ref.id.workspaceId = :workspaceId and ref.id.toUuidString not in ( select props.id.uuidString from PropertiesEntity props where props.referentialIntegrityEnforced = true and props.id.workspaceId = :workspaceId )" ),
- @NamedQuery( name = "ReferenceEntity.findInWorkspace", query = "select ref from ReferenceEntity as ref where ref.id.workspaceId = :workspaceId" ),
- @NamedQuery( name = "ReferenceEntity.getInwardReferencesForList", query = "select ref from ReferenceEntity as ref where ref.id.workspaceId = :workspaceId and ref.id.toUuidString in (:toUuidList)" )} )
-public class ReferenceEntity {
-
- @Id
- private ReferenceId id;
-
- /**
- *
- */
- public ReferenceEntity() {
- }
-
- /**
- * @param id the id
- */
- public ReferenceEntity( ReferenceId id ) {
- this.id = id;
- }
-
- /**
- * @return id
- */
- public ReferenceId getId() {
- return id;
- }
-
- /**
- * @param id Sets id to the specified value.
- */
- public void setId( ReferenceId id ) {
- this.id = id;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof ReferenceEntity) {
- ReferenceEntity that = (ReferenceEntity)obj;
- if (this.getId().equals(that.getId())) return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return this.id.toString();
- }
-
- /**
- * Delete all references that start from the node with the supplied UUID.
- *
- * @param workspaceId the ID of the workspace; may not be null
- * @param uuid the UUID of the node from which the references start
- * @param manager the manager; may not be null
- * @return the number of deleted references
- */
- public static int deleteReferencesFrom( Long workspaceId,
- String uuid,
- EntityManager manager ) {
- assert manager != null;
- Query delete = manager.createNamedQuery("ReferenceEntity.removeReferencesFrom");
- delete.setParameter("fromUuid", uuid);
- delete.setParameter("workspaceId", workspaceId);
- int result = delete.executeUpdate();
- manager.flush();
- return result;
- }
-
- /**
- * Delete all references (in all workspaces) that start from nodes that do not require enforced referential integrity.
- *
- * @param workspaceId the ID of the workspace; may not be null
- * @param manager the manager; may not be null
- * @return the number of deleted references
- */
- public static int deleteUnenforcedReferences( Long workspaceId,
- EntityManager manager ) {
- assert manager != null;
- Query delete = manager.createNamedQuery("ReferenceEntity.removeNonEnforcedReferences");
- delete.setParameter("workspaceId", workspaceId);
- int result = delete.executeUpdate();
- manager.flush();
- return result;
- }
-
- /**
- * Delete all references that start from nodes that do not support enforced referential integrity.
- *
- * @param workspaceId the ID of the workspace; may not be null
- * @param manager the manager; may not be null
- * @return the number of deleted references
- */
- public static int countAllReferencesResolved( Long workspaceId,
- EntityManager manager ) {
- assert manager != null;
- Query query = manager.createNamedQuery("ReferenceEntity.getUnresolveReferences");
- query.setParameter("workspaceId", workspaceId);
- try {
- return (Integer)query.getSingleResult();
- } catch (NoResultException e) {
- return 0;
- }
- }
-
- /**
- * Delete all references that start from nodes that do not support enforced referential integrity.
- *
- * @param workspaceId the ID of the workspace; may not be null
- * @param manager the manager; may not be null
- * @return the number of deleted references
- */
- @SuppressWarnings( "unchecked" )
- public static List<ReferenceEntity> verifyAllReferencesResolved( Long workspaceId,
- EntityManager manager ) {
- assert manager != null;
- Query query = manager.createNamedQuery("ReferenceEntity.getUnresolveReferences");
- query.setParameter("workspaceId", workspaceId);
- return query.getResultList();
- }
-
- /**
- * Returns a list of all references to UUIDs in the given list within the given workspace
- *
- * @param workspaceId the ID of the workspace; may not be null
- * @param uuids the UUIDs (as strings) of the nodes to check; may not be null
- * @param manager the manager; may not be null
- * @return the number of deleted references
- */
- @SuppressWarnings( "unchecked" )
- public static List<ReferenceEntity> getReferencesToUuids( Long workspaceId,
- Collection<String> uuids,
- EntityManager manager ) {
- assert manager != null;
-
- Query query = manager.createNamedQuery("ReferenceEntity.getInwardReferencesForList");
- query.setParameter("workspaceId", workspaceId);
- query.setParameter("toUuidList", uuids);
- return query.getResultList();
- }
-}
Deleted: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceId.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceId.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/ReferenceId.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,137 +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.connector.store.jpa.model.simple;
-
-import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.HashCode;
-
-/**
- * An identifier for a reference, comprised of a workspace ID, a single UUID (in string form) of the node containing the
- * reference, and a single UUID (in string form) of the node being referenced.
- */
-@Embeddable
-@Immutable
-(a)org.hibernate.annotations.Immutable
-public class ReferenceId implements Serializable {
-
- /**
- * Version {@value}
- */
- private static final long serialVersionUID = 1L;
-
- @Column( name = "WORKSPACE_ID", nullable = false )
- private Long workspaceId;
-
- @Column( name = "FROM_UUID", nullable = false, updatable = false, length = 36 )
- private String fromUuidString;
-
- @Column( name = "TO_UUID", nullable = false, updatable = false, length = 36 )
- private String toUuidString;
-
- public ReferenceId() {
- }
-
- public ReferenceId( Long workspaceId,
- String fromUuid,
- String toUuid ) {
- this.workspaceId = workspaceId;
- this.fromUuidString = fromUuid;
- this.toUuidString = toUuid;
- }
-
- /**
- * @return fromUuidString
- */
- public String getFromUuidString() {
- return fromUuidString;
- }
-
- /**
- * @return toUuidString
- */
- public String getToUuidString() {
- return toUuidString;
- }
-
- /**
- * @return workspaceId
- */
- public Long getWorkspaceId() {
- return workspaceId;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return HashCode.compute(fromUuidString, toUuidString);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof ReferenceId) {
- ReferenceId that = (ReferenceId)obj;
- if (this.workspaceId == null) {
- if (that.workspaceId != null) return false;
- } else {
- if (!this.workspaceId.equals(that.workspaceId)) return false;
- }
- if (this.fromUuidString == null) {
- if (that.fromUuidString != null) return false;
- } else {
- if (!this.fromUuidString.equals(that.fromUuidString)) return false;
- }
- if (this.toUuidString == null) {
- if (that.toUuidString != null) return false;
- } else {
- if (!this.toUuidString.equals(that.toUuidString)) return false;
- }
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "Reference from " + fromUuidString + " to " + toUuidString + " in workspace " + workspaceId;
- }
-
-}
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnection.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnection.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnection.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -56,8 +56,7 @@
this.repository = new SimpleJpaRepository(source.getName(), source.getRootUuid(), source.getDefaultWorkspaceName(),
source.getPredefinedWorkspaceNames(), entityManager,
source.getRepositoryContext().getExecutionContext(), source.isCompressData(),
- source.isCreatingWorkspacesAllowed(), source.isReferentialIntegrityEnforced(),
- source.getLargeValueSizeInBytes());
+ source.isCreatingWorkspacesAllowed(), source.getLargeValueSizeInBytes());
}
public boolean ping( long time,
@@ -114,7 +113,7 @@
if (logger.isTraceEnabled()) {
assert sw != null;
sw.stop();
- logger.trace("MapRepositoryConnection.execute(...) took " + sw.getTotalDuration());
+ logger.trace(this.getClass().getSimpleName() + ".execute(...) took " + sw.getTotalDuration());
}
}
}
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaRepository.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaRepository.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaRepository.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -36,6 +36,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -71,7 +72,10 @@
import org.jboss.dna.graph.property.Property;
import org.jboss.dna.graph.property.PropertyFactory;
import org.jboss.dna.graph.property.PropertyType;
+import org.jboss.dna.graph.property.Reference;
+import org.jboss.dna.graph.property.UuidFactory;
import org.jboss.dna.graph.property.ValueFactories;
+import org.jboss.dna.graph.property.ValueFactory;
import org.jboss.dna.graph.property.Path.Segment;
import org.jboss.dna.graph.request.CompositeRequest;
import org.jboss.dna.graph.request.LockBranchRequest.LockScope;
@@ -101,8 +105,6 @@
protected final boolean creatingWorkspacesAllowed;
protected final long minimumSizeOfLargeValuesInBytes;
- // private final boolean referentialIntegrityEnforced;
-
public SimpleJpaRepository( String sourceName,
UUID rootNodeUuid,
String defaultWorkspaceName,
@@ -111,7 +113,6 @@
ExecutionContext context,
boolean compressData,
boolean creatingWorkspacesAllowed,
- boolean referentialIntegrityEnforced,
long minimumSizeOfLargeValuesInBytes ) {
super(sourceName, rootNodeUuid, defaultWorkspaceName);
@@ -122,7 +123,6 @@
this.predefinedWorkspaceNames = Arrays.asList(predefinedWorkspaceNames);
this.compressData = compressData;
this.creatingWorkspacesAllowed = creatingWorkspacesAllowed;
- // this.referentialIntegrityEnforced = referentialIntegrityEnforced;
this.minimumSizeOfLargeValuesInBytes = minimumSizeOfLargeValuesInBytes;
this.entityManager = entityManager;
@@ -137,7 +137,6 @@
ExecutionContext context,
boolean compressData,
boolean creatingWorkspacesAllowed,
- boolean referentialIntegrityEnforced,
long minimumSizeOfLargeValuesInBytes ) {
super(sourceName, rootNodeUuid);
@@ -148,7 +147,6 @@
this.predefinedWorkspaceNames = Collections.emptyList();
this.compressData = compressData;
this.creatingWorkspacesAllowed = creatingWorkspacesAllowed;
- // this.referentialIntegrityEnforced = referentialIntegrityEnforced;
this.minimumSizeOfLargeValuesInBytes = minimumSizeOfLargeValuesInBytes;
this.entityManager = entityManager;
@@ -259,6 +257,76 @@
initialize();
}
+ /**
+ * This should copy the subgraph given by the original node and place the new copy under the supplied new parent. Note
+ * that internal references between nodes within the original subgraph must be reflected as internal nodes within the new
+ * subgraph.
+ *
+ * @param context the context; may not be null
+ * @param original the node to be copied; may not be null
+ * @param newWorkspace the workspace containing the new parent node; may not be null
+ * @param newParent the parent where the copy is to be placed; may not be null
+ * @param desiredName the desired name for the node; if null, the name will be obtained from the original node
+ * @param recursive true if the copy should be recursive
+ * @return the new node, which is the top of the new subgraph
+ */
+ @Override
+ public MapNode copyNode( ExecutionContext context,
+ MapNode original,
+ MapWorkspace newWorkspace,
+ MapNode newParent,
+ Name desiredName,
+ boolean recursive ) {
+
+ Map<UUID, UUID> oldToNewUuids = new HashMap<UUID, UUID>();
+ MapNode copyRoot = copyNode(context, original, newWorkspace, newParent, desiredName, true, oldToNewUuids);
+
+ // Now, adjust any references in the new subgraph to objects in the original subgraph
+ // (because they were internal references, and need to be internal to the new subgraph)
+ PropertyFactory propertyFactory = context.getPropertyFactory();
+ UuidFactory uuidFactory = context.getValueFactories().getUuidFactory();
+ ValueFactory<Reference> referenceFactory = context.getValueFactories().getReferenceFactory();
+ boolean refChanged = false;
+ for (Map.Entry<UUID, UUID> oldToNew : oldToNewUuids.entrySet()) {
+ MapNode oldNode = this.getNode(oldToNew.getKey());
+ MapNode newNode = newWorkspace.getNode(oldToNew.getValue());
+ assert oldNode != null;
+ assert newNode != null;
+ // Iterate over the properties of the new ...
+ for (Map.Entry<Name, Property> entry : newNode.getProperties().entrySet()) {
+ Property property = entry.getValue();
+ // Now see if any of the property values are references ...
+ List<Object> newValues = new ArrayList<Object>();
+ boolean foundReference = false;
+ for (Iterator<?> iter = property.getValues(); iter.hasNext();) {
+ Object value = iter.next();
+ PropertyType type = PropertyType.discoverType(value);
+ if (type == PropertyType.REFERENCE) {
+ UUID oldReferencedUuid = uuidFactory.create(value);
+ UUID newReferencedUuid = oldToNewUuids.get(oldReferencedUuid);
+ if (newReferencedUuid != null) {
+ newValues.add(referenceFactory.create(newReferencedUuid));
+ foundReference = true;
+ refChanged = true;
+ }
+ } else {
+ newValues.add(value);
+ }
+ }
+ // If we found at least one reference, we have to build a new Property object ...
+ if (foundReference) {
+ Property newProperty = propertyFactory.create(property.getName(), newValues);
+ entry.setValue(newProperty);
+ }
+ }
+
+ if (refChanged) {
+ ((JpaNode)newNode).serializeProperties();
+ }
+ }
+ return copyRoot;
+ }
+
/*
* (non-Javadoc)
* @see org.jboss.dna.graph.connector.map.AbstractMapWorkspace#correctSameNameSiblingIndexes(org.jboss.dna.graph.ExecutionContext, org.jboss.dna.graph.connector.map.MapNode, org.jboss.dna.graph.property.Name)
@@ -303,6 +371,7 @@
NodeEntity nodeEntity = ((JpaNode)node).entity;
nodeEntity.setWorkspaceId(this.workspaceId);
+ nodeEntity.setReferentialIntegrityEnforced(false);
entityManager.persist(nodeEntity);
}
@@ -320,7 +389,7 @@
*/
@Override
protected void removeUuidReference( MapNode node ) {
- SubgraphQuery branch = SubgraphQuery.create(context, entityManager, workspaceId, node.getUuid(), null, 0);
+ SubgraphQuery branch = SubgraphQuery.create(entityManager, workspaceId, node.getUuid(), 0);
branch.deleteSubgraph(true);
branch.close();
}
@@ -398,12 +467,9 @@
assert subgraphRootUuid != null;
}
- Path subgraphRootPath = null; // Don't need the path for this
- SubgraphQuery subgraph = SubgraphQuery.create(context,
- entityManager,
+ SubgraphQuery subgraph = SubgraphQuery.create(entityManager,
workspaceId,
subgraphRootUuid,
- subgraphRootPath,
maximumDepth);
List<NodeEntity> entities = subgraph.getNodes(true, true);
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleRequestProcessor.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleRequestProcessor.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -148,4 +148,5 @@
super.process(request);
}
+
}
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SubgraphQuery.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SubgraphQuery.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/SubgraphQuery.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -27,10 +27,7 @@
import java.util.List;
import java.util.UUID;
import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
import javax.persistence.Query;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.property.Path;
/**
* Represents a temporary working area for a query that efficiently retrieves the nodes in a subgraph. This class uses the
@@ -47,19 +44,15 @@
/**
* Create a query that returns a subgraph at and below the node with the supplied path and the supplied UUID.
*
- * @param context the execution context; may not be null
* @param entities the entity manager; may not be null
* @param workspaceId the ID of the workspace; may not be null
* @param subgraphRootUuid the UUID (in string form) of the root node in the subgraph
- * @param subgraphRootPath the path of the root node in the subgraph
* @param maxDepth the maximum depth of the subgraph, or 0 if there is no maximum depth
* @return the object representing the subgraph
*/
- public static SubgraphQuery create( ExecutionContext context,
- EntityManager entities,
+ public static SubgraphQuery create( EntityManager entities,
Long workspaceId,
UUID subgraphRootUuid,
- Path subgraphRootPath,
int maxDepth ) {
assert entities != null;
assert subgraphRootUuid != null;
@@ -106,33 +99,26 @@
throw t;
}
- return new SubgraphQuery(context, entities, workspaceId, query, subgraphRootPath, maxDepth);
+ return new SubgraphQuery(entities, workspaceId, query, maxDepth);
}
- // private final ExecutionContext context;
private final EntityManager manager;
private final Long workspaceId;
private SubgraphQueryEntity query;
private final int maxDepth;
- private final Path subgraphRootPath;
- protected SubgraphQuery( ExecutionContext context,
- EntityManager manager,
+ protected SubgraphQuery( EntityManager manager,
Long workspaceId,
SubgraphQueryEntity query,
- Path subgraphRootPath,
int maxDepth ) {
assert manager != null;
assert query != null;
- assert context != null;
- // assert subgraphRootPath != null;
assert workspaceId != null;
- // this.context = context;
+
this.manager = manager;
this.workspaceId = workspaceId;
this.query = query;
this.maxDepth = maxDepth;
- this.subgraphRootPath = subgraphRootPath;
}
/**
@@ -150,35 +136,6 @@
}
/**
- * @return subgraphRootPath
- */
- public Path getSubgraphRootPath() {
- return subgraphRootPath;
- }
-
- /**
- * @return query
- */
- public SubgraphQueryEntity getSubgraphQueryEntity() {
- if (query == null) throw new IllegalStateException();
- return query;
- }
-
- public int getNodeCount( boolean includeRoot ) {
- if (query == null) throw new IllegalStateException();
- // Now query for all the nodes and put into a list ...
- Query search = manager.createNamedQuery("SubgraphNodeEntity.getCount");
- search.setParameter("queryId", query.getId());
-
- // Now process the nodes below the subgraph's root ...
- try {
- return ((Long)search.getSingleResult()).intValue() - (includeRoot ? 0 : 1);
- } catch (NoResultException e) {
- return 0;
- }
- }
-
- /**
* Get the {@link NodeEntity root node} of the subgraph. This must be called before the query is {@link #close() closed}.
*
* @return the subgraph's root nodes
@@ -219,102 +176,8 @@
}
/**
- * Get the {@link Location} for each of the nodes in the subgraph. This must be called before the query is {@link #close()
- * closed}.
- * <p>
- * This method calls {@link #getNodes(boolean,boolean)}. Therefore, calling {@link #getNodes(boolean,boolean)} and this method
- * for the same subgraph is not efficient; consider just calling {@link #getNodes(boolean,boolean)} alone.
- * </p>
+ * Delete the nodes in the subgraph.
*
- * @param includeRoot true if the properties for the subgraph's root node are to be included, or false otherwise
- * @param includeChildrenOfMaxDepthNodes true if the method is to include nodes that are children of nodes that are at the
- * maximum depth, or false if only nodes up to the maximum depth are to be included
- * @return the list of {@link Location locations}, one for each of the nodes in the subgraph, in breadth-first order
- */
- // public List<Location> getNodeLocations( boolean includeRoot,
- // boolean includeChildrenOfMaxDepthNodes ) {
- // if (query == null) throw new IllegalStateException();
- // // Set up a map of the paths to the nodes, keyed by UUIDs. This saves us from having to build
- // // the paths every time ...
- // Map<String, Path> pathByUuid = new HashMap<String, Path>();
- // LinkedList<Location> locations = new LinkedList<Location>();
- // String subgraphRootUuid = query.getRootUuid();
- // pathByUuid.put(subgraphRootUuid, subgraphRootPath);
- // UUID uuid = UUID.fromString(subgraphRootUuid);
- // if (includeRoot) {
- // locations.add(Location.create(subgraphRootPath, uuid));
- // }
- //
- // // Now iterate over the child nodes in the subgraph (we've already included the root) ...
- // final PathFactory pathFactory = context.getValueFactories().getPathFactory();
- // final NameFactory nameFactory = context.getValueFactories().getNameFactory();
- // for (ChildEntity entity : getNodes(false, includeChildrenOfMaxDepthNodes)) {
- // String parentUuid = entity.getParentUuidString();
- // Path parentPath = pathByUuid.get(parentUuid);
- // assert parentPath != null;
- // String nsUri = entity.getChildNamespace().getUri();
- // String localName = entity.getChildName();
- // int sns = entity.getSameNameSiblingIndex();
- // Name childName = nameFactory.create(nsUri, localName);
- // Path childPath = pathFactory.create(parentPath, childName, sns);
- // String childUuid = entity.getId().getChildUuidString();
- // pathByUuid.put(childUuid, childPath);
- // uuid = UUID.fromString(childUuid);
- // locations.add(Location.create(childPath, uuid));
- //
- // }
- // return locations;
- // }
-
- /**
- * Get the list of references that are owned by nodes within the subgraph and that point to other nodes <i>in this same
- * subgraph</i>. This set of references is important in copying a subgraph, since all intra-subgraph references in the
- * original subgraph must also be intra-subgraph references in the copy.
- *
- * @return the list of references completely contained by this subgraphs
- */
- @SuppressWarnings( "unchecked" )
- public List<ReferenceEntity> getInternalReferences() {
- Query references = manager.createNamedQuery("SubgraphNodeEntity.getInternalReferences");
- references.setParameter("queryId", query.getId());
- references.setParameter("workspaceId", workspaceId);
- return references.getResultList();
- }
-
- /**
- * Get the list of references that are owned by nodes within the subgraph and that point to nodes <i>not in this same
- * subgraph</i>. This set of references is important in copying a subgraph.
- *
- * @return the list of references that are owned by the subgraph but that point to nodes outside of the subgraph
- */
- @SuppressWarnings( "unchecked" )
- public List<ReferenceEntity> getOutwardReferences() {
- Query references = manager.createNamedQuery("SubgraphNodeEntity.getOutwardReferences");
- references.setParameter("queryId", query.getId());
- references.setParameter("workspaceId", workspaceId);
- return references.getResultList();
- }
-
- /**
- * Get the list of references that are owned by nodes <i>outside</i> of the subgraph that point to nodes <i>in this
- * subgraph</i>. This set of references is important in deleting nodes, since such references prevent the deletion of the
- * subgraph.
- *
- * @return the list of references that are no longer valid
- */
- @SuppressWarnings( "unchecked" )
- public List<ReferenceEntity> getInwardReferences() {
- // Verify referential integrity: that none of the deleted nodes are referenced by nodes not being deleted.
- Query references = manager.createNamedQuery("SubgraphNodeEntity.getInwardReferences");
- references.setParameter("queryId", query.getId());
- references.setParameter("workspaceId", workspaceId);
- return references.getResultList();
- }
-
- /**
- * Delete the nodes in the subgraph. This method first does not check for referential integrity (see
- * {@link #getInwardReferences()}).
- *
* @param includeRoot true if the root node should also be deleted
*/
@SuppressWarnings( "unchecked" )
@@ -353,13 +216,6 @@
delete.setParameter("workspaceId", workspaceId);
delete.executeUpdate();
- // Delete references ...
- // delete = manager.createNamedQuery("SubgraphNodeEntity.deleteReferences");
- // delete.setParameter("queryId", query.getId());
- // delete.setParameter("depth", includeRoot ? 0 : 1);
- // delete.setParameter("workspaceId", workspaceId);
- // delete.executeUpdate();
-
// Delete unused large values ...
LargeValueEntity.deleteUnused(manager);
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/package-info.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/package-info.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/simple/package-info.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -22,7 +22,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
/**
- * The classes that define the "basic" storage model for the JPA connector.
+ * The classes that define the "simple" storage model for the JPA connector.
*/
package org.jboss.dna.connector.store.jpa.model.simple;
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicCreateWorkspacesTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicCreateWorkspacesTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicCreateWorkspacesTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,3 +1,26 @@
+/*
+ * 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.connector.store.jpa.model.basic;
import org.jboss.dna.connector.store.jpa.JpaConnectorCreateWorkspacesTest;
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicNoCreateWorkspaceTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicNoCreateWorkspaceTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/basic/BasicNoCreateWorkspaceTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,3 +1,26 @@
+/*
+ * 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.connector.store.jpa.model.basic;
import org.jboss.dna.connector.store.jpa.JpaConnectorNoCreateWorkspaceTest;
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/NodeEntityTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/NodeEntityTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/NodeEntityTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,3 +1,26 @@
+/*
+ * 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.connector.store.jpa.model.simple;
import static org.hamcrest.core.Is.is;
@@ -9,7 +32,6 @@
import javax.persistence.Query;
import org.hibernate.ejb.Ejb3Configuration;
import org.jboss.dna.connector.store.jpa.model.common.NamespaceEntity;
-import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.property.PropertyType;
import org.junit.After;
import org.junit.Before;
@@ -20,7 +42,6 @@
private static final Boolean SHOW_SQL = false;
private static final Boolean USE_CACHE = false;
- private ExecutionContext context;
private EntityManagerFactory factory;
private EntityManager manager;
private SimpleModel model;
@@ -48,7 +69,6 @@
factory = configurator.buildEntityManagerFactory();
manager = factory.createEntityManager();
- context = new ExecutionContext();
}
@After
@@ -147,14 +167,12 @@
manager = factory.createEntityManager();
manager.getTransaction().begin();
- SubgraphQuery subgraph = SubgraphQuery.create(context,
- manager,
+ SubgraphQuery subgraph = SubgraphQuery.create(manager,
workspaceId,
UUID.fromString(rootUuid),
- context.getValueFactories().getPathFactory().createRootPath(),
0);
- assertThat(subgraph.getNodeCount(false), is(10));
+ // assertThat(subgraph.getNodeCount(false), is(10));
subgraph.deleteSubgraph(true);
subgraph.close();
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleCreateWorkspacesTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleCreateWorkspacesTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleCreateWorkspacesTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,4 +1,26 @@
-package org.jboss.dna.connector.store.jpa.model.simple;
+/*
+ * 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.connector.store.jpa.model.simple;
import org.jboss.dna.connector.store.jpa.JpaConnectorCreateWorkspacesTest;
import org.jboss.dna.connector.store.jpa.JpaSource;
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,3 +1,26 @@
+/*
+ * 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.connector.store.jpa.model.simple;
import org.jboss.dna.common.statistic.Stopwatch;
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,3 +1,26 @@
+/*
+ * 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.connector.store.jpa.model.simple;
import org.jboss.dna.connector.store.jpa.JpaSource;
@@ -31,6 +54,7 @@
source.setUrl("jdbc:hsqldb:mem:test");
source.setShowSql(false);
source.setAutoGenerateSchema("create");
+ source.setReferentialIntegrityEnforced(false);
source.initialize(new RepositoryContext() {
@@ -57,11 +81,6 @@
return source;
}
- @Override
- public void shouldCopyNodeWithChildren() {
-
- }
-
/**
* {@inheritDoc}
*
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,3 +1,26 @@
+/*
+ * 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.connector.store.jpa.model.simple;
import java.util.concurrent.TimeUnit;
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleNoCreateWorkspaceTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleNoCreateWorkspaceTest.java 2009-12-04 20:38:39 UTC (rev 1406)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleNoCreateWorkspaceTest.java 2009-12-05 02:53:36 UTC (rev 1407)
@@ -1,3 +1,26 @@
+/*
+ * 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.connector.store.jpa.model.simple;
import org.jboss.dna.connector.store.jpa.JpaConnectorNoCreateWorkspaceTest;
14 years, 5 months
DNA SVN: r1406 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-04 15:38:39 -0500 (Fri, 04 Dec 2009)
New Revision: 1406
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java
Log:
DNA-575 JoinRequestProcessor Enters Infinite Loop if VerifyWorkspaceRequest Has Error
Committed patch that sets the error on the original request and then returns from the process method instead of continuing infinitely.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2009-12-04 20:37:26 UTC (rev 1405)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2009-12-04 20:38:39 UTC (rev 1406)
@@ -1063,7 +1063,7 @@
VerifyNodeExistsRequest readFromSource = (VerifyNodeExistsRequest)projectedRequest.getRequest();
if (readFromSource.hasError()) {
request.setError(readFromSource.getError());
- continue;
+ return;
}
request.setError(null);
if (readFromSource.isCancelled()) {
14 years, 5 months
DNA SVN: r1405 - in trunk/dna-jcr/src: test/java/org/jboss/dna/jcr and 1 other directory.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-12-04 15:37:26 -0500 (Fri, 04 Dec 2009)
New Revision: 1405
Added:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNodeTypeManagerTest.java
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrObservationManager.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java
Log:
DNA 570 JcrObservationManager's Logic For Filtering Events Based On Node Types Is Incorrect
DNA 571 JcrObservationManager's Logic For Filtering Events Based On Path Is Incorrect For Property Events
Changed the logic in JcrObservationManager to use the node's path, not the node's parent path, when handling property events. Changed JcrNodeTypeManager.isDerivedFrom(String[], String, String[]) to check the collection or one or more given types to see if equal to or derived from the primary type or one of the mixins of the Event node. Uncommented the appropriate tests in JcrObservationManagerTest and JcrTckTest so that they now run.
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java 2009-12-04 20:33:42 UTC (rev 1404)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java 2009-12-04 20:37:26 UTC (rev 1405)
@@ -567,30 +567,30 @@
}
/**
- * Determine whether the primary type or mixins are directly or indirectly derived from a node type with one of the supplied
- * names.
+ * Determine if any of the test type names are equal to or have been derived from the primary type or any of the mixins.
*
- * @param primaryTypeName the primary type being checked (never <code>null</code>)
- * @param mixinNames the mixins being checked (may be <code>null</code>)
- * @param superTypeNames the names of the node types the primary type and mixins are tested against (never <code>null</code>)
- * @return <code>true</code> if the primary type or one of the mixins are derived from one of the type names
+ * @param testTypeNames the names of the types or mixins being tested against (never <code>null</code>)
+ * @param primaryTypeName the primary type name (never <code>null</code>)
+ * @param mixinNames the mixin names (may be <code>null</code>)
+ * @return <code>true</code> if at least one test type name is equal to or derived from the primary type or one of the mixins
* @throws RepositoryException if there is an exception obtaining node types
- * @throws IllegalArgumentException if <code>primaryTypeProperty</code> is <code>null</code>
+ * @throws IllegalArgumentException if <code>testTypeNames</code> is <code>null</code> or empty or if
+ * <code>primaryTypeName</code> is <code>null</code> or zero length
*/
- public boolean isDerivedFrom( String primaryTypeName,
- String[] mixinNames,
- String[] superTypeNames ) throws RepositoryException {
- CheckArg.isNotNull(primaryTypeName, "primaryTypeName");
- CheckArg.isNotNull(superTypeNames, "superTypeNames");
+ public boolean isDerivedFrom( String[] testTypeNames,
+ String primaryTypeName,
+ String[] mixinNames ) throws RepositoryException {
+ CheckArg.isNotEmpty(testTypeNames, "testTypeNames");
+ CheckArg.isNotEmpty(primaryTypeName, "primaryTypeName");
NameFactory nameFactory = context().getValueFactories().getNameFactory();
- Name[] typeNames = nameFactory.create(superTypeNames);
+ Name[] typeNames = nameFactory.create(testTypeNames);
// first check primary type
- JcrNodeType primaryType = getNodeType(primaryTypeName);
+ for (Name typeName : typeNames) {
+ JcrNodeType nodeType = getNodeType(typeName);
- for (Name typeName : typeNames) {
- if (primaryType.isNodeType(typeName)) {
+ if ((nodeType != null) && nodeType.isNodeType(primaryTypeName)) {
return true;
}
}
@@ -598,10 +598,10 @@
// now check mixins
if (mixinNames != null) {
for (String mixin : mixinNames) {
- JcrNodeType mixinType = getNodeType(mixin);
+ for (Name typeName : typeNames) {
+ JcrNodeType nodeType = getNodeType(typeName);
- for (Name typeName : typeNames) {
- if (mixinType.isNodeType(typeName)) {
+ if ((nodeType != null) && nodeType.isNodeType(mixin)) {
return true;
}
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrObservationManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrObservationManager.java 2009-12-04 20:33:42 UTC (rev 1404)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrObservationManager.java 2009-12-04 20:37:26 UTC (rev 1405)
@@ -563,7 +563,7 @@
mixinNames = stringFactory.create(propMap.get(MIXIN_TYPES).getValuesAsArray());
}
- return getNodeTypeManager().isDerivedFrom(primaryTypeName, mixinNames, this.nodeTypeNames);
+ return getNodeTypeManager().isDerivedFrom(this.nodeTypeNames, primaryTypeName, mixinNames);
} catch (RepositoryException e) {
accept = false;
Logger.getLogger(getClass()).error(e,
@@ -584,12 +584,19 @@
private boolean acceptBasedOnPath( NetChange change ) {
if ((this.absPath != null) && (this.absPath.length() != 0)) {
Path matchPath = getValueFactories().getPathFactory().create(this.absPath);
+ Path changePath = null;
+
+ if (change.includes(ChangeType.NODE_ADDED, ChangeType.NODE_REMOVED)) {
+ changePath = change.getPath().getParent();
+ } else {
+ changePath = change.getPath();
+ }
if (this.isDeep) {
- return matchPath.isAtOrAbove(change.getPath().getParent());
+ return matchPath.isAtOrAbove(changePath);
}
- return matchPath.equals(change.getPath().getParent());
+ return matchPath.equals(changePath);
}
return true;
Added: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNodeTypeManagerTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNodeTypeManagerTest.java (rev 0)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNodeTypeManagerTest.java 2009-12-04 20:37:26 UTC (rev 1405)
@@ -0,0 +1,182 @@
+/*
+ * 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 static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import junit.framework.TestSuite;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.jcr.JcrRepository.Option;
+import org.jboss.security.config.IDTrustConfiguration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * The {@link JcrNodeTypeManager} test class.
+ */
+public final class JcrNodeTypeManagerTest extends TestSuite {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ private static final String MIXIN1 = "mix:lockable";
+ private static final String MIXIN2 = "mix:referenceable";
+ private static final String[] MIXINS = new String[] {MIXIN1, MIXIN2};
+
+ private static final String HIERARCHY_NODE_TYPE = "nt:hierarchyNode";
+
+ private static final String SUBTYPE1 = "nt:folder"; // subtype of HIERARCHY_NODE_TYPE
+ private static final String SUBTYPE2 = "nt:file"; // subtype of HIERARCHY_NODE_TYPE
+ private static final String[] SUBTYPES = new String[] {SUBTYPE1, SUBTYPE2};
+
+ private static final String NO_MATCH_TYPE = "nt:query";
+
+ private static final String[] SUBTYPES_MIXINS;
+
+ static {
+ SUBTYPES_MIXINS = new String[SUBTYPES.length + MIXINS.length];
+ System.arraycopy(SUBTYPES, 0, SUBTYPES_MIXINS, 0, SUBTYPES.length);
+ System.arraycopy(MIXINS, 0, SUBTYPES_MIXINS, SUBTYPES.length, MIXINS.length);
+ }
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ @BeforeClass
+ public static void beforeClass() {
+ // Initialize IDTrust
+ String configFile = "security/jaas.conf.xml";
+ IDTrustConfiguration idtrustConfig = new IDTrustConfiguration();
+
+ try {
+ idtrustConfig.config(configFile);
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ private JcrEngine engine;
+ private Session session;
+ private JcrNodeTypeManager nodeTypeMgr;
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ @After
+ public void afterEach() {
+ try {
+ if (this.session != null) {
+ this.session.logout();
+ }
+ } finally {
+ this.session = null;
+
+ try {
+ this.engine.shutdown();
+ } finally {
+ this.engine = null;
+ }
+ }
+ }
+
+ @Before
+ public void beforeEach() throws RepositoryException {
+ final String WORKSPACE = "ws1";
+ final String REPOSITORY = "r1";
+ final String SOURCE = "store";
+
+ JcrConfiguration config = new JcrConfiguration();
+ config.repositorySource("store").usingClass(InMemoryRepositorySource.class).setRetryLimit(100).setProperty("defaultWorkspaceName",
+ WORKSPACE);
+ config.repository(REPOSITORY).setSource(SOURCE).setOption(Option.JAAS_LOGIN_CONFIG_NAME, "dna-jcr");
+ config.save();
+
+ // Create and start the engine ...
+ this.engine = config.build();
+ this.engine.start();
+
+ // Create repository and session
+ Repository repository = this.engine.getRepository(REPOSITORY);
+ final String USER_ID = "superuser";
+ Credentials credentials = new SimpleCredentials(USER_ID, USER_ID.toCharArray());
+ this.session = repository.login(credentials, WORKSPACE);
+ this.nodeTypeMgr = (JcrNodeTypeManager)this.session.getWorkspace().getNodeTypeManager();
+ }
+
+ @Test( expected = IllegalArgumentException.class )
+ public void shouldNotAllowNullSubTypeNames() throws RepositoryException {
+ this.nodeTypeMgr.isDerivedFrom(null, "nt:base", MIXINS);
+ }
+
+ @Test( expected = IllegalArgumentException.class )
+ public void shouldNotAllowEmptySubTypeNames() throws Exception {
+ this.nodeTypeMgr.isDerivedFrom(new String[0], "nt:base", MIXINS);
+ }
+
+ @Test( expected = IllegalArgumentException.class )
+ public void shouldNotAllowNullPrimaryType() throws Exception {
+ this.nodeTypeMgr.isDerivedFrom(SUBTYPES, null, MIXINS);
+ }
+
+ @Test( expected = IllegalArgumentException.class )
+ public void shouldNotAllowEmptyPrimaryType() throws Exception {
+ this.nodeTypeMgr.isDerivedFrom(SUBTYPES, "", MIXINS);
+ }
+
+ @Test
+ public void shouldBeDerivedFromIfSubtypeMatchesPrimaryType() throws Exception {
+ assertTrue(this.nodeTypeMgr.isDerivedFrom(SUBTYPES, SUBTYPE2, null));
+ assertTrue(this.nodeTypeMgr.isDerivedFrom(SUBTYPES, SUBTYPE2, MIXINS));
+ }
+
+ @Test
+ public void shouldBeDerivedFromIfSubtypeMatchesMixin() throws Exception {
+ assertTrue(this.nodeTypeMgr.isDerivedFrom(new String[] {MIXIN2}, SUBTYPE1, MIXINS));
+ }
+
+ @Test
+ public void shouldBeDerivedFromIfSubtypeIsActualSubType() throws Exception {
+ assertTrue(this.nodeTypeMgr.isDerivedFrom(SUBTYPES, HIERARCHY_NODE_TYPE, MIXINS));
+ }
+
+ @Test
+ public void shouldNotBeDerivedFromIfNoMatch() throws Exception {
+ assertFalse(this.nodeTypeMgr.isDerivedFrom(SUBTYPES, NO_MATCH_TYPE, MIXINS));
+ }
+
+}
Property changes on: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNodeTypeManagerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java 2009-12-04 20:33:42 UTC (rev 1404)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java 2009-12-04 20:37:26 UTC (rev 1405)
@@ -70,9 +70,9 @@
import org.junit.Test;
/**
- *
+ * The {@link JcrObservationManager} test class.
*/
-public class JcrObservationManagerTest extends TestSuite {
+public final class JcrObservationManagerTest extends TestSuite {
// ===========================================================================================================================
// Constants
@@ -114,9 +114,7 @@
// Fields
// ===========================================================================================================================
- private JcrConfiguration config;
private JcrEngine engine;
- private Repository repository;
private Session session;
private Node testRootNode;
@@ -152,7 +150,6 @@
this.session = null;
try {
- this.repository = null;
this.engine.shutdown();
} finally {
this.engine = null;
@@ -166,22 +163,20 @@
final String REPOSITORY = "r1";
final String SOURCE = "store";
- this.config = new JcrConfiguration();
- this.config.repositorySource("store")
- .usingClass(InMemoryRepositorySource.class)
- .setRetryLimit(100)
- .setProperty("defaultWorkspaceName", WORKSPACE);
- this.config.repository(REPOSITORY).setSource(SOURCE).setOption(Option.JAAS_LOGIN_CONFIG_NAME, "dna-jcr");
- this.config.save();
+ JcrConfiguration config = new JcrConfiguration();
+ config.repositorySource("store").usingClass(InMemoryRepositorySource.class).setRetryLimit(100).setProperty("defaultWorkspaceName",
+ WORKSPACE);
+ config.repository(REPOSITORY).setSource(SOURCE).setOption(Option.JAAS_LOGIN_CONFIG_NAME, "dna-jcr");
+ config.save();
// Create and start the engine ...
- this.engine = this.config.build();
+ this.engine = config.build();
this.engine.start();
// Create repository and session
- this.repository = this.engine.getRepository(REPOSITORY);
+ Repository repository = this.engine.getRepository(REPOSITORY);
Credentials credentials = new SimpleCredentials(USER_ID, USER_ID.toCharArray());
- this.session = this.repository.login(credentials, WORKSPACE);
+ this.session = repository.login(credentials, WORKSPACE);
this.testRootNode = this.session.getRootNode().addNode("testroot", UNSTRUCTURED);
save();
@@ -574,8 +569,9 @@
// make sure same listener isn't added again
getObservationManager().addEventListener(listener, ALL_EVENTS, null, false, null, null, false);
- assertThat("The same listener should not be added more than once.", getObservationManager().getRegisteredEventListeners()
- .getSize(), is(2L));
+ assertThat("The same listener should not be added more than once.",
+ getObservationManager().getRegisteredEventListeners().getSize(),
+ is(2L));
}
/**
@@ -1138,8 +1134,8 @@
// tests
checkResults(listener);
- assertTrue("Path for jrc:primaryType property was not found.", containsPath(listener, node.getProperty("jcr:primaryType")
- .getPath()));
+ assertTrue("Path for jrc:primaryType property was not found.",
+ containsPath(listener, node.getProperty("jcr:primaryType").getPath()));
}
// ===========================================================================================================================
@@ -1350,7 +1346,6 @@
* @see AddEventListenerTest#testIsDeepFalseNodeAdded()
*/
@Test
- @Ignore
public void shouldTestAddEventListenerTest_testIsDeepFalseNodeAdded() throws Exception {
// setup
String node1 = "node1";
@@ -1378,7 +1373,6 @@
* @see AddEventListenerTest#testIsDeepFalsePropertyAdded()
*/
@Test
- @Ignore
public void shouldTestAddEventListenerTest_testIsDeepFalsePropertyAdded() throws Exception {
// setup
Node n1 = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1409,7 +1403,6 @@
* @see AddEventListenerTest#testNodeType()
*/
@Test
- @Ignore
public void shouldTestAddEventListenerTest_testNodeType() throws Exception {
// setup
Node n1 = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1418,7 +1411,13 @@
save();
// register listener
- TestListener listener = addListener(1, Event.NODE_ADDED, getRoot().getPath(), true, null, new String[] {REF_MIXIN}, false);
+ TestListener listener = addListener(1,
+ Event.NODE_ADDED,
+ getRoot().getPath(),
+ true,
+ null,
+ new String[] {LOCK_MIXIN},
+ false);
// trigger events
String node3 = "node3";
@@ -1490,7 +1489,6 @@
* @see AddEventListenerTest#testUUID()
*/
@Test
- @Ignore
public void shouldTestAddEventListenerTest_testUUID() throws Exception {
// setup
Node n1 = getRoot().addNode("node1", UNSTRUCTURED);
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java 2009-12-04 20:33:42 UTC (rev 1404)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java 2009-12-04 20:37:26 UTC (rev 1405)
@@ -81,6 +81,7 @@
import org.apache.jackrabbit.test.api.WorkspaceMoveSameNameSibsTest;
import org.apache.jackrabbit.test.api.WorkspaceMoveTest;
import org.apache.jackrabbit.test.api.WorkspaceMoveVersionableTest;
+import org.apache.jackrabbit.test.api.observation.AddEventListenerTest;
import org.apache.jackrabbit.test.api.observation.EventIteratorTest;
import org.apache.jackrabbit.test.api.observation.EventTest;
import org.apache.jackrabbit.test.api.observation.GetRegisteredEventListenersTest;
@@ -307,7 +308,7 @@
addTestSuite(PropertyAddedTest.class);
addTestSuite(PropertyChangedTest.class);
addTestSuite(PropertyRemovedTest.class);
- // addTestSuite(AddEventListenerTest.class);
+ addTestSuite(AddEventListenerTest.class);
// addTestSuite(WorkspaceOperationTest.class);
}
}
14 years, 5 months
DNA SVN: r1404 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/request.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-04 15:33:42 -0500 (Fri, 04 Dec 2009)
New Revision: 1404
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java
Log:
DNA-574
Applied patch that makes SetPropertyRequest.toString null-safe and adds a better toString method for CompositeRequest.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java 2009-12-04 20:31:02 UTC (rev 1403)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java 2009-12-04 20:33:42 UTC (rev 1404)
@@ -327,4 +327,17 @@
return false;
}
+ @Override
+ public String toString() {
+ StringBuffer buff = new StringBuffer();
+ buff.append("[CompositeRequest (" + size() + ")");
+
+ for (Request r : this.getRequests()) {
+ buff.append("\n\t").append(r);
+ }
+
+ buff.append("]");
+ return buff.toString();
+ }
+
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java 2009-12-04 20:31:02 UTC (rev 1403)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java 2009-12-04 20:33:42 UTC (rev 1404)
@@ -229,7 +229,8 @@
*/
@Override
public String toString() {
+ Object[] values = property().getValuesAsArray();
return "set property " + property().getName() + " on " + on() + " in the \"" + workspaceName + "\" workspace to "
- + Arrays.asList(property().getValuesAsArray()).toString();
+ + (values == null ? "null" : Arrays.asList(values).toString());
}
}
14 years, 5 months
DNA SVN: r1403 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-04 15:31:02 -0500 (Fri, 04 Dec 2009)
New Revision: 1403
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java
Log:
DNA-573
Applied patch that forces the FRC to wait for all requests to be fully processed before returning. This corrects the defect.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java 2009-12-04 12:26:35 UTC (rev 1402)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java 2009-12-04 20:31:02 UTC (rev 1403)
@@ -224,6 +224,11 @@
abort = true;
throw e;
} finally {
+ if (!awaitAllSubtasks) {
+ // We need to guarantee that the fork processor is closed and released all its resources before we close
+ // ...
+ fork.await();
+ }
join.close();
}
if (request instanceof CompositeRequest) {
14 years, 5 months
DNA SVN: r1402 - in trunk: dna-graph/src/test/java/org/jboss/dna/graph/observe and 2 other directories.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-12-04 07:26:35 -0500 (Fri, 04 Dec 2009)
New Revision: 1402
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/observe/MockObservable.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
Log:
DNA 568 Observable.register(Observer) Contract Is Being Violated: Fixed the register method to return false if the observer being registered is null.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java 2009-12-04 07:38:49 UTC (rev 1401)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java 2009-12-04 12:26:35 UTC (rev 1402)
@@ -42,6 +42,7 @@
* @see org.jboss.dna.graph.observe.Observable#register(org.jboss.dna.graph.observe.Observer)
*/
public boolean register( Observer observer ) {
+ if (observer == null) return false;
return observers.register(observer);
}
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/observe/MockObservable.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/observe/MockObservable.java 2009-12-04 07:38:49 UTC (rev 1401)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/observe/MockObservable.java 2009-12-04 12:26:35 UTC (rev 1402)
@@ -34,7 +34,7 @@
* @see org.jboss.dna.graph.observe.Observable#register(org.jboss.dna.graph.observe.Observer)
*/
public boolean register( Observer observer ) {
- return true;
+ return ((observer == null) ? false : true);
}
/**
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-12-04 07:38:49 UTC (rev 1401)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-12-04 12:26:35 UTC (rev 1402)
@@ -989,7 +989,7 @@
* @see org.jboss.dna.graph.observe.Observable#register(org.jboss.dna.graph.observe.Observer)
*/
public boolean register( Observer observer ) {
- CheckArg.isNotNull(observer, "observer");
+ if (observer == null) return false;
return this.observers.addIfAbsent(observer);
}
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2009-12-04 07:38:49 UTC (rev 1401)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2009-12-04 12:26:35 UTC (rev 1402)
@@ -171,6 +171,7 @@
* @see org.jboss.dna.graph.observe.Observable#register(org.jboss.dna.graph.observe.Observer)
*/
public boolean register( Observer observer ) {
+ if (observer == null) return false;
return observationBus.register(observer);
}
14 years, 5 months
DNA SVN: r1401 - trunk/dna-jcr/src/test/java/org/jboss/dna/jcr.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-04 02:38:49 -0500 (Fri, 04 Dec 2009)
New Revision: 1401
Modified:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java
Log:
DNA-456 The build failed again in JcrObservationManagerTest, and so I re-ran the tests about 10x before I got the failure locally. After some debugging, I noticed that when it failed, all of the missing events appear to be the last event, so I poked around the TestListener.waitForEvents() method, which calls 'await(...)' on a CountDownLatch that is decremented in the 'onEvent(...)' method. The 'latch.countDown()' method was being called (and potentially the 'waitForEvents()' method returning) immediately after 'itr.nextEvent()' and before the event was added to the TestListener's state. Of course, whether the 'waitForEvents()' method returns before or after the event info is added depends completely on thread scheduling. This would explain how it frequently worked on some machines but frequently failed on others.
I put the whole content of the while loop in the 'onEvent(...)' method in a try-finally block, and moved the 'latch.countDown()' method to the finally. I ran several tests locally with no failures, but I'll commit to see if they pass on the build box.
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java 2009-12-04 06:56:40 UTC (rev 1400)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java 2009-12-04 07:38:49 UTC (rev 1401)
@@ -1683,24 +1683,27 @@
// iterator position must be set initially zero
if (position == 0) {
while (itr.hasNext()) {
- this.latch.countDown();
- Event event = itr.nextEvent();
+ try {
+ Event event = itr.nextEvent();
+ // check iterator position
+ if (++position != itr.getPosition()) {
+ this.errorMessage = "EventIterator position was " + itr.getPosition() + " and should be " + position;
+ break;
+ }
- // check iterator position
- if (++position != itr.getPosition()) {
- this.errorMessage = "EventIterator position was " + itr.getPosition() + " and should be " + position;
- break;
- }
+ this.events.add(event);
+ ++this.eventsProcessed;
- this.events.add(event);
- ++this.eventsProcessed;
+ // check event type
+ int eventType = event.getType();
- // check event type
- int eventType = event.getType();
-
- if ((this.eventTypes & eventType) == 0) {
- this.errorMessage = "Received a wrong event type of " + eventType;
- break;
+ if ((this.eventTypes & eventType) == 0) {
+ this.errorMessage = "Received a wrong event type of " + eventType;
+ break;
+ }
+ } finally {
+ // This has to be done LAST, otherwise waitForEvents() will return before the above stuff is done
+ this.latch.countDown();
}
}
} else {
14 years, 5 months
DNA SVN: r1400 - trunk/dna-jcr/src/test/java/org/jboss/dna/jcr.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-04 01:56:40 -0500 (Fri, 04 Dec 2009)
New Revision: 1400
Modified:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java
Log:
DNA-456 Added the observation-related tests that were failing before and commented out, since they now work with the previous commit.
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java 2009-12-04 06:56:15 UTC (rev 1399)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrObservationManagerTest.java 2009-12-04 06:56:40 UTC (rev 1400)
@@ -46,7 +46,6 @@
import javax.jcr.observation.EventIterator;
import javax.jcr.observation.EventListener;
import javax.jcr.observation.ObservationManager;
-import junit.framework.TestResult;
import junit.framework.TestSuite;
import org.apache.jackrabbit.test.api.observation.AddEventListenerTest;
import org.apache.jackrabbit.test.api.observation.EventIteratorTest;
@@ -240,9 +239,7 @@
* @see AddEventListenerTest#testUUID()
*/
@Test
- @Ignore
public void shouldNotReceiveEventIfUuidDoesNotMatch() throws Exception {
- System.out.println("shouldNotReceiveEventIfUuidDoesNotMatch");
// setup
Node n1 = getRoot().addNode("node1", UNSTRUCTURED);
n1.addMixin(REF_MIXIN);
@@ -270,9 +267,7 @@
}
@Test
- @Ignore
public void shouldNotReceiveEventIfNodeTypeDoesNotMatch() throws Exception {
- System.out.println("shouldNotReceiveEventIfNodeTypeDoesNotMatch");
// setup
Node node1 = getRoot().addNode("node1", UNSTRUCTURED);
save();
@@ -293,9 +288,7 @@
}
@Test
- @Ignore
public void shouldReceiveNodeAddedEventWhenRegisteredToReceiveAllEvents() throws Exception {
- System.out.println("shouldReceiveNodeAddedEventWhenRegisteredToReceiveAllEvents");
// register listener (add + 3 property events)
Node root = getRoot();
save();
@@ -316,9 +309,7 @@
}
@Test
- @Ignore
public void shouldReceiveNodeRemovedEventWhenRegisteredToReceiveAllEvents() throws Exception {
- System.out.println("shouldReceiveNodeRemovedEventWhenRegisteredToReceiveAllEvents");
// add the node that will be removed
Node addedNode = getRoot().addNode("node1", UNSTRUCTURED);
save();
@@ -342,9 +333,7 @@
}
@Test
- @Ignore
public void shouldReceivePropertyAddedEventWhenRegisteredToReceiveAllEvents() throws Exception {
- System.out.println("shouldReceivePropertyAddedEventWhenRegisteredToReceiveAllEvents");
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
save();
@@ -367,9 +356,7 @@
}
@Test
- @Ignore
public void shouldReceivePropertyChangedEventWhenRegisteredToReceiveAllEvents() throws Exception {
- System.out.println("shouldReceivePropertyChangedEventWhenRegisteredToReceiveAllEvents");
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
Property prop1 = node.setProperty("prop1", "prop1 content");
@@ -393,9 +380,7 @@
}
@Test
- @Ignore
public void shouldReceivePropertyRemovedEventWhenRegisteredToReceiveAllEvents() throws Exception {
- System.out.println("shouldReceivePropertyRemovedEventWhenRegisteredToReceiveAllEvents");
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
Property prop = node.setProperty("prop1", "prop1 content");
@@ -428,9 +413,7 @@
* @see EventIteratorTest#testGetPosition()
*/
@Test
- @Ignore
public void shouldTestEventIteratorTest_testGetPosition() throws Exception {
- System.out.println("shouldTestEventIteratorTest_testGetPosition");
// register listener
TestListener listener = addListener(3, Event.NODE_ADDED, null, false, null, null, false);
@@ -453,7 +436,6 @@
* @see EventIteratorTest#testGetSize()
*/
@Test
- @Ignore
public void shouldTestEventIteratorTest_testGetSize() throws Exception {
// register listener
TestListener listener = addListener(1, Event.NODE_ADDED, null, false, null, null, false);
@@ -475,7 +457,6 @@
* @see EventIteratorTest#testSkip()
*/
@Test
- @Ignore
public void shouldTestEventIteratorTest_testSkip() throws Exception {
// create events
List<Event> events = new ArrayList<Event>();
@@ -510,7 +491,6 @@
* @see EventTest#testGetNodePath()
*/
@Test
- @Ignore
public void shouldTestEventTest_testGetNodePath() throws Exception {
// register listener
TestListener listener = addListener(1, Event.NODE_ADDED, null, false, null, null, false);
@@ -534,7 +514,6 @@
* @see EventTest#testGetType()
*/
@Test
- @Ignore
public void shouldTestEventTest_testGetType() throws Exception {
// register listener
TestListener listener = addListener(1, Event.NODE_ADDED, null, false, null, null, false);
@@ -557,7 +536,6 @@
* @see EventTest#testGetUserId()
*/
@Test
- @Ignore
public void shouldTestEventTest_testGetUserId() throws Exception {
// register listener
TestListener listener = addListener(1, Event.NODE_ADDED, null, false, null, null, false);
@@ -584,7 +562,6 @@
* @see GetRegisteredEventListenersTest#testGetSize()
*/
@Test
- @Ignore
public void shouldTestGetRegisteredEventListenersTest_testGetSize() throws Exception {
assertThat("A new session must not have any event listeners registered.",
getObservationManager().getRegisteredEventListeners().getSize(),
@@ -606,7 +583,6 @@
* @see GetRegisteredEventListenersTest#testRemoveEventListener()
*/
@Test
- @Ignore
public void shouldTestGetRegisteredEventListenersTest_testRemoveEventListener() throws Exception {
TestListener listener1 = addListener(0, ALL_EVENTS, null, false, null, null, false);
EventListener listener2 = addListener(0, ALL_EVENTS, null, false, null, null, false);
@@ -632,7 +608,6 @@
* @see LockingTest#testAddLockToNode()
*/
@Test
- @Ignore
public void shouldTestLockingTest_testAddLockToNode() throws Exception {
// setup
String node1 = "node1";
@@ -661,7 +636,6 @@
* @see LockingTest#testRemoveLockFromNode()
*/
@Test
- @Ignore
public void shouldTestLockingTest_testRemoveLockFromNode() throws Exception {
// setup
String node1 = "node1";
@@ -695,9 +669,7 @@
* @see NodeAddedTest#testMultipleNodeAdded1()
*/
@Test
- @Ignore
public void shouldTestNodeAddedTest_testMultipleNodeAdded1() throws Exception {
- System.out.println("shouldTestNodeAddedTest_testMultipleNodeAdded1");
// register listener
TestListener listener = addListener(2, Event.NODE_ADDED, null, false, null, null, false);
@@ -721,7 +693,6 @@
* @see NodeAddedTest#testMultipleNodeAdded2()
*/
@Test
- @Ignore
public void shouldTestNodeAddedTest_testMultipleNodeAdded2() throws Exception {
// register listener
TestListener listener = addListener(2, Event.NODE_ADDED, null, false, null, null, false);
@@ -746,7 +717,6 @@
* @see NodeAddedTest#testSingleNodeAdded()
*/
@Test
- @Ignore
public void shouldTestNodeAddedTest_testSingleNodeAdded() throws Exception {
// register listener
TestListener listener = addListener(1, Event.NODE_ADDED, null, false, null, null, false);
@@ -770,7 +740,6 @@
* @see NodeAddedTest#testTransientNodeAddedRemoved()
*/
@Test
- @Ignore
public void shouldTestNodeAddedTest_testTransientNodeAddedRemoved() throws Exception {
// register listener
TestListener listener = addListener(1, Event.NODE_ADDED, null, false, null, null, false);
@@ -832,7 +801,6 @@
* @see NodeRemovedTest#testSingleNodeRemoved()
*/
@Test
- @Ignore
public void shouldTestNodeRemovedTest_testSingleNodeRemoved() throws Exception {
// register listener
TestListener listener = addListener(1, Event.NODE_REMOVED, null, false, null, null, false);
@@ -865,7 +833,6 @@
* @see NodeMovedTest#testMoveNode()
*/
@Test
- @Ignore
public void shouldTestNodeMovedTest_testMoveNode() throws Exception {
// setup
String node1 = "node1";
@@ -904,7 +871,6 @@
* @see NodeMovedTest#testMoveTree()
*/
@Test
- @Ignore
public void shouldTestNodeMovedTest_testMoveTree() throws Exception {
// setup
Node n1 = getRoot().addNode("node1", UNSTRUCTURED);
@@ -941,7 +907,6 @@
* @see NodeMovedTest#testMoveWithRemove()
*/
@Test
- @Ignore
public void shouldTestNodeMovedTest_testMoveWithRemove() throws Exception {
// setup
String node2 = "node2";
@@ -988,7 +953,6 @@
* @see NodeReorderTest#testNodeReorder()
*/
@Test
- @Ignore
public void shouldTestNodeReorderTest_testNodeReorder() throws Exception {
// setup
getRoot().addNode("node1", UNSTRUCTURED);
@@ -1024,7 +988,6 @@
* @see NodeReorderTest#testNodeReorderSameName()
*/
@Test
- @Ignore
public void shouldTestNodeReorderTest_testNodeReorderSameName() throws Exception {
// setup
String node1 = "node1";
@@ -1061,7 +1024,6 @@
* @see NodeReorderTest#testNodeReorderSameNameWithRemove()
*/
@Test
- @Ignore
public void shouldTestNodeReorderTest_testNodeReorderSameNameWithRemove() throws Exception {
// setup
String node1 = "node1";
@@ -1107,7 +1069,6 @@
* @see PropertyAddedTest#testMultiPropertyAdded()
*/
@Test
- @Ignore
public void shouldTestPropertyAddedTest_testMultiPropertyAdded() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1136,7 +1097,6 @@
* @see PropertyAddedTest#testSinglePropertyAdded()
*/
@Test
- @Ignore
public void shouldTestPropertyAddedTest_testSinglePropertyAdded() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1164,7 +1124,6 @@
* @see PropertyAddedTest#testSystemGenerated()
*/
@Test
- @Ignore
public void shouldTestPropertyAddedTest_testSystemGenerated() throws Exception {
// register listener
TestListener listener = addListener(3, Event.PROPERTY_ADDED, null, false, null, null, false);
@@ -1192,7 +1151,6 @@
* @see PropertyChangedTest#testMultiPropertyChanged()
*/
@Test
- @Ignore
public void shouldTestPropertyChangedTests_testMultiPropertyChanged() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1223,7 +1181,6 @@
* @see PropertyChangedTest#testPropertyRemoveCreate()
*/
@Test
- @Ignore
public void shouldTestPropertyChangedTests_testPropertyRemoveCreate() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1266,7 +1223,6 @@
* @see PropertyChangedTest#testSinglePropertyChanged()
*/
@Test
- @Ignore
public void shouldTestPropertyChangedTests_testSinglePropertyChanged() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1295,7 +1251,6 @@
* @see PropertyChangedTest#testSinglePropertyChangedWithAdded()
*/
@Test
- @Ignore
public void shouldTestPropertyChangedTests_testSinglePropertyChangedWithAdded() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1329,7 +1284,6 @@
* @see PropertyRemovedTest#testMultiPropertyRemoved()
*/
@Test
- @Ignore
public void shouldTestPropertyRemovedTest_testMultiPropertyRemoved() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1363,7 +1317,6 @@
* @see PropertyRemovedTest#testSinglePropertyRemoved()
*/
@Test
- @Ignore
public void shouldTestPropertyRemovedTest_testSinglePropertyRemoved() throws Exception {
// setup
Node node = getRoot().addNode("node1", UNSTRUCTURED);
@@ -1488,7 +1441,6 @@
* @see AddEventListenerTest#testNoLocalTrue()
*/
@Test
- @Ignore
public void shouldTestAddEventListenerTest_testNoLocalTrue() throws Exception {
// register listener
TestListener listener = addListener(0, Event.NODE_ADDED, getRoot().getPath(), true, null, null, true);
@@ -1510,9 +1462,7 @@
* @see AddEventListenerTest#testPath()
*/
@Test
- @Ignore
public void shouldTestAddEventListenerTest_testPath() throws Exception {
- System.out.println("shouldTestAddEventListenerTest_testPath");
// setup
String node1 = "node1";
String path = getRoot().getPath() + '/' + node1;
@@ -1614,7 +1564,6 @@
* @see WorkspaceOperationTest#testMove()
*/
@Test
- @Ignore
public void shouldTestWorkspaceOperationTest_testMove() throws Exception {
// setup
String node2 = "node2";
@@ -1653,7 +1602,6 @@
* @see WorkspaceOperationTest#testRename()
*/
@Test
- @Ignore
public void shouldTestWorkspaceOperationTest_testRename() throws Exception {
// setup
Node n1 = getRoot().addNode("node1", UNSTRUCTURED);
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java 2009-12-04 06:56:15 UTC (rev 1399)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java 2009-12-04 06:56:40 UTC (rev 1400)
@@ -118,7 +118,7 @@
suite.addTest(new LevelOneFeatureTests());
suite.addTest(new LevelTwoFeatureTests());
-// suite.addTest(new OptionalFeatureTests());
+ suite.addTest(new OptionalFeatureTests());
return suite;
}
@@ -282,32 +282,33 @@
// We currently don't pass the tests in those suites that are commented out
// See https://jira.jboss.org/jira/browse/DNA-285
- addTest(new ObservationTests()); // remove this and the ObservationTests inner class when all tests pass and uncomment observation.TestAll
-// addTest(org.apache.jackrabbit.test.api.observation.TestAll.suite());
+ addTest(new ObservationTests()); // remove this and the ObservationTests inner class when all tests pass and uncomment
+ // observation.TestAll
+ // addTest(org.apache.jackrabbit.test.api.observation.TestAll.suite());
// addTest(org.apache.jackrabbit.test.api.version.TestAll.suite());
addTest(org.apache.jackrabbit.test.api.lock.TestAll.suite());
-// addTest(org.apache.jackrabbit.test.api.util.TestAll.suite());
+ // addTest(org.apache.jackrabbit.test.api.util.TestAll.suite());
}
}
-
+
private static class ObservationTests extends TestSuite {
protected ObservationTests() {
super("JCR Observation Tests");
-
+
// these are the tests included in observation.TestAll.suite()
addTestSuite(EventIteratorTest.class);
addTestSuite(EventTest.class);
addTestSuite(GetRegisteredEventListenersTest.class);
addTestSuite(LockingTest.class);
addTestSuite(NodeAddedTest.class);
-// addTestSuite(NodeRemovedTest.class);
+ // addTestSuite(NodeRemovedTest.class);
addTestSuite(NodeMovedTest.class);
addTestSuite(NodeReorderTest.class);
addTestSuite(PropertyAddedTest.class);
addTestSuite(PropertyChangedTest.class);
addTestSuite(PropertyRemovedTest.class);
-// addTestSuite(AddEventListenerTest.class);
-// addTestSuite(WorkspaceOperationTest.class);
+ // addTestSuite(AddEventListenerTest.class);
+ // addTestSuite(WorkspaceOperationTest.class);
}
}
}
14 years, 5 months