Re: Example to test RequestFactory in JRE

2011-03-02 Thread koma
Yes, but it's got more the unresolved dependies.
Why is this not in the GWT jars ?
Are the test classes omitted from the packaged jar ?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2011-03-02 Thread Thomas Broyer
Here: 
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/requestfactory/server/RequestFactoryJreTest.java

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2011-03-01 Thread Ryan Mehregan
I have created the following utility method, which gives me access to 
RequestFactory for Unit Tests.

public class RequestFactoryProvider {

public static AppRequestFactory get() {
ServiceLayer serviceLayer = ServiceLayer.create();
SimpleRequestProcessor processor = new 
SimpleRequestProcessor(serviceLayer);
EventBus eventBus = new SimpleEventBus();
AppRequestFactory requestFactory = 
RequestFactoryMagic.create(AppRequestFactory.class);
requestFactory.initialize(eventBus, new 
InProcessRequestTransport(processor));
return requestFactory;
}


}



You can then use it like below in your tests:

public class xxxTests {

 AppRequestFactory requestFactory;

@Before
public void setUp() throws Exception {
requestFactory = RequestFactoryProvider.get();
}

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2011-03-01 Thread koma
where do i find RequestFactoryJreTest ?

That class is not available in the jars of my GWT 2.2 project?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2010-12-30 Thread Simon Majou
That's it thank you !

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2010-12-30 Thread Y2i
Ah, I think I see it:

Try saving RequestContext when you first call rF.userRequest(), and
then re-use it when you call create() and persist().

On Dec 30, 11:05 am, Simon Majou  wrote:
> I completed with that code from RequestFactoryJreTest :
>
>   DomainRequestFactory rF =
> RequestFactoryMagic.create(DomainRequestFactory.class);
>   EventBus eventBus = new SimpleEventBus();
>   ServiceLayer serviceLayer = ServiceLayer.create();
>   SimpleRequestProcessor processor = new
> SimpleRequestProcessor(serviceLayer);
>   rF.initialize(eventBus, new InProcessRequestTransport(processor));
>
> But still the same error.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2010-12-30 Thread Simon Majou
I completed with that code from RequestFactoryJreTest :

  DomainRequestFactory rF = 
RequestFactoryMagic.create(DomainRequestFactory.class);
  EventBus eventBus = new SimpleEventBus();
  ServiceLayer serviceLayer = ServiceLayer.create();
  SimpleRequestProcessor processor = new 
SimpleRequestProcessor(serviceLayer);
  rF.initialize(eventBus, new InProcessRequestTransport(processor));

But still the same error.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2010-12-29 Thread Y2i
It looks as if you didn't call rF.initialize(EventBus eventBus,
RequestTransport transport).
Not sure if this is the reason of the exception though...


On Dec 29, 4:30 pm, Simon Majou  wrote:
> I tried to use the class  RequestFactoryMagic but I get the following
> exception:
>
> java.lang.IllegalArgumentException: Attempting to edit an EntityProxy
> previously edited by another RequestContext
>
> Here is my code:
>
>   DomainRequestFactory rF =
> RequestFactoryMagic.create(DomainRequestFactory.class);
>   UserProxy bob = rF.userRequest().create(UserProxy.class);
>   String email = "b...@toto.org";
>   bob.setEmail(email);
>   rF.userRequest().persist().using(bob).fire();
>
>   rF.userRequest().findByEmail(email).fire(new Receiver() {
> @Override
> public void onSuccess(UserProxy user) {
> assertNotNull(user);}
>
>   });

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Example to test RequestFactory in JRE

2010-12-29 Thread Simon Majou
I tried to use the class  RequestFactoryMagic but I get the following 
exception:

java.lang.IllegalArgumentException: Attempting to edit an EntityProxy 
previously edited by another RequestContext


Here is my code:

  DomainRequestFactory rF = 
RequestFactoryMagic.create(DomainRequestFactory.class);
  UserProxy bob = rF.userRequest().create(UserProxy.class);
  String email = "b...@toto.org";
  bob.setEmail(email);
  rF.userRequest().persist().using(bob).fire();
  
  rF.userRequest().findByEmail(email).fire(new Receiver() {
@Override
public void onSuccess(UserProxy user) {
assertNotNull(user);
}
  });

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.