cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1196079 - in /cocoon/cocoon3/trunk/cocoon-cli/src/test: java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java resources/valid.xml
Date Tue, 01 Nov 2011 16:08:10 GMT
Author: simonetripodi
Date: Tue Nov  1 16:08:10 2011
New Revision: 1196079

URL: http://svn.apache.org/viewvc?rev=1196079&view=rev
Log:
added basic testcase to parse a valid input

Added:
    cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml   (with props)
Modified:
    cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java

Modified: cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java?rev=1196079&r1=1196078&r2=1196079&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java
Tue Nov  1 16:08:10 2011
@@ -18,11 +18,15 @@
  */
 package org.apache.cocoon.cli;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.io.File;
 import java.io.IOException;
 
 import org.junit.Test;
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
 
 public final class PipelineDescriptorParserTestCase
 {
@@ -32,12 +36,23 @@ public final class PipelineDescriptorPar
     private File testDir = new File( System.getProperty( "user.dir" ), "src/test/resources"
);
 
     // The content of element 'pipeline' is not complete. One of '{"":generator}' is expected.
-    @Test( expected = SAXException.class )
+    @Test( expected = SAXParseException.class )
     public void missingElements() throws IOException, SAXException
     {
         parser.parse( getTestFile( "missing-elements.xml" ) );
     }
 
+    @Test
+    public void validDocument() throws IOException, SAXException
+    {
+        PipelinesRegistry registry = parser.parse( getTestFile( "valid.xml" ) );
+        assertNotNull( registry.getDefaultId() );
+        assertNotNull( registry.getDefaultPipeline() );
+        assertNotNull( registry.getPipeline( "id0" ) );
+        assertNotNull( registry.getPipeline( "id1" ) );
+        assertNull( registry.getPipeline( "id2" ) );
+    }
+
     private File getTestFile( String name )
     {
         return new File( testDir, name );

Added: cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml?rev=1196079&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml (added)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml Tue Nov  1 16:08:10 2011
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<pipelines xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" default="id0">
+
+  <pipeline id="id0">
+    <generator src="${user.dir}/src/test/resources/missing-elements.xml" />
+    <serializer />
+  </pipeline>
+
+  <pipeline id="id1">
+    <generator src="${user.dir}/src/test/resources/missing-elements.xml" />
+    <serializer />
+  </pipeline>
+
+</pipelines>

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/test/resources/valid.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message