You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2007/07/12 23:31:27 UTC

svn commit: r555774 - in /openejb/trunk/openejb3/itests/openejb-itests-client: ./ src/main/java/org/apache/openejb/test/ src/main/resources/META-INF/ src/main/resources/META-INF/org.apache.openejb.cli/ src/main/resources/META-INF/org.openejb.cli/

Author: jlaskowski
Date: Thu Jul 12 14:31:26 2007
New Revision: 555774

URL: http://svn.apache.org/viewvc?view=rev&rev=555774
Log:
Make openejb-itests-client jar executable

You need to copy some jars to the directory where openejb-itests-client.jar is and run 

  java -jar openejb-itests-client-3.0.0-SNAPSHOT.jar
  
The jars are:
 * junit-4.2.jar
 * openejb-core
 * openejb-loader

The task's not finished yet. More work's required.

Added:
    openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties   (with props)
    openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.apache.openejb.cli/
      - copied from r555202, openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.openejb.cli/
Removed:
    openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.openejb.cli/
Modified:
    openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml
    openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/IvmTestServer.java
    openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TestRunner.java
    openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.apache.openejb.cli/test.help

Modified: openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml?view=diff&rev=555774&r1=555773&r2=555774
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml Thu Jul 12 14:31:26 2007
@@ -31,6 +31,12 @@
   <packaging>jar</packaging>
   <name>OpenEJB :: iTests Client</name>
   <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -39,10 +45,34 @@
           <archive>
             <manifest>
               <mainClass>org.apache.openejb.test.Main</mainClass>
+              <addClasspath>true</addClasspath>
             </manifest>
           </archive>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <tstamp>
+                  <format property="TSTAMP" pattern="hh:mm"/>
+                </tstamp>
+                <replace file="target/classes/META-INF/openejb-version.properties"
+                         token="@DATE-REPLACED-BY-MAVEN@" value="${DSTAMP}"/>
+                <replace file="target/classes/META-INF/openejb-version.properties"
+                         token="@TIME-REPLACED-BY-MAVEN@" value="${TSTAMP}"/>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
@@ -53,6 +83,11 @@
     <dependency>
       <groupId>org.apache.openejb</groupId>
       <artifactId>openejb-itests-beans</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-core</artifactId>
       <version>${pom.version}</version>
     </dependency>
     <dependency>

Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/IvmTestServer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/IvmTestServer.java?view=diff&rev=555774&r1=555773&r2=555774
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/IvmTestServer.java (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/IvmTestServer.java Thu Jul 12 14:31:26 2007
@@ -18,12 +18,14 @@
 
 import java.util.Properties;
 
+import javax.naming.Context;
 import javax.naming.InitialContext;
 
 /**
- *
  * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
  * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ * 
+ * @version $Rev$ $Date$ 
  */
 public class IvmTestServer implements TestServer {
 
@@ -31,13 +33,15 @@
 
     public void init(Properties props){
         
-        properties = props;
+        properties = new Properties();
+        properties.putAll(props);
         
         try{
-            props.put("java.naming.factory.initial", "org.apache.openejb.client.LocalInitialContextFactory");
-            Properties p = new Properties(props);
+            props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+            Properties p = new Properties();
+            p.putAll(props);
             p.put("openejb.loader", "embed");
-            new InitialContext( p );
+            new InitialContext( p );    // initialize openejb via constructing jndi tree
             
         //OpenEJB.init(properties);
         }catch(Exception oe){

Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TestRunner.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TestRunner.java?view=diff&rev=555774&r1=555773&r2=555774
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TestRunner.java (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TestRunner.java Thu Jul 12 14:31:26 2007
@@ -33,7 +33,7 @@
  * @version $Rev$ $Date$
  */
 public class TestRunner extends junit.textui.TestRunner {
-    private static final String helpBase = "META-INF/org.apache.openejb.cli/";
+    private static final String helpBase = "/META-INF/org.apache.openejb.cli/";
 
     /**
      * Constructs a TestRunner.
@@ -159,9 +159,9 @@
     private static void printHelp() {
         String header = "OpenEJB Compliance Tests ";
         try {
-            URL resource = TestRunner.class.getResource("openejb-version.properties");
+            InputStream is = TestRunner.class.getResourceAsStream("/META-INF/openejb-version.properties");
             Properties versionInfo = new Properties();
-            versionInfo.load(resource.openConnection().getInputStream());
+            versionInfo.load(is);
             header += versionInfo.get("version");
         } catch (java.io.IOException e) {
         }
@@ -170,10 +170,7 @@
 
         // Internationalize this
         try {
-            InputStream in = Thread.currentThread().getContextClassLoader()
-                    .getResource(helpBase + "test.help").openConnection()
-                    .getInputStream();
-
+            InputStream in = TestRunner.class.getResourceAsStream(helpBase + "test.help");
             int b = in.read();
             while (b != -1) {
                 System.out.write(b);

Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties?view=auto&rev=555774
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties Thu Jul 12 14:31:26 2007
@@ -0,0 +1,21 @@
+#
+#  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.
+#
+copyright=Copyright 1999-2007 (C) Apache OpenEJB Project, All Rights Reserved.
+url=http://openejb.apache.org/
+version=${pom.version}
+date=@DATE-REPLACED-BY-MAVEN@
+time=@TIME-REPLACED-BY-MAVEN@

Propchange: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/openejb-version.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.apache.openejb.cli/test.help
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.apache.openejb.cli/test.help?view=diff&rev=555774&r1=555202&r2=555774
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.apache.openejb.cli/test.help (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.apache.openejb.cli/test.help Thu Jul 12 14:31:26 2007
@@ -8,8 +8,8 @@
   remote    Runs the test suite against OpenEJB in client/server
             mode using the OpenEJB Remote Server.                   
             
-OpenEJB -- EJB Container System and EJB Server.
+Apache OpenEJB -- EJB Container System and EJB Server.
 For updates and additional information, visit
-http://www.openejb.org
+http://openejb.apache.org
 
-Bug Reports to <http://jira.codehaus.org/browse/OPENEJB>
\ No newline at end of file
+Bug Reports to http://issues.apache.org/jira/browse/OPENEJB



Re: svn commit: r555774 - in /openejb/trunk/openejb3/itests/openejb-itests-client: ./ src/main/java/org/apache/openejb/test/ src/main/resources/META-INF/ src/main/resources/META-INF/org.apache.openejb.cli/ src/main/resources/META-INF/org.openejb.cli/

Posted by Dain Sundstrom <da...@iq80.com>.
On Jul 16, 2007, at 12:53 PM, Jacek Laskowski wrote:

> On 7/16/07, Dain Sundstrom <da...@iq80.com> wrote:
>> Also, please use Context.INITIAL_CONTEXT_FACTORY, instead of
>> inlineing the value.  It is much harder to make a typo when you use a
>> constant.
>
> I don't understand. Didn't I use the Context.INITIAL_CONTEXT_FACTORY?
> The line with the inlined value was replaced with the constant.

Sorry, I read the patch backwards.  You made the correct change from  
a hard coded string to the constant.

-dain

Re: svn commit: r555774 - in /openejb/trunk/openejb3/itests/openejb-itests-client: ./ src/main/java/org/apache/openejb/test/ src/main/resources/META-INF/ src/main/resources/META-INF/org.apache.openejb.cli/ src/main/resources/META-INF/org.openejb.cli/

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On 7/16/07, Dain Sundstrom <da...@iq80.com> wrote:
> Jacek,
>
> Can you make sure to run a full build (with test on) before
> committing?  There is an incredibly subtle bug in this commit that
> you can only find by running the tests.  Please fix this ASAP as the
> build is currently broken

I'm looking into it.

> See below for details on this specific bug:
>
> On Jul 12, 2007, at 2:31 PM, jlaskowski@apache.org wrote:
>
> > Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/
> > main/java/org/apache/openejb/test/IvmTestServer.java
> > URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/
> > openejb-itests-client/src/main/java/org/apache/openejb/test/
> > IvmTestServer.java?view=diff&rev=555774&r1=555773&r2=555774
> > ======================================================================
> > ========
> > --- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/
> > java/org/apache/openejb/test/IvmTestServer.java (original)
> > +++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/
> > java/org/apache/openejb/test/IvmTestServer.java Thu Jul 12 14:31:26
> > 2007
> > @@ -18,12 +18,14 @@
> >
> >  import java.util.Properties;
> >
> > +import javax.naming.Context;
> >  import javax.naming.InitialContext;
> >
> >  /**
> > - *
> >   * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
> >   * @author <a href="mailto:Richard@Monson-Haefel.com">Richard
> > Monson-Haefel</a>
> > + *
> > + * @version $Rev$ $Date$
> >   */
> >  public class IvmTestServer implements TestServer {
> >
> > @@ -31,13 +33,15 @@
> >
> >      public void init(Properties props){
> >
> > -        properties = props;
> > +        properties = new Properties();
> > +        properties.putAll(props);
> >
> >          try{
> > -            props.put("java.naming.factory.initial",
> > "org.apache.openejb.client.LocalInitialContextFactory");
> > -            Properties p = new Properties(props);
> > +            props.put(Context.INITIAL_CONTEXT_FACTORY,
> > "org.apache.openejb.client.LocalInitialContextFactory");
> > +            Properties p = new Properties();
> > +            p.putAll(props);
> >              p.put("openejb.loader", "embed");
> > -            new InitialContext( p );
> > +            new InitialContext( p );    // initialize openejb via
> > constructing jndi tree
> >
> >          //OpenEJB.init(properties);
> >          }catch(Exception oe){
>
> In the test code we pass System.getProperties() into this method.
> The code then adds the initial context factory property to the passed
> in properties, and thus the system properties.  Your change makes a
> copy of the properties first, so the initial context factory property
> never makes it into the system properties.  This breaks the itests
> because you can no longer create a new InitialContext().
>
> Also, please use Context.INITIAL_CONTEXT_FACTORY, instead of
> inlineing the value.  It is much harder to make a typo when you use a
> constant.

I don't understand. Didn't I use the Context.INITIAL_CONTEXT_FACTORY?
The line with the inlined value was replaced with the constant.

Thanks for letting me know. I'm building openejb right now.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: svn commit: r555774 - in /openejb/trunk/openejb3/itests/openejb-itests-client: ./ src/main/java/org/apache/openejb/test/ src/main/resources/META-INF/ src/main/resources/META-INF/org.apache.openejb.cli/ src/main/resources/META-INF/org.openejb.cli/

Posted by Dain Sundstrom <da...@iq80.com>.
Jacek,

Can you make sure to run a full build (with test on) before  
committing?  There is an incredibly subtle bug in this commit that  
you can only find by running the tests.  Please fix this ASAP as the  
build is currently broken

-dain

See below for details on this specific bug:

On Jul 12, 2007, at 2:31 PM, jlaskowski@apache.org wrote:

> Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/ 
> main/java/org/apache/openejb/test/IvmTestServer.java
> URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/ 
> openejb-itests-client/src/main/java/org/apache/openejb/test/ 
> IvmTestServer.java?view=diff&rev=555774&r1=555773&r2=555774
> ====================================================================== 
> ========
> --- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/ 
> java/org/apache/openejb/test/IvmTestServer.java (original)
> +++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/ 
> java/org/apache/openejb/test/IvmTestServer.java Thu Jul 12 14:31:26  
> 2007
> @@ -18,12 +18,14 @@
>
>  import java.util.Properties;
>
> +import javax.naming.Context;
>  import javax.naming.InitialContext;
>
>  /**
> - *
>   * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
>   * @author <a href="mailto:Richard@Monson-Haefel.com">Richard  
> Monson-Haefel</a>
> + *
> + * @version $Rev$ $Date$
>   */
>  public class IvmTestServer implements TestServer {
>
> @@ -31,13 +33,15 @@
>
>      public void init(Properties props){
>
> -        properties = props;
> +        properties = new Properties();
> +        properties.putAll(props);
>
>          try{
> -            props.put("java.naming.factory.initial",  
> "org.apache.openejb.client.LocalInitialContextFactory");
> -            Properties p = new Properties(props);
> +            props.put(Context.INITIAL_CONTEXT_FACTORY,  
> "org.apache.openejb.client.LocalInitialContextFactory");
> +            Properties p = new Properties();
> +            p.putAll(props);
>              p.put("openejb.loader", "embed");
> -            new InitialContext( p );
> +            new InitialContext( p );    // initialize openejb via  
> constructing jndi tree
>
>          //OpenEJB.init(properties);
>          }catch(Exception oe){

In the test code we pass System.getProperties() into this method.   
The code then adds the initial context factory property to the passed  
in properties, and thus the system properties.  Your change makes a  
copy of the properties first, so the initial context factory property  
never makes it into the system properties.  This breaks the itests  
because you can no longer create a new InitialContext().

Also, please use Context.INITIAL_CONTEXT_FACTORY, instead of  
inlineing the value.  It is much harder to make a typo when you use a  
constant.