GWT Junit Test

Maxii

Mitglied
Hallo
ich hoffe ich habe hier das richtige Unterforum erwischt. Ich versuche mit GWT Junit ein RPC zu testen. Dazu habe ich das Standard Beispiel-GWT-Projekt genommen und folgende Testklasse definiert:

Java:
public class TestGreetingService extends GWTTestCase {
	/**
	 * Must refer to a valid module that sources this class.
	 */
	public String getModuleName() {
		return "com.TestGreeting";
	}	

	/**
	 * This test will send a request to the server using the greetServer method
	 * in GreetingService and verify the response.
	 */
	public void testGreetingService() {
		// Create the service that we will test.
		GreetingServiceAsync greetingService = GWT
				.create(GreetingService.class);
		ServiceDefTarget target = (ServiceDefTarget) greetingService;
		target.setServiceEntryPoint(GWT.getModuleBaseURL() + "TestGreeting/greet");

		// Since RPC calls are asynchronous, we will need to wait for a response
		// after this test method returns. This line tells the test runner to
		// wait
		// up to 10 seconds before timing out.
		delayTestFinish(20000);

		// Send a request to the server.
		greetingService.greetServer("GWT User", new AsyncCallback<String>() {
			public void onFailure(Throwable caught) {
				// The request resulted in an unexpected error.
				fail("Request failure: " + caught.getMessage());
			}

			public void onSuccess(String result) {
				// Verify that the response is correct.
				assertTrue(result.startsWith("Hello, GWT User!"));

				// Now that we have received a response, we need to tell the
				// test runner
				// that the test is complete. You must call finishTest() after
				// an
				// asynchronous test finishes successfully, or the test will
				// time out.
				finishTest();
			}
		});
	}
}

Folgender Fehler entstheht nun aber beim Testen.

[WARN] 404 - POST /com.TestGreeting.JUnit/TestGreeting/greet (192.168.1XX.XX) 1427 bytes
Request headers
Host: 192.168.1XX.XX:53577
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
Accept-Language: en-us
Accept: */*
Connection: Keep-Alive
Referer: http://192.168.1XX.XX:53577/com.Tes...andards.html?gwt.codesvr=192.168.1XX.XX:53572
X-GWT-Permutation: HostedMode
X-GWT-Module-Base: http://192.168.1XX.XX:53577/com.TestGreeting.JUnit/
Content-Type: text/x-gwt-rpc; charset=utf-8
Content-Length: 181
Response headers
Content-Type: text/html; charset=iso-8859-1
Content-Length: 1427

Kann mir da jemand weiterhelfen? Ich hab das Projekt auch mal hochgeladen, falls sich das jemand angucken will: File-Upload.net - TestGreeting.rar
 

darekkay

Bekanntes Mitglied
404 deutet darauf hin, dass irgendetwas nicht richtig eingestellt ist (z.B. das web.xml-Mapping).
Kannst du denn das Projekt starten und ohne Probleme ausführen (incl. Service-Aufruf)?
 

Ähnliche Java Themen

Neue Themen


Oben