[dna-commits] DNA SVN: r1420 - in trunk/extensions/dna-sequencer-cnd/src/test: resources and 1 other directory.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu Dec 10 13:14:00 EST 2009


Author: blafond
Date: 2009-12-10 13:14:00 -0500 (Thu, 10 Dec 2009)
New Revision: 1420

Added:
   trunk/extensions/dna-sequencer-cnd/src/test/resources/StandardDdl.cnd
Modified:
   trunk/extensions/dna-sequencer-cnd/src/test/java/org/jboss/dna/sequencer/cnd/CndSequencerTest.java
Log:
DNA-49 Added DDL cnd file to cnd sequencer test resources

Modified: trunk/extensions/dna-sequencer-cnd/src/test/java/org/jboss/dna/sequencer/cnd/CndSequencerTest.java
===================================================================
--- trunk/extensions/dna-sequencer-cnd/src/test/java/org/jboss/dna/sequencer/cnd/CndSequencerTest.java	2009-12-09 19:49:30 UTC (rev 1419)
+++ trunk/extensions/dna-sequencer-cnd/src/test/java/org/jboss/dna/sequencer/cnd/CndSequencerTest.java	2009-12-10 18:14:00 UTC (rev 1420)
@@ -47,6 +47,7 @@
     private URL cndImages;
     private URL cndMp3;
     private URL cndBuiltIns;
+    private URL standardDdl;
     private StreamSequencerContext context;
 
     @Before
@@ -61,6 +62,7 @@
         cndImages = this.getClass().getClassLoader().getResource("images.cnd");
         cndMp3 = this.getClass().getClassLoader().getResource("mp3.cnd");
         cndBuiltIns = this.getClass().getClassLoader().getResource("builtin_nodetypes.cnd");
+        standardDdl = this.getClass().getClassLoader().getResource("StandardDdl.cnd");
     }
 
     @After
@@ -123,5 +125,14 @@
         assertThat(content, is(notNullValue()));
         sequencer.sequence(content, output, context);
     }
+    
+    @Test
+    public void shouldGenerateNodeTypesForCndFileWithDdlTypes() throws IOException {
+        URL url = this.standardDdl;
+        assertThat(url, is(notNullValue()));
+        content = url.openStream();
+        assertThat(content, is(notNullValue()));
+        sequencer.sequence(content, output, context);
+    }
 
 }

Added: trunk/extensions/dna-sequencer-cnd/src/test/resources/StandardDdl.cnd
===================================================================
--- trunk/extensions/dna-sequencer-cnd/src/test/resources/StandardDdl.cnd	                        (rev 0)
+++ trunk/extensions/dna-sequencer-cnd/src/test/resources/StandardDdl.cnd	2009-12-10 18:14:00 UTC (rev 1420)
@@ -0,0 +1,266 @@
+/*
+ * 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.
+ */
+ 
+ //------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<ddl='http://jboss.org/dna/ddl/1.0'>
+
+
+//------------------------------------------------------------------------------
+// N O D E T Y P E S
+//------------------------------------------------------------------------------
+
+[ddl:operation] mixin abstract
+[ddl:operand] mixin abstract
+  - ddl:name (STRING) mandatory
+
+// =============================================================================
+// STATEMENT
+// =============================================================================
+[ddl:statement] mixin abstract
+  - ddl:expression (STRING) mandatory                       // The string fragment encompassing the statement expression.
+  - ddl:originalExpression (STRING) mandatory               // The string fragment encompassing the original statement expression.
+  - ddl:startLineNumber (LONG) < '(0,]' mandatory           // The starting line number for the statement
+  - ddl:startColumnNumber (LONG) < '(0,]' mandatory         // The starting column number for the statement
+  - ddl:startCharIndex (LONG) < '(0,]' mandatory            // The starting content character index for the statement
+  - ddl:length (LONG) < '(0,]' mandatory                    // The string length
+  + ddl:problem (ddl:ddlProblem) = ddl:ddlProblem multiple  // Problems encountered during parsing.
+
+// =============================================================================
+// CREATE, ALTER, DROP, INSERT, SET, GRANT, REVOKE
+// =============================================================================
+[ddl:creatable] < ddl:operation abstract
+[ddl:alterable] < ddl:operation abstract
+[ddl:droppable] < ddl:operation abstract
+  - ddl:dropBehavior (STRING)
+  + * (ddl:statementOption) = ddl:statementOption multiple
+[ddl:insertable] < ddl:operation abstract
+[ddl:settable] < ddl:operation abstract
+[ddl:grantable] < ddl:operation abstract
+[ddl:revokable] < ddl:operation abstract
+[ddl:renamable] < ddl:operation, ddl:operand abstract
+  - ddl:newName (STRING)
+
+
+
+// =============================================================================
+// OPERANDS:  SCHEMA, TABLE, DOMAIN, VIEW, ASSERTION, CHARACTER SET, COLLATION, TRANSLATION
+// =============================================================================
+[ddl:schemaOperand]             < ddl:operand abstract
+[ddl:tableOperand]              < ddl:operand abstract
+[ddl:domainOperand]             < ddl:operand abstract
+[ddl:viewOperand]               < ddl:operand abstract
+[ddl:assertionOperand]          < ddl:operand abstract
+[ddl:characterSetOperand]       < ddl:operand abstract
+[ddl:collationOperand]          < ddl:operand abstract
+[ddl:translationOperand]        < ddl:operand abstract
+[ddl:columnOperand]             < ddl:operand abstract
+[ddl:tableConstraintOperand]    < ddl:operand abstract
+[ddl:referenceOperand]          < ddl:operand abstract
+
+// =============================================================================
+// CREATE SCHEMA
+// =============================================================================
+[ddl:schemaDefinition] > ddl:statement, ddl:creatable, ddl:schemaStatement  mixin
+  - ddl:defaultCharacterSetName (STRING)
+  + * (ddl:ddlStatement) = ddl:ddlStatement (multiple)
+
+// =============================================================================
+// CREATE TABLE
+// =============================================================================
+[ddl:createTableStatement] > ddl:statement, ddl:creatable, ddl:tableOperand mixin
+  - ddl:temporary (STRING)
+    < 'GLOBAL', 'LOCAL'
+  - ddl:onCommitValue (STRING)
+    < 'DELETE ROWS', 'PRESERVE ROWS'
+  + * (ddl:columnDefinition) = ddl:columnDefinition multiple
+  + * (ddl:tableConstraintDefinition) = ddl:tableConstraintDefinition multiple
+  + * (ddl:statementOption) = ddl:statementOption multiple 
+
+// =============================================================================
+// CREATE VIEW
+// =============================================================================
+[ddl:createViewStatement] > ddl:statement, ddl:creatable, ddl:viewOperand mixin 
+  - ddl:sqlExpression (STRING) mandatory
+  - ddl:checkOption (STRING)
+  + * (ddl:columnReference) = ddl:columnReference multiple
+  
+// =============================================================================
+// CREATE DOMAIN
+// =============================================================================
+[ddl:createDomainStatement] > ddl:statement, ddl:creatable, ddl:domainOperand mixin 
+  - ddl:datatypeName (STRING) mandatory
+  - ddl:datatypeLength (LONG)
+  - ddl:datatypePrecision (LONG)
+  - ddl:datatypeScale (LONG)
+  - ddl:nullable (STRING)
+  - ddl:defaultOption (STRING) 
+      < 'LITERAL', 'DATETIME', 'USER', 'CURRENT_USER', 'SESSION_USER', 'SYSTEM_USER', 'NULL'
+  - ddl:defaultValue (STRING)
+  - ddl:defaultPrecision (LONG)
+  - ddl:collationName (STRING)
+  + ddl:domainConstraintDefinition (ddl:tableConstraintDefinition) = ddl:tableConstraintDefinition multiple
+
+// =============================================================================
+// CREATE ASSERTION
+// =============================================================================
+[ddl:createAssertionStatement] > ddl:statement, ddl:creatable, ddl:assertionOperand mixin
+  - ddl:constraintName (STRING) mandatory
+  - ddl:searchCondition (STRING) mandatory
+  + ddl:constraintAttribute (ddl:simpleProperty) = ddl:simpleProperty multiple
+
+// =============================================================================
+// CREATE CHARACTER SET
+// =============================================================================
+[ddl:createCharacterSetStatement] > ddl:statement, ddl:creatable, ddl:characterSetOperand mixin
+  - ddl:existingName (STRING) mandatory
+  - ddl:collateClause (STRING)                      // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+  - ddl:limitedCollationDefinition (STRING)         // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+  
+// =============================================================================
+// CREATE COLLATION
+// =============================================================================
+[ddl:createCollationStatement] > ddl:statement, ddl:creatable, ddl:collationOperand mixin
+  - ddl:characterSetName (STRING) mandatory
+  - ddl:collationSource (STRING)                    // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+  - ddl:padAttribute (STRING)
+    < 'NO PAD', 'PAD SPACE'
+    
+// =============================================================================
+// CREATE TRANSLATION
+// =============================================================================
+[ddl:createTranslationStatement] > ddl:statement, ddl:creatable, ddl:translationOperand mixin
+  - ddl:sourceCharacterSetName (STRING) mandatory
+  - ddl:targetCharacterSetName (STRING) mandatory
+  - ddl:translationSource (STRING)                  // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+  
+// =============================================================================
+// ALTER TABLE
+// =============================================================================
+[ddl:alterTableStatement] > ddl:statement, ddl:alterStatement, ddl:tableOperand mixin
+  + * (ddl:addColumnDefinition)             = ddl:addColumnDefinition multiple
+  + * (ddl:dropColumnDefinition)            = ddl:dropColumnDefinition multiple
+  + * (ddl:alterColumnDefinition)           = ddl:alterColumnDefinition multiple
+  + * (ddl:addTableConstraintDefinition)    = ddl:addTableConstraintDefinition multiple
+  + * (ddl:dropTableConstraintDefinition)   = ddl:dropTableConstraintDefinition multiple
+  + * (ddl:statementOption) = ddl:statementOption multiple
+
+// =============================================================================
+// ALTER DOMAIN
+// =============================================================================
+[ddl:alterDomainStatement] > ddl:statement, ddl:alterStatement, ddl:domainOperand mixin
+  - ddl:alterDomainAction (STRING)                  // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+
+// =============================================================================
+// DROP STATEMENTS
+// =============================================================================
+[ddl:dropSchemaStatement]           > ddl:droppable, ddl:schemaOperand mixin
+[ddl:dropTableStatement]            > ddl:droppable, ddl:tableOperand mixin
+[ddl:dropViewStatement]             > ddl:droppable, ddl:viewOperand mixin
+[ddl:dropDomainStatement]           > ddl:droppable, ddl:domainOperand mixin
+[ddl:dropCharacterSetStatement]     > ddl:droppable, ddl:characterSetOperand mixin
+[ddl:dropCollationStatement]        > ddl:droppable, ddl:collationOperand mixin
+[ddl:dropTranslationStatement]      > ddl:droppable, ddl:translationOperand mixin
+[ddl:dropAssertionStatement]        > ddl:droppable, ddl:assertionOperand mixin
+
+[ddl:alterColumnDefinition]         > ddl:columnDefinition, ddl:alterable, mixin
+[ddl:addColumnDefinition]           > ddl:columnDefinition, ddl:creatable, mixin
+[ddl:dropColumnDefinition]          > ddl:columnDefinition, ddl:droppable, mixin
+[ddl:addTableConstraintDefinition]  > ddl:tableConstraintDefinition, ddl:creatable, mixin
+[ddl:dropTableConstraintDefinition] > ddl:tableConstraintDefinition, ddl:droppable, mixin
+
+// =============================================================================
+// MISC STATEMENTS
+// =============================================================================
+[ddl:setStatement] > ddl:statement, ddl:settable mixin
+   // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+   
+[ddl:insertStatement] > ddl:statement, ddl:insertable mixin
+   // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+   
+[ddl:grantStatement] > ddl:statement, ddl:grantable mixin
+   // TODO: THIS IS COMPLEX, NEED TO BREAK DOWN
+
+// =============================================================================
+// COLUMN
+// =============================================================================
+[ddl:columnDefinition] > ddl:creatable ddl:columnOperand mixin
+  - ddl:datatypeName (STRING) mandatory
+  - ddl:datatypeLength (LONG)
+  - ddl:datatypePrecision (LONG)
+  - ddl:datatypeScale (LONG)
+  - ddl:nullable (STRING)
+  - ddl:defaultOption (STRING) 
+      < 'LITERAL', 'DATETIME', 'USER', 'CURRENT_USER', 'SESSION_USER', 'SYSTEM_USER', 'NULL'
+  - ddl:defaultValue (STRING)
+  - ddl:defaultPrecision (LONG)
+  - ddl:collationName (STRING)
+  - ddl:dropBehavior (ddl:simpleProperty) = ddl:simpleProperty multiple
+  + ddl:columnAttribute (ddl:simpleProperty) = ddl:simpleProperty multiple
+
+// =============================================================================
+// TABLE CONSTRAINT
+// =============================================================================
+[ddl:tableConstraintDefinition] > ddl:creatable ddl:tableConstraintOperand mixin
+  - ddl:constraintType (STRING) mandatory
+      < 'UNIQUE', 'PRIMARY KEY', 'FOREIGN KEY', 'CHECK'
+  - ddl:deferrable (STRING)
+      < 'DEFERRABLE', 'NOT DEFERRABLE'
+  - ddl:checkSearchCondition (STRING)
+      < 'INITIALLY DEFERRED', 'INITIALLY IMMEDIATE'
+  + * (ddl:columnReference) = ddl:columnReference multiple
+  - (ddl:tableReference) = ddl:tableReference
+  + * (ddl:fkColumnReference) = ddl:fkColumnReference multiple
+  + ddl:constraintAttribute (ddl:simpleProperty) = ddl:simpleProperty multiple
+  
+// =============================================================================
+// REFERENCE
+// =============================================================================
+[ddl:columnReference] > ddl:referenceOperand mixin
+[ddl:tableReference] > ddl:referenceOperand mixin
+[ddl:fkColumnReference] > ddl:referenceOperand mixin
+
+// =============================================================================
+// SIMPLE STRING PROPERTY
+// =============================================================================
+[ddl:simpleProperty] mixin
+  - ddl:propValue (STRING) mandatory
+  
+// =============================================================================
+// DDL PROBLEM
+// =============================================================================
+[ddl:ddlProblem] mixin
+  - ddl:problemLevel (LONG) mandatory
+  - ddl:message (STRING) mandatory
+
+// =============================================================================
+// STATEMENT OPTION
+// =============================================================================
+[ddl:statementOption] mixin
+  - ddl:value (STRING) mandatory
+


Property changes on: trunk/extensions/dna-sequencer-cnd/src/test/resources/StandardDdl.cnd
___________________________________________________________________
Name: svn:executable
   + *



More information about the dna-commits mailing list