commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/jelly/jelly-tags/velocity/src/test/org/apache/commons/jelly/tags/velocity JellyContextAdapterTest.java
Date Thu, 09 Sep 2004 12:23:17 GMT
dion        2004/09/09 05:23:17

  Modified:    jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity
                        MergeTag.java VelocityTagLibrary.java
                        VelocityTagSupport.java JellyContextAdapter.java
               jelly/jelly-tags/velocity/src/test/org/apache/commons/jelly/tags/velocity
                        JellyContextAdapterTest.java
  Log:
  Fix license file whitespace
  
  Revision  Changes    Path
  1.4       +32 -32    jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/MergeTag.java
  
  Index: MergeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/MergeTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MergeTag.java	25 Feb 2004 01:31:59 -0000	1.3
  +++ MergeTag.java	9 Sep 2004 12:23:16 -0000	1.4
  @@ -2,13 +2,13 @@
   
   /*
    * Copyright 2001,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -29,15 +29,15 @@
   import java.io.StringWriter;
   import java.io.Writer;
   
  -/** 
  +/**
    * A tag that uses Velocity to render a specified template with the
    * JellyContext storing the results in either a variable in the
    * JellyContext or in a specified file.
  - * 
  + *
    * @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
    * @version $Id$
    */
  -public class MergeTag extends VelocityTagSupport 
  +public class MergeTag extends VelocityTagSupport
   {
       private static final String ENCODING = "ISO-8859-1";
   
  @@ -51,26 +51,26 @@
   
       // -- Tag interface -----------------------------------------------------
   
  -    public void doTag( final XMLOutput output ) throws JellyTagException 
  +    public void doTag( final XMLOutput output ) throws JellyTagException
       {
           if ( basedir == null || template == null )
           {
  -            throw new JellyTagException( 
  +            throw new JellyTagException(
                       "This tag must define 'basedir' and 'template'" );
           }
   
           if ( name != null )
           {
               try {
  -                Writer writer = new OutputStreamWriter( 
  -                        new FileOutputStream( name ), 
  +                Writer writer = new OutputStreamWriter(
  +                        new FileOutputStream( name ),
                           outputEncoding == null ? ENCODING : outputEncoding );
                   mergeTemplate( writer );
                   writer.close();
  -            } 
  +            }
               catch (IOException e) {
                   throw new JellyTagException(e);
  -            } 
  +            }
           }
           else if ( var != null )
           {
  @@ -78,13 +78,13 @@
               mergeTemplate( writer );
               context.setVariable( var, writer.toString() );
           }
  -        else 
  +        else
           {
  -            throw new JellyTagException( 
  +            throw new JellyTagException(
                       "This tag must define either 'name' or 'var'" );
           }
       }
  -        
  +
       // -- Properties --------------------------------------------------------
   
       /**
  @@ -93,7 +93,7 @@
        * @param var The var to set in the JellyContext with the results of
        * the merge.
        */
  -    public void setVar( String var ) 
  +    public void setVar( String var )
       {
           this.var = var;
       }
  @@ -104,15 +104,15 @@
        * @param name The name of the output file that is used to store the
        * results of the merge.
        */
  -    public void setName( String name ) 
  +    public void setName( String name )
       {
           this.name = name;
       }
   
  -    /** 
  +    /**
        * Sets the base directory used for loading of templates by the
        * Velocity file resource loader.
  -     * 
  +     *
        * @param basedir The directory where templates can be located by
        * the Velocity file resource loader.
        */
  @@ -121,10 +121,10 @@
           this.basedir = basedir;
       }
   
  -    /** 
  +    /**
        * Sets the filename of the template used to merge with the
        * JellyContext.
  -     * 
  +     *
        * @param template The filename of the template to be merged.
        */
       public void setTemplate( String template )
  @@ -132,11 +132,11 @@
           this.template = template;
       }
   
  -    /** 
  +    /**
        * Sets the read-only flag for this adapter which prevents
        * modifications in the Velocity context from propogating to the
        * JellyContext.
  -     * 
  +     *
        * @param readOnly <tt>true</tt> prevents modifications from
        * propogating (the default), or <tt>false</tt> which permits
        * modifications.
  @@ -145,7 +145,7 @@
       {
           this.readOnly = readOnly;
       }
  -    
  +
       /**
        * Sets the output encoding mode which defaults to ISO-8859-1 used
        * when storing the results of a merge in a file.
  @@ -153,7 +153,7 @@
        * @param encoding  The file encoding to use when writing the
        * output.
        */
  -    public void setOutputEncoding( String encoding ) 
  +    public void setOutputEncoding( String encoding )
       {
           this.outputEncoding = encoding;
       }
  @@ -164,7 +164,7 @@
        *
        * @param encoding  The encoding used in the template.
        */
  -    public void setInputEncoding( String encoding ) 
  +    public void setInputEncoding( String encoding )
       {
           this.inputEncoding = encoding;
       }
  @@ -183,12 +183,12 @@
           adapter.setReadOnly( readOnly );
   
           try {
  -            getVelocityEngine( basedir ).mergeTemplate( 
  +            getVelocityEngine( basedir ).mergeTemplate(
                   template,
  -                inputEncoding == null ? ENCODING : inputEncoding, 
  +                inputEncoding == null ? ENCODING : inputEncoding,
                   adapter,
                   writer );
  -        } 
  +        }
           catch (ResourceNotFoundException e) {
               throw new JellyTagException(e);
           }
  @@ -197,10 +197,10 @@
           }
           catch (MethodInvocationException e) {
               throw new JellyTagException(e);
  -        } 
  +        }
           catch (Exception e) {
               throw new JellyTagException(e);
           }
       }
   }
  -    
  +
  
  
  
  1.3       +8 -8      jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/VelocityTagLibrary.java
  
  Index: VelocityTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/VelocityTagLibrary.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VelocityTagLibrary.java	25 Feb 2004 01:31:59 -0000	1.2
  +++ VelocityTagLibrary.java	9 Sep 2004 12:23:16 -0000	1.3
  @@ -2,13 +2,13 @@
   
   /*
    * Copyright 2001,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -18,15 +18,15 @@
   
   import org.apache.commons.jelly.TagLibrary;
   
  -/** 
  - * Describes the Taglib. This class could be generated by XDoclet 
  +/**
  + * Describes the Taglib. This class could be generated by XDoclet
    *
    * @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
    * @version $Id$
    */
  -public class VelocityTagLibrary extends TagLibrary 
  +public class VelocityTagLibrary extends TagLibrary
   {
  -    public VelocityTagLibrary() 
  +    public VelocityTagLibrary()
       {
           registerTag( "merge", MergeTag.class );
       }
  
  
  
  1.4       +13 -13    jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/VelocityTagSupport.java
  
  Index: VelocityTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/VelocityTagSupport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VelocityTagSupport.java	25 Feb 2004 01:31:59 -0000	1.3
  +++ VelocityTagSupport.java	9 Sep 2004 12:23:16 -0000	1.4
  @@ -2,13 +2,13 @@
   
   /*
    * Copyright 2001,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -20,13 +20,13 @@
   import org.apache.commons.jelly.TagSupport;
   import org.apache.velocity.app.VelocityEngine;
   
  -/** 
  +/**
    * Support methods for the Velocity tag library.  Currently this is only
    * used to get an instance of the VelocityEngine.  For each unique base
    * directory specified, a new VelocityEngine instance is stored in the
    * context (as the author hasn't figured out how to change the resource
    * loader of an already init'd VelocityEngine).
  - * 
  + *
    * @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
    * @version $Id$
    */
  @@ -36,16 +36,16 @@
       public static final String VELOCITY_ENGINE_VAR_NAME =
               "org.apache.maven.jelly.tags.velocity.VelocityEngine";
   
  -    /** 
  +    /**
        * Gets or creates a VelocityEngine if one doesn't already exist for
  -     * the specified base directory.  
  -     * 
  +     * the specified base directory.
  +     *
        * @return A VelocityEngine with a file resource loader configured
        * for the specified base directory.
        */
       public VelocityEngine getVelocityEngine( String basedir ) throws JellyTagException
       {
  -        VelocityEngine ve = ( VelocityEngine ) getContext().getVariable( 
  +        VelocityEngine ve = ( VelocityEngine ) getContext().getVariable(
                   keyName( basedir ) );
   
           if ( ve == null )
  @@ -53,7 +53,7 @@
               ve = new VelocityEngine();
               ve.setProperty( VelocityEngine.RUNTIME_LOG_LOGSYSTEM, this );
               ve.setProperty( VelocityEngine.FILE_RESOURCE_LOADER_PATH, basedir );
  -            
  +
               try {
                   ve.init();
               }
  @@ -67,10 +67,10 @@
           return ve;
       }
   
  -    /** 
  +    /**
        * Constructs the name of the key used to reference the
        * VelocityEngine for the specified base directory.
  -     * 
  +     *
        * @param basedir The base directory used by the VelocityEngine
        * @return The key used to reference the VelocityEngine that has
        * been initialized with the specified base directory.
  
  
  
  1.4       +11 -11    jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/JellyContextAdapter.java
  
  Index: JellyContextAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/velocity/src/java/org/apache/commons/jelly/tags/velocity/JellyContextAdapter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JellyContextAdapter.java	25 Feb 2004 01:31:59 -0000	1.3
  +++ JellyContextAdapter.java	9 Sep 2004 12:23:16 -0000	1.4
  @@ -2,13 +2,13 @@
   
   /*
    * Copyright 2001,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -23,7 +23,7 @@
   import org.apache.commons.jelly.JellyContext;
   import org.apache.velocity.context.Context;
   
  -/** 
  +/**
    * Adapts a JellyContext for use as a Velocity Context.  This context
    * can be used in either read-only or read-write mode.  When used as a
    * read-only adapter, items <tt>put</tt> or <tt>remove</tt>ed from
the
  @@ -31,7 +31,7 @@
    * which is the default behavior.  The adapter can also be used in a
    * read-write mode.  This permits changes made by Velocity to propogate
    * to the JellyContext.
  - * 
  + *
    * @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
    * @version $Id$
    */
  @@ -46,21 +46,21 @@
       /** The store for Velocity in the event the adpater is read-only */
       private HashMap privateContext = new HashMap();
   
  -    /** 
  +    /**
        * Constructor.
  -     * 
  +     *
        * @param jellyContext The JellyContext to adapt
        */
       public JellyContextAdapter( JellyContext jellyContext )
       {
           this.jellyContext = jellyContext;
       }
  -    
  +
       /**
        * Sets the read-only flag for this adapter.  If the read-only flag
        * is set, changes to the Velocity Context will not be propogated to
        * the JellyContext.  Turning the read-only flag off enables changes
  -     * to propogate.  
  +     * to propogate.
        *
        * @param readOnly If this parameter is <tt>true</tt>, the adapter
        * becomes read-only.  Setting the parameter to <tt>false</tt> the
  @@ -70,7 +70,7 @@
       {
           this.readOnly = readOnly;
       }
  -    
  +
       /**
        * Tests if the adapter is read-only.
        *
  
  
  
  1.3       +20 -20    jakarta-commons/jelly/jelly-tags/velocity/src/test/org/apache/commons/jelly/tags/velocity/JellyContextAdapterTest.java
  
  Index: JellyContextAdapterTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/velocity/src/test/org/apache/commons/jelly/tags/velocity/JellyContextAdapterTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JellyContextAdapterTest.java	25 Feb 2004 01:32:00 -0000	1.2
  +++ JellyContextAdapterTest.java	9 Sep 2004 12:23:17 -0000	1.3
  @@ -2,13 +2,13 @@
   
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -61,7 +61,7 @@
           adapter = new JellyContextAdapter( jellyContext );
       }
   
  -    /** 
  +    /**
        * Test the behavior of null keys.
        */
       public void testNullKey()
  @@ -72,7 +72,7 @@
           assertTrue( adapter.get( null ) == null );
       }
   
  -    /** 
  +    /**
        * Test the behavior of null values.
        */
       public void testNullValue()
  @@ -83,7 +83,7 @@
           assertTrue( adapter.get( "key" ) == null );
       }
   
  -    /** 
  +    /**
        * Test that items can be added and retrieved from a read-write
        * adpater.  Also verify the key/value pair was actually inserted
        * into the JellyContext.
  @@ -102,7 +102,7 @@
                   jellyContext.getVariable( "key" ) == value );
       }
   
  -    /** 
  +    /**
        * Test that items can be added and retrieved from a read-only
        * adapter.  Also verify the key/value pair was not inserted into
        * the JellyContext.
  @@ -121,7 +121,7 @@
                   jellyContext.getVariable( "key" ) == null );
       }
   
  -    /** 
  +    /**
        * Test that items can be removed from a read-write context.  Also
        * verify that the item is removed from the JellyContext.
        */
  @@ -146,7 +146,7 @@
                   adapter.remove( "non-existent key" ) == null );
       }
   
  -    /** 
  +    /**
        * Test that items can be removed from a read-only context.  Also
        * verify that the JellyContext is not impacted by removal of keys.
        */
  @@ -159,20 +159,20 @@
   
           Object oldValue = adapter.remove( "key" );
   
  -        assertTrue( "Value returned from remove() is not the original", 
  +        assertTrue( "Value returned from remove() is not the original",
                   value == oldValue );
   
           assertTrue( "adapter: after removal of key, value should be null",
                   adapter.get( "key" ) == null );
   
  -        assertTrue( "jellyContext: value should not be affected.", 
  +        assertTrue( "jellyContext: value should not be affected.",
                   jellyContext.getVariable( "key" ) == null );
   
           assertTrue( "Removal of non-existent key should return null",
                   adapter.remove( "non-existent key" ) == null );
       }
   
  -    /** 
  +    /**
        * Test that items can shadow or hide items in the JellyContext.
        * Removal of a key in the private context will unveil the key in
        * the JellyContext if it exists.
  @@ -194,11 +194,11 @@
           assertTrue( "adapter: after removal of key, value should be 2",
                   adapter.get( "key" ) == value2 );
   
  -        assertTrue( "jellyContext: value should not be affected.", 
  +        assertTrue( "jellyContext: value should not be affected.",
                   jellyContext.getVariable( "key" ) == value2 );
       }
   
  -    /** 
  +    /**
        * Test the containsKey method in a read-write adapter.
        */
       public void testReadWriteContainsKey()
  @@ -220,7 +220,7 @@
                   jellyContext.getVariable( "key1" ) != null );
       }
   
  -    /** 
  +    /**
        * Test the containsKey method in a read-only adapter.
        */
       public void testReadOnlyContainsKey()
  @@ -242,7 +242,7 @@
                   jellyContext.getVariable( "key1" ) == null );
       }
   
  -    /** 
  +    /**
        * Test the getKeys method of a read-write adapter.
        */
       public void testReadWriteGetKeys()
  @@ -260,7 +260,7 @@
           expectedKeys.add( "key1" );
           expectedKeys.add( "key2" );
           expectedKeys.add( "key3" );
  -        
  +
           Set actualKeys = new HashSet();
           CollectionUtils.addAll(actualKeys, adapter.getKeys());
   
  @@ -268,7 +268,7 @@
                   actualKeys.containsAll( expectedKeys ) );
       }
   
  -    /** 
  +    /**
        * Test the getKeys method of a read-only adapter.
        */
       public void testReadOnlyGetKeys()
  @@ -285,7 +285,7 @@
           Set expectedKeys = new HashSet();
           expectedKeys.add( "key1" );
           expectedKeys.add( "key2" );
  -        
  +
           Set actualKeys = new HashSet();
           CollectionUtils.addAll(actualKeys, adapter.getKeys());
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message