Closed GoogleCodeExporter closed 9 years ago
I must admit that I've never used custom deferred binding myself. I'll read the
corresponding documentation
(http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideCodingBasicsDef
erred.html) to figured out how gwt-test-utils could support it.
It would be nice if you could provide the source code of your POC not to miss
anything.
Original comment by gael.laz...@gmail.com
on 14 Jun 2011 at 6:44
The <replace-with> tag in .ui.xml files could be easy to support, but not
<generate-with>.
In fact, Generator relies on some part of the GWT API (which deal with java
class metadata : JClassType, TypeOracle) which is totally bypassed by
gwt-test-utils.
Despite it does not relies on this API, gwt-test-utils could detect your
declared <generate-with> tag, and indicate developpers they should add a custom
GwtCreateHandler or mock object for the <when-type-assignable> value because
gwt-test-utils does not support deferred binding <generate-with> mechanism.
Original comment by gael.laz...@gmail.com
on 4 Jul 2011 at 8:36
Original comment by gael.laz...@gmail.com
on 19 Jul 2011 at 5:56
Thanks for checking this, man. Sorry for the late reply.
Original comment by jaime.sc...@oncast.com.br
on 18 Aug 2011 at 5:08
Original comment by gael.laz...@gmail.com
on 28 Aug 2011 at 1:24
I finally added some basic support for custom deferred binding :
- for replace-with declaration, gwt-test-utils will check for the default
replacewith class ( = with no 'when-property-is' subchild) and will try to
instanciate the class with a new GWT.create(..) instruction
- for generate-with declaration, if no custom GwtCreateHandler has been added,
gwt-test-utils will throw a GwtTestConfigurationException which tells GWT
Generator API is not supported, so developper will have to declare their own
GwtCreateHandler or @Mock an instance of the class.
Can anyone verifed it works and give me some feedback ?
Original comment by gael.laz...@gmail.com
on 28 Aug 2011 at 4:13
I can verify both changes to "work for us".
- 'generate-with' raises an exception, if no handler is defined for the defined
type, and stays silent, if a handler indeed does provide some instance.
- 'replace-with' creates an instance of the replacement class (I did no
negative checks here).
I wonder, why the 'when-property-is' stays unsupported. Should not be too
complex to handle, given a possibility to pre-set property values from within a
test. It does not necessarily have to support the 'set-property' feature as
well, I think.
Original comment by stefan.s...@googlemail.com
on 29 Aug 2011 at 9:39
You're right, it would be easy.
A GwtTest.setProperty(name, value) method should be comprehensive.
For example, to tell gwt-test-utils we want to run a test with Mozilla :
@Before
public void setupProperties() {
this.setProperty("user.agent", "gecko");
}
I've reopen the issue and will add this feature in the next snapshot, stay
tuned ;-)
Original comment by gael.laz...@gmail.com
on 29 Aug 2011 at 9:48
I've just deploy new snapshots (0.33-SNAPSHOT, 0.22.4-SNAPSHOT,
0.25.4-SNAPSHOT, 0.28.7-SNAPSHOT) with a better implementation for
<replace-with> deferred binding.
To set a Browser property, just call at the beginning of your test :
Browser.setProperty("user.agent", "gecko");
Note that all Browser's properties are reseted between each unit test.
Could you please try it and give me some feedback ?
Original comment by gael.laz...@gmail.com
on 2 Sep 2011 at 5:37
Setting properties works well for me. Nicely done.
Using: gwt-test-utils-0.28.7-20110907.070135-2.jar
Original comment by stefan.s...@googlemail.com
on 8 Sep 2011 at 7:48
Thanks !
Original comment by gael.laz...@gmail.com
on 8 Sep 2011 at 7:58
Gael, I did some experiments with Generators. Only to get things started it
takes about 15 seconds (and throw exception at the end :) ). While the use of
standard implementation is not feasible (loads all the classes, analyses and
builds an AST - Abstract Syntax Tree, etc), I think it's definitely an option
to provide some simple (even stub?) GeneratorContext/Context implementations,
that would work for 90% of cases (I know RemoteService generator is heavily
dependent on the types provided through its context, i.e).
All these would affect the 'generate-with' clause.
Original comment by alex.dob...@gmail.com
on 13 Sep 2011 at 3:17
Gael, I did some experiments with Generators. Only to get things started it
takes about 15 seconds (and throw exception at the end :) ). While the use of
standard implementation is not feasible (loads all the classes, analyses and
builds an AST - Abstract Syntax Tree, etc), I think it's definitely an option
to provide some simple (even stub?) GeneratorContext/Context implementations,
that would work for 90% of cases (I know RemoteService generator is heavily
dependent on the types provided through its context, i.e).
All these would affect the 'generate-with' clause.
Original comment by alex.dob...@gmail.com
on 13 Sep 2011 at 3:17
Original issue reported on code.google.com by
jaime.sc...@gmail.com
on 13 Jun 2011 at 6:48