google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

Running GWT test not finding DTOs referred in different project. #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In GWT-UI project:  I have a GWT module (.gwt.xml) in the package 
com.test.gwttest.
My entry level class and all other client classes (Including JavaScriptObject 
classes) are in com.test.gwttext.client package and in its subpackages.

2.  In Java-Domain project:  I have DTOs created in totally different project 
(domain) but in the same workspace.  The package stucture in "domain" project 
is "com.test.gwttest.domain".

3.  Java build path for GWT-UI project has reference to Java-Domain project.  
And the .gwt.xml has the following entry for source classes.
    <source path='client'/>
    <source path='domain'/>
4.  Running the GWT unit test using gwt-test-utils version .39 complains about 
not finding the JavaScriptObject class file.  But running the test with .40 
version complains about not finding the DTO class.  I think the error thrown in 
.39 is misleading while in .40 is more clear.

What is the expected output? What do you see instead?
The gwt-test-util should find the gwt source classes outside gwt project too as 
gwt.xml has right source package declaration.

What version of the product are you using? On what operating system?
.39 and .40 on windows xp.

Please provide any additional information below.
Right now I created domain packages in GWT project and moved all DTOs from 
domain project into gwt project under "domain" package (Where gwt client 
classes are in "client" package) to verify the test runs will find the DTOs.  
Yes, it did.

Original issue reported on code.google.com by shivakum...@gmail.com on 24 Jul 2012 at 2:29

GoogleCodeExporter commented 9 years ago
I think you're missing something very important about GWT modules : your 
Java-Domain project produces a .jar file. But if you don't tune your build 
system(maven, ant or whatever), your jar will only contains .class files, not 
the .java source requiered by the GWT compilator to produce JavaScript.

If you are using maven, also note that by default, maven exclude every file in 
src/main/java which is not a .java file. To have a valid GWT module jar, you'll 
have to add some build configuration like this :

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/client/**</include>
                    <include>**/*.gwt.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

(or, if you use gwt-maven-plugin, have a look at 'gwt-source' goal)

You will also need to have to provide a com.test.gwttest.Domain.gwt.xml file 
with the <source path='domain'/> in it.
Actually, the <source path='domain'/> in your GWT-UI .gwt.xml file is useless.

You might want to read more on GWT multi-module project configuration here : 
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/multiproject.html

Hope that helps !

Original comment by gael.laz...@gmail.com on 24 Jul 2012 at 2:52

GoogleCodeExporter commented 9 years ago
Ah, correct.  The gwt project which was referring the jar didn't have source 
files in it.  I couldn't think that way.  Sorry for wasting your time.

Original comment by shivakum...@gmail.com on 24 Jul 2012 at 4:01

GoogleCodeExporter commented 9 years ago
no problem ;)

Is 0.40-SNAPSHOT working now ?

Original comment by gael.laz...@gmail.com on 24 Jul 2012 at 4:02

GoogleCodeExporter commented 9 years ago
It looks like the issue 150 where declaring Ui attribute is a must even using 
in UiHandler still exists.

Because of some dependencies I am still trying to resolve, I couldn't verify 
the issue 149.  But it is not a severe one.

Though the test runner doesn't stop complaining about non availability of DTO 
source class and stops abrupty telling couldn't find the entry point class, it 
still complains with following error message and continues execution.

     [ERROR] Line 61: No source code is available for type java.io.ObjectInputStream; did you forget to inherit a required module?
      [ERROR] Line 63: The method getProperty(String) is undefined for the type System
      [ERROR] Line 65: No source code is available for type java.io.FileInputStream; did you forget to inherit a required module?
      [ERROR] Line 68: No source code is available for type java.io.FileNotFoundException; did you forget to inherit a required module?
      [ERROR] Line 72: No source code is available for type java.lang.ClassNotFoundException; did you forget to inherit a required module?
      [ERROR] Line 76: No source code is available for type com.google.gson.Gson; did you forget to inherit a required module?

Original comment by shivakum...@gmail.com on 24 Jul 2012 at 9:10

GoogleCodeExporter commented 9 years ago
You can safely ignore those error message : since you don't have to write test 
compilable in JavaScript (like for GWTTestCase), non compilable Java 
dependencies in your GwtTest subclasses are not fatal errors

Original comment by gael.laz...@gmail.com on 26 Jul 2012 at 8:14