maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r373246 - in /maven/maven-1/plugins/trunk/javacc/src: main/org/apache/maven/javacc/ test/org/apache/maven/javacc/
Date Sat, 28 Jan 2006 21:11:38 GMT
Author: ltheussl
Date: Sat Jan 28 13:11:33 2006
New Revision: 373246

URL: http://svn.apache.org/viewcvs?rev=373246&view=rev
Log:
Code reformatting, javadoc fixes, package.html.

Added:
    maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/package.html   (with
props)
    maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/package.html   (with
props)
Modified:
    maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/BaseBean.java
    maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JJTreeBean.java
    maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JavaccBean.java
    maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/BaseBeanTest.java
    maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JJTreeBeanTest.java
    maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JavaccBeanTest.java

Modified: maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/BaseBean.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/BaseBean.java?rev=373246&r1=373245&r2=373246&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/BaseBean.java (original)
+++ maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/BaseBean.java Sat
Jan 28 13:11:33 2006
@@ -16,14 +16,15 @@
  *   limitations under the License.
  * ====================================================================
  */
- 
+
+
 import java.io.File;
-import org.codehaus.plexus.util.FileUtils;
 
+import org.codehaus.plexus.util.FileUtils;
 
 /**
- * 
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
+ *
+ * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  * @version $Id$
  */
 public class BaseBean
@@ -33,15 +34,12 @@
 
     /** the name of the java package which will contain generated files */
     private String javaccPackageName;
-    
     private String jjtreePackageName;
-    
-    private String header ;
-    
+    private String header;
     private String generatedSourceDirectory;
 
     /**
-     * Returns grammar file (javacc of jjtree grammar) 
+     * Returns grammar file (javacc of jjtree grammar)
      * @return grammar file
      */
     public String getGrammar()
@@ -60,14 +58,14 @@
 
     /**
      * Sets the name of the java package which will contain generated files
-     * 
-     * @param packageName the name of java package e.g com.wombat.parser.ast
+     *
+     * @param javaccPackageName the name of java package e.g com.wombat.parser.ast
      */
     public void setJavaccPackageName( final String javaccPackageName )
     {
         this.javaccPackageName = javaccPackageName;
     }
-    
+
     /**
      * @return Returns the header.
      */
@@ -75,6 +73,7 @@
     {
         return header;
     }
+
     /**
      * @param header The header to set.
      */
@@ -82,62 +81,60 @@
     {
         this.header = header;
     }
-    
-    
-    
+
     /**
-     * 
-     * @return
+     *
+     * @return File
      */
     public File getJavaccOutputDir()
     {
-        final String packagePath = javaccPackageName.replace( '.', File.separatorChar);
-        
+        final String packagePath =
+            javaccPackageName.replace( '.', File.separatorChar );
+
         return new File( generatedSourceDirectory, packagePath );
     }
-    
+
     /**
-     * 
-     * @return
+     *
+     * @return File
      */
     public File getJJTreeOutputDir()
     {
-        
-        final String packagePath = jjtreePackageName.replace( '.', File.separatorChar);
-        
+        final String packagePath =
+            jjtreePackageName.replace( '.', File.separatorChar );
+
         return new File( generatedSourceDirectory, packagePath );
     }
-    
-    
+
     /**
-     * 
+     *
      * @throws Exception
      */
-    protected void addHeader( final File directory ) throws Exception
+    protected void addHeader( final File directory )
+        throws Exception
     {
-        
         final File headerFile = new File( getHeader() );
-        
+
         if ( headerFile.exists() )
         {
-            final String headerContent = getHeaderContent( );
-            
-            final File[] generatedFiles = directory.listFiles( );
-            
+            final String headerContent = getHeaderContent();
+
+            final File[] generatedFiles = directory.listFiles();
+
             for ( int i = 0; i < generatedFiles.length; i++ )
             {
                 final File generatedFile = generatedFiles[i];
-            
+
                 addHeader( generatedFile, headerContent );
             }
         }
     }
+
     /**
-     * 
-     * @param headerFile
-     * @return
+     *
+     * @return String
      */
-    protected String getHeaderContent(  )
+    protected String getHeaderContent()
     {
         try
         {
@@ -148,61 +145,58 @@
             return null;
         }
     }
-    
+
     /**
-     * 
+     *
      * @param file
-     * @param header
+     * @param headerContent
      * @throws Exception
      */
     protected void addHeader( final File file, final String headerContent )
-            throws Exception
+        throws Exception
     {
-        if (! file.getName().endsWith(".java") )
+        if ( !file.getName().endsWith( ".java" ) )
         {
-           return;
-        }    
+            return;
+        }
+
         String content = FileUtils.fileRead( file.getCanonicalPath() );
-        
+
         content = headerContent + content;
-        
+
         FileUtils.fileWrite( file.getCanonicalPath(), content );
     }
-    
-    public void createTimestampFile( final long timestamp, final File directory ) throws
Exception
+
+    public void createTimestampFile( final long timestamp, final File directory )
+        throws Exception
     {
-        final File timestampFile = new File( directory, ".timestamp" ); 
-        
+        final File timestampFile = new File( directory, ".timestamp" );
+
         FileUtils.fileWrite( timestampFile.getAbsolutePath(), "" + timestamp );
     }
-    
+
     public long readTimestampFile( final File directory )
     {
         return 0;
     }
-    
-    public boolean checkTimestamp() throws Exception
-    {
-//        final File outputDir = getOutputDir();
-
-//        final File grammarFile = new File ( getGrammar() ).getCanonicalFile();
 
-//        final File timestampFile = new File( outputDir, ".timestamp" );   
-
-//        if ( timestampFile.exists() )
-//        {
-
-//            long oldTimestamp = readTimestampFile( outputDir );            
-
-//            if ( oldTimestamp < grammarFile.lastModified() )
-//            {
-//                return false;
-//            }    
-//        }        
+    public boolean checkTimestamp()
+        throws Exception
+    {
+        //        final File outputDir = getOutputDir();
+        //        final File grammarFile = new File ( getGrammar() ).getCanonicalFile();
+        //        final File timestampFile = new File( outputDir, ".timestamp" );
+        //        if ( timestampFile.exists() )
+        //        {
+        //            long oldTimestamp = readTimestampFile( outputDir );
+        //            if ( oldTimestamp < grammarFile.lastModified() )
+        //            {
+        //                return false;
+        //            }
+        //        }
         return true;
     }
-    
-    
+
     /**
      * @return Returns the jjtreePackageName.
      */
@@ -210,6 +204,7 @@
     {
         return jjtreePackageName;
     }
+
     /**
      * @param jjtreePackageName The jjtreePackageName to set.
      */
@@ -217,15 +212,14 @@
     {
         this.jjtreePackageName = jjtreePackageName;
     }
-    
-    
+
     public String getGeneratedSourceDirectory()
     {
-        return generatedSourceDirectory;	
+        return generatedSourceDirectory;
     }
-    
+
     public void setGeneratedSourceDirectory( final String generatedSourceDirectory )
     {
-        this.generatedSourceDirectory = generatedSourceDirectory;	
+        this.generatedSourceDirectory = generatedSourceDirectory;
     }
 }

Modified: maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JJTreeBean.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JJTreeBean.java?rev=373246&r1=373245&r2=373246&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JJTreeBean.java (original)
+++ maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JJTreeBean.java Sat
Jan 28 13:11:33 2006
@@ -18,89 +18,95 @@
  */
 
 import java.io.File;
+
 import java.util.ArrayList;
 
 import org.javacc.jjtree.JJTree;
 
 /**
- * 
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
+ *
+ * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  * @version $Id$
  */
 public class JJTreeBean extends BaseBean
 {
-    
     /**
      * Generates AST and javacc grammar
-     * @return
-     * @throws Exception
+     * @return The value returned by org.javacc.jjtree.JJTree.main( String[] )
+     * @throws Exception Exception
      */
     public int generate() throws Exception
-    {                                               
+    {
         final ArrayList params = new ArrayList();
-        
+
         final File outputDir = getJJTreeOutputDir();
-        
-        System.err.println("-OUTPUT_DIRECTORY=" + outputDir.getCanonicalPath());
-        
+
+        System.err.println( "-OUTPUT_DIRECTORY="
+            + outputDir.getCanonicalPath() );
+
         final long timestamp = System.currentTimeMillis();
-        
-        System.err.println( "Creating directory: " + outputDir.getCanonicalPath() );
-        
+
+        System.err.println( "Creating directory: "
+            + outputDir.getCanonicalPath() );
+
         if ( !outputDir.exists() )
-        {                
-            
-            System.out.println( "Creating directorty: " + outputDir.getAbsolutePath() );
-            
-            outputDir.mkdirs();            
+        {
+            System.out.println( "Creating directorty: "
+                + outputDir.getAbsolutePath() );
+
+            outputDir.mkdirs();
         }
         else
         {
             if ( !checkTimestamp() )
             {
                 return 0;
-            }    
-        }           
-        params.add( "-OUTPUT_DIRECTORY=" + outputDir.getCanonicalPath() );        
-        
+            }
+        }
+
+        params.add( "-OUTPUT_DIRECTORY=" + outputDir.getCanonicalPath() );
+
         params.add( getGrammar() );
-        
-        String[] args = ( String[] ) params.toArray( new String[ params.size() ] );     
  
-        
+
+        String[] args =
+            (String[]) params.toArray( new String[params.size()] );
+
         final JJTree jjtree = new JJTree();
-        
-        final int retValue = jjtree.main( args );  
-        
-        moveJJTJavaParserState( );
-        
+
+        final int retValue = jjtree.main( args );
+
+        moveJJTJavaParserState();
+
         //addHeader( outputDir );
-        
         createTimestampFile( timestamp, outputDir );
-        
+
         return retValue;
     }
-    
+
     /**
-     * 
+     *
      */
-    private void moveJJTJavaParserState( )
-    {     
-        final File  jjtJavaParserStateFileOrg = new File( getJJTreeOutputDir() , "JJTJavaParserState.java"
);
-        
-        final File  jjtJavaParserStateFileNew = new File( getJavaccOutputDir() , "JJTJavaParserState.java"
);
-        
-        if ( ! jjtJavaParserStateFileOrg.equals( jjtJavaParserStateFileNew ) )
-        {    
-	    final File dir  = jjtJavaParserStateFileNew.getParentFile(); 
-	    
-	    if ( !dir.exists() )
-	    {
-	       dir.mkdirs();
-	    }    
-	    
-	    System.out.println("Moving: " + jjtJavaParserStateFileOrg +" to: " + jjtJavaParserStateFileNew
);
-	    
-	    jjtJavaParserStateFileOrg.renameTo( jjtJavaParserStateFileNew );
+    private void moveJJTJavaParserState()
+    {
+        final File jjtJavaParserStateFileOrg =
+            new File( getJJTreeOutputDir(), "JJTJavaParserState.java" );
+
+        final File jjtJavaParserStateFileNew =
+            new File( getJavaccOutputDir(), "JJTJavaParserState.java" );
+
+        if ( !jjtJavaParserStateFileOrg.equals( jjtJavaParserStateFileNew ) )
+        {
+            final File dir = jjtJavaParserStateFileNew.getParentFile();
+
+            if ( !dir.exists() )
+            {
+                dir.mkdirs();
+            }
+
+            System.out.println( "Moving: " + jjtJavaParserStateFileOrg
+                + " to: " + jjtJavaParserStateFileNew );
+
+            jjtJavaParserStateFileOrg.renameTo( jjtJavaParserStateFileNew );
         }
     }
 
@@ -109,19 +115,16 @@
      * @return the path to generated javacc grammar
      */
     public String getJavaccGrammar()
-    {                 
-         final File grammarFile = new File ( getGrammar() );   
-               
-         
-         String grammarName =  grammarFile.getName();
-         
-         grammarName =  grammarName.substring( 0, grammarName.length()-1 );        
-         
-         final String retValue = getJJTreeOutputDir() + File.separator +  grammarName ; 
      
-         
-         return retValue;
+    {
+        final File grammarFile = new File( getGrammar() );
+
+        String grammarName = grammarFile.getName();
+
+        grammarName = grammarName.substring( 0, grammarName.length() - 1 );
+
+        final String retValue =
+            getJJTreeOutputDir() + File.separator + grammarName;
+
+        return retValue;
     }
-    
-    
-        
 }

Modified: maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JavaccBean.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JavaccBean.java?rev=373246&r1=373245&r2=373246&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JavaccBean.java (original)
+++ maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/JavaccBean.java Sat
Jan 28 13:11:33 2006
@@ -17,44 +17,45 @@
  * ====================================================================
  */
 
-import org.javacc.parser.Main;
-
 import java.io.File;
+
 import java.util.ArrayList;
 
+import org.javacc.parser.Main;
+
 /**
- * 
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
+ *
+ * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  * @version $Id$
  */
 public class JavaccBean extends BaseBean
 {
-    
-
+    /**
+     * Generates javacc grammar
+     * @return The value returned by org.javacc.parser.Main.mainProgram( String[] )
+     * @throws Exception Exception
+     */
     public int generate() throws Exception
     {
         final ArrayList params = new ArrayList();
-        
+
         final File outputDir = getJavaccOutputDir();
-        
+
         if ( !outputDir.exists() )
-        {                
-            
+        {
             outputDir.mkdirs();
         }
-        
-        params.add( "-OUTPUT_DIRECTORY=" + outputDir.getCanonicalPath() );        
-        
+
+        params.add( "-OUTPUT_DIRECTORY=" + outputDir.getCanonicalPath() );
+
         params.add( getGrammar() );
-        
-        String[] args = ( String[] ) params.toArray( new String[ params.size() ] );
-        
+
+        String[] args =
+            (String[]) params.toArray( new String[params.size()] );
+
         final int retValue = Main.mainProgram( args );
-        
+
         //addHeader( outputDir );
-        
         return retValue;
     }
-    
-
 }

Added: maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/package.html
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/package.html?rev=373246&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/package.html (added)
+++ maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/package.html Sat Jan
28 13:11:33 2006
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>org.apache.maven.javacc</title>
+  </head>
+  <body>
+    <p>
+      Utility classes for generating AST and javacc grammar.
+    </p>
+  </body>
+</html>

Propchange: maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-1/plugins/trunk/javacc/src/main/org/apache/maven/javacc/package.html
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/BaseBeanTest.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/BaseBeanTest.java?rev=373246&r1=373245&r2=373246&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/BaseBeanTest.java
(original)
+++ maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/BaseBeanTest.java
Sat Jan 28 13:11:33 2006
@@ -17,45 +17,52 @@
  * ====================================================================
  */
 
+
 import java.io.File;
+
 import junit.framework.TestCase;
 
 /**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
- * @version $Id$ 
+ * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
+ * @version $Id$
  */
 public class BaseBeanTest extends TestCase
 {
     public void testBaseBean()
-    {                               	
+    {
         final BaseBean bean = new BaseBean();
-        
+
         final String grammar = "foo/baa/grammar.txt";
-        
-        bean.setGrammar( grammar);
-        
-        assertEquals( "Grammar file was not set correctly ", grammar, bean.getGrammar());
-        
-        bean.setJavaccPackageName( "com.wombat.javacc");
-        
+
+        bean.setGrammar( grammar );
+
+        assertEquals( "Grammar file was not set correctly ", grammar,
+            bean.getGrammar() );
+
+        bean.setJavaccPackageName( "com.wombat.javacc" );
+
         final String fs = File.separator;
-        
+
         final String basedir = System.getProperty( "basedir" );
-        
-        final String gsd = basedir + fs +  "target" + fs + "generated-src" + fs + "main"
+ fs +  "java" ;
-        
+
+        final String gsd =
+            basedir + fs + "target" + fs + "generated-src" + fs + "main" + fs
+            + "java";
+
         bean.setGeneratedSourceDirectory( gsd );
-                
-        final String javaccPath = gsd + fs + "com" + fs + "wombat" + fs + "javacc";     
         
-        
-        assertEquals( "Output dir not was set correctly", javaccPath, bean.getJavaccOutputDir().getPath()
);
-        
-        bean.setJjtreePackageName( "com.wombat.jjtree");
-                        
-        final String jjtreePath = gsd + fs + "com" + fs + "wombat" + fs + "jjtree";     
         
-        
-        assertEquals( "Output dir not was set correctly", jjtreePath, bean.getJJTreeOutputDir().getPath()
);
-        
+
+        final String javaccPath =
+            gsd + fs + "com" + fs + "wombat" + fs + "javacc";
+
+        assertEquals( "Output dir not was set correctly", javaccPath,
+            bean.getJavaccOutputDir().getPath() );
+
+        bean.setJjtreePackageName( "com.wombat.jjtree" );
+
+        final String jjtreePath =
+            gsd + fs + "com" + fs + "wombat" + fs + "jjtree";
+
+        assertEquals( "Output dir not was set correctly", jjtreePath,
+            bean.getJJTreeOutputDir().getPath() );
     }
-    
 }

Modified: maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JJTreeBeanTest.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JJTreeBeanTest.java?rev=373246&r1=373245&r2=373246&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JJTreeBeanTest.java
(original)
+++ maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JJTreeBeanTest.java
Sat Jan 28 13:11:33 2006
@@ -17,66 +17,69 @@
  * ====================================================================
  */
 
-import junit.framework.TestCase;
-
 import java.io.File;
+
 import java.util.Arrays;
 import java.util.List;
 
+import junit.framework.TestCase;
+
 import org.codehaus.plexus.util.FileUtils;
 
 /**
- * 
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
+ *
+ * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  * @version $Id$
  */
 public class JJTreeBeanTest extends TestCase
 {
     public void testGenerate()
     {
-        
         final String basedir = System.getProperty( "basedir" );
-        
-        final File grammarFile = new File( basedir, "src/test-data/JJTreeSample.jjt" );
-        
-        final File headerFile = new File( basedir, "src/test-data/JJTreeSample.jjt.header"
);
-        
+
+        final File grammarFile =
+            new File( basedir, "src/test-data/JJTreeSample.jjt" );
+
+        final File headerFile =
+            new File( basedir, "src/test-data/JJTreeSample.jjt.header" );
+
         final JJTreeBean bean = new JJTreeBean();
-        
-        bean.setGrammar( grammarFile.getAbsolutePath() );    
-        
+
+        bean.setGrammar( grammarFile.getAbsolutePath() );
+
         bean.setHeader( headerFile.getAbsolutePath() );
-        
-        final String packageName = "org.apache.maven.javacc.jtree";       
-        
+
+        final String packageName = "org.apache.maven.javacc.jtree";
+
         final String fs = File.separator;
-        
-        final String gsd = basedir + fs +  "target" + fs + "generated-src" + fs + "main"
+ fs +  "java" ; 
-        
+
+        final String gsd =
+            basedir + fs + "target" + fs + "generated-src" + fs + "main" + fs
+            + "java";
+
         bean.setGeneratedSourceDirectory( gsd );
-        
+
         bean.setJjtreePackageName( packageName );
-        
+
         bean.setJavaccPackageName( packageName );
-        
+
         try
         {
             FileUtils.deleteDirectory( bean.getJJTreeOutputDir() );
-            
+
             bean.generate();
         }
         catch ( Exception e )
         {
             e.printStackTrace();
-            
+
             fail( "Generation failed" );
-         
         }
-        final String[] fileNames = bean.getJJTreeOutputDir().list(); 
-        
+
+        final String[] fileNames = bean.getJJTreeOutputDir().list();
+
         final List list = Arrays.asList( fileNames );
-        
+
         assertTrue( list.contains( "JJTreeSample.jj" ) );
     }
-
 }

Modified: maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JavaccBeanTest.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JavaccBeanTest.java?rev=373246&r1=373245&r2=373246&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JavaccBeanTest.java
(original)
+++ maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/JavaccBeanTest.java
Sat Jan 28 13:11:33 2006
@@ -17,70 +17,70 @@
  * ====================================================================
  */
 
+
 import junit.framework.TestCase;
 
+import org.codehaus.plexus.util.FileUtils;
+
 import java.io.File;
+
 import java.util.Arrays;
 import java.util.List;
 
-import org.codehaus.plexus.util.FileUtils;
-
 /**
- * 
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
+ *
+ * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  * @version $Id$
  */
 public class JavaccBeanTest extends TestCase
 {
     public void testGenerate()
     {
-        
         final String basedir = System.getProperty( "basedir" );
-        
-        final File grammarFile = new File( basedir, "src/test-data/JavaCCSample.jj" );
-                
-        final File headerFile = new File( basedir, "src/test-data/JavaCCSample.jj.header"
);
-        
+
+        final File grammarFile =
+            new File( basedir, "src/test-data/JavaCCSample.jj" );
+
+        final File headerFile =
+            new File( basedir, "src/test-data/JavaCCSample.jj.header" );
+
         final JavaccBean bean = new JavaccBean();
-        
+
         bean.setGrammar( grammarFile.getAbsolutePath() );
-        
+
         bean.setHeader( headerFile.getAbsolutePath() );
-        
+
         final String fs = File.separator;
-        
-        final String gsd = basedir + fs +  "target" + fs + "generated-src" + fs + "main"
+ fs +  "java" ; 
-        
+
+        final String gsd =
+            basedir + fs + "target" + fs + "generated-src" + fs + "main" + fs
+            + "java";
+
         bean.setGeneratedSourceDirectory( gsd );
-        
-        final String packageName = "org.apache.maven.javacc.javacc";       
-        
-        bean.setJavaccPackageName( packageName );        
-        
+
+        final String packageName = "org.apache.maven.javacc.javacc";
+
+        bean.setJavaccPackageName( packageName );
+
         try
         {
             FileUtils.deleteDirectory( bean.getJavaccOutputDir() );
-            
+
             bean.generate();
-            
-        } 
+        }
         catch ( Exception e )
         {
             e.printStackTrace();
-            
+
             fail( "Generation failed" );
-            
         }
-        final String[] fileNames = bean.getJavaccOutputDir().list();        
-        
-        final List list = Arrays.asList( fileNames );
-        
-        assertTrue( list.contains( "Simple1.java" ));
-        
-        assertTrue( list.contains( "Token.java" ));
 
+        final String[] fileNames = bean.getJavaccOutputDir().list();
 
-    }
+        final List list = Arrays.asList( fileNames );
 
+        assertTrue( list.contains( "Simple1.java" ) );
 
+        assertTrue( list.contains( "Token.java" ) );
+    }
 }

Added: maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/package.html
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/package.html?rev=373246&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/package.html (added)
+++ maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/package.html Sat Jan
28 13:11:33 2006
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>org.apache.maven.javacc</title>
+  </head>
+  <body>
+    <p>
+      Test classes for org.apache.maven.javacc.
+    </p>
+  </body>
+</html>

Propchange: maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-1/plugins/trunk/javacc/src/test/org/apache/maven/javacc/package.html
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message