incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vin...@apache.org
Subject cvs commit: incubator-altrmi/integrationtests/src/test/org/apache/altrmi/test/async AbstractSimpleAsyncTestCase.java SimpleAsync2TestCase.java
Date Sun, 31 Aug 2003 11:07:43 GMT
vinayc      2003/08/31 04:07:43

  Modified:    integrationtests/src/test/org/apache/altrmi/test/async
                        AbstractSimpleAsyncTestCase.java
                        SimpleAsync2TestCase.java
  Log:
  Testcases now externally fetches the output directories to push dynamically generated classes
  
  Revision  Changes    Path
  1.2       +36 -5     incubator-altrmi/integrationtests/src/test/org/apache/altrmi/test/async/AbstractSimpleAsyncTestCase.java
  
  Index: AbstractSimpleAsyncTestCase.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/integrationtests/src/test/org/apache/altrmi/test/async/AbstractSimpleAsyncTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractSimpleAsyncTestCase.java	28 Aug 2003 18:18:40 -0000	1.1
  +++ AbstractSimpleAsyncTestCase.java	31 Aug 2003 11:07:43 -0000	1.2
  @@ -53,6 +53,7 @@
    * <http://www.apache.org/>.
    */
   package org.apache.altrmi.test.async;
  +import java.io.File;
   
   import junit.framework.TestCase;
   import org.apache.altrmi.client.Factory;
  @@ -82,18 +83,48 @@
   
       protected abstract AbstractDynamicGeneratorClassRetriever getAbstractDynamicGeneratorClassRetriever(ClassLoader
cl);
   
  +    /**
  +     * Fetch the directory to store the classes and java source generated by the dynamic
class retrievers
  +     */
  +    private String getClassGenDir()
  +    {
  +        String class_gen_dir = System.getProperty("CLASS_GEN_DIR");
  +        if( class_gen_dir == null  )
  +        {
  +            // (if not set, it defaults to current directory)
  +            class_gen_dir=".";
  +        }
  +        else
  +        {
  +            //if the directory doesnt exist and it cannot be created then use the default
  +            File fileClassGenDir= new File(class_gen_dir);
  +            if( !fileClassGenDir.exists() )
  +            {
  +                boolean bDirCreated= fileClassGenDir.mkdirs();
  +                if(!bDirCreated)
  +                {
  +                    class_gen_dir=".";
  +                }
  +            }
  +        }
  +        return class_gen_dir;
  +    }
  +
       protected void setUp() throws Exception
       {
           super.setUp();
   
           // server side setup.
  -//        JavacDynamicGeneratorClassRetriever cr = new JavacDynamicGeneratorClassRetriever(
  -//                this.getClass().getClassLoader());
           AbstractDynamicGeneratorClassRetriever cr = getAbstractDynamicGeneratorClassRetriever(
                   this.getClass().getClassLoader());
  -        cr.setClassGenDir(".");
  -        cr.setClasspath("..\\build\\classes;%JAVA_HOME%\\lib\\tools.jar");
  -        cr.setSrcGenDir(".");
  +        
  +        // Fetch the dir to place the generated classes from the System properties
  +        String class_gen_dir= getClassGenDir();
  +
  +        cr.setClassGenDir(class_gen_dir);
  +        cr.setSrcGenDir(class_gen_dir);
  +        //cr.setClasspath("..\\build\\classes;%JAVA_HOME%\\lib\\tools.jar"); // not need
since these are set by parent classloader
  +        
           DefaultServerSideClientContextFactory ccf = new DefaultServerSideClientContextFactory();
           server = new CompleteSocketCustomStreamServer(cr,
                   new DefaultAuthenticator(),
  
  
  
  1.2       +33 -3     incubator-altrmi/integrationtests/src/test/org/apache/altrmi/test/async/SimpleAsync2TestCase.java
  
  Index: SimpleAsync2TestCase.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/integrationtests/src/test/org/apache/altrmi/test/async/SimpleAsync2TestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleAsync2TestCase.java	28 Aug 2003 18:18:40 -0000	1.1
  +++ SimpleAsync2TestCase.java	31 Aug 2003 11:07:43 -0000	1.2
  @@ -80,7 +80,33 @@
       {
           super(name);
       }
  -
  +    
  +    /**
  +     * Fetch the directory to store the classes and java source generated by the dynamic
class retrievers
  +     */
  +    private String getClassGenDir()
  +    {
  +        String class_gen_dir = System.getProperty("CLASS_GEN_DIR");
  +        if( class_gen_dir == null  )
  +        {
  +            // (if not set, it defaults to current directory)
  +            class_gen_dir=".";
  +        }
  +        else
  +        {
  +            //if the directory doesnt exist and it cannot be created then use the default
  +            File fileClassGenDir= new File(class_gen_dir);
  +            if( !fileClassGenDir.exists() )
  +            {
  +                boolean bDirCreated= fileClassGenDir.mkdirs();
  +                if(!bDirCreated)
  +                {
  +                    class_gen_dir=".";
  +                }
  +            }
  +        }
  +        return class_gen_dir;
  +    }
       protected void setUp() throws Exception
       {
           super.setUp();
  @@ -88,7 +114,10 @@
           // server side setup.
           JavacDynamicGeneratorClassRetriever cr = new JavacDynamicGeneratorClassRetriever(
                   this.getClass().getClassLoader());
  -        cr.setClassGenDir(".");
  +        String class_gen_dir=getClassGenDir();
  +        cr.setClassGenDir(class_gen_dir);
  +        cr.setSrcGenDir(class_gen_dir);
  +        /*<reason>ClassLoader picks the stuff from the parent classloader which has
everything it needs
           String FS = File.separator;
           String PS = File.pathSeparator;
   
  @@ -100,7 +129,8 @@
           }
           System.out.println("javaHome=" + javaHome.getAbsolutePath());
           cr.setClasspath(".." + FS + "build" + FS + "classes" + PS + javaHome.getAbsolutePath()
+ FS + "lib" + FS + "tools.jar");
  -        cr.setSrcGenDir(".");
  +        */
  +
           server = new CompleteSocketCustomStreamServer(cr, new DefaultAuthenticator(), new
NullServerMonitor(), new DefaultThreadPool(), new DefaultServerSideClientContextFactory(),
11004);
           asyncTestImpl = new AsyncTestImpl();
           // automatic determination of async elements.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message