Alejandro, what is the command you were running?

I just downloaded the zip, and ran this:

mvn gwt:run -DrunTarget=com.example.User/User.html

It launched the hosted browser ok.  I have a regex check in there that
pops up Window.alert if the url isn't what urlrewrite expects.  You
can delete that code, or point your hosted browser instead to:

http://localhost:8888/user/abc

and you'll see a form that fills in the textbox with abc, and if you
click the button, it executes GWT-RPC to say hello.

You can also run this:

mvn gwt:run -DrunTarget=com.example.Admin/Admin.html

and you can hit this url:

http://localhost:8888/admin

It will show that the content is different.

Just for reference, I am using:

C:\TEMP\gwt-prototype>mvn -version
Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
Java version: 1.6.0_14
Java home: C:\Program Files\Java\jdk1.6.0_14\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

Regards,
Davis

On Aug 19, 10:59 am, "Alejandro D. Garin" <[email protected]> wrote:
> Hi David,
>
> I tried your example, but I have this error:
>
> Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is
> only usable in client code!  It cannot be called, for example, from server
> code.  If you are running a unit test, check that your test case extends
> GWTTestCase and that GWT.create() is not called from within an initializer
> or constructor.
>
> Stacktrace:
>
> java.lang.ExceptionInInitializerError
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at net.sf.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:619)
>     at net.sf.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:612)
>     at net.sf.cglib.proxy.Enhancer.registerCallbacks(Enhancer.java:581)
>     at
> org.easymock.classextension.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:108)
>     at org.easymock.internal.MocksControl.createMock(MocksControl.java:51)
>     at org.easymock.classextension.EasyMock.createMock(EasyMock.java:46)
>     at example.publico.client.SimpleTest.testSimple(SimpleTest.java:10)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at junit.framework.TestCase.runTest(TestCase.java:168)
>     at junit.framework.TestCase.runBare(TestCase.java:134)
>     at junit.framework.TestResult$1.protect(TestResult.java:110)
>     at junit.framework.TestResult.runProtected(TestResult.java:128)
>     at junit.framework.TestResult.run(TestResult.java:113)
>     at junit.framework.TestCase.run(TestCase.java:124)
>     at junit.framework.TestSuite.runTest(TestSuite.java:232)
>     at junit.framework.TestSuite.run(TestSuite.java:227)
>     at
> org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
>     at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is
> only usable in client code!  It cannot be called, for example, from server
> code.  If you are running a unit test, check that your test case extends
> GWTTestCase and that GWT.create() is not called from within an initializer
> or constructor.
>     at com.google.gwt.core.client.GWT.create(GWT.java:85)
>     at com.google.gwt.user.client.ui.UIObject.<clinit>(UIObject.java:140)
>     ... 30 more
>
> On Wed, Aug 19, 2009 at 11:09 AM, davis <[email protected]>wrote:
>
>
>
> > > If your view interface return a TextBox you can't test the presenter with
> > > JUnit, you will need to use GWTTestCase.
>
> > Sure you can:
>
> > import static org.easymock.classextension.EasyMock.*;
> > import com.google.gwt.user.client.ui.TextBox;
>
> > public class SomePresenterTestCase {
>
> >   private MyPresenter presenter;
> >   private MyView view;
>
> >   @Test
> >   public void testSomething() {
> >       TextBox mockBox = createMock(TextBox.class);
> >       MyView mockView = createMock(MyView.class);
> >       presenter = new MyPresenter(mockView);
> >       expect(mockView.getSomeTextBox()).andReturn(mockBox);
> >       replay(mockView);
> >       replay(mockBox);
> >       TextBox box = presenter.getDisplay().getSomeTextBox();
> >       verify(mockView);
> >    }
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to