From 5bf9132f3d0f882d508ba56055e494c96cd64155 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 29 Oct 2013 14:17:20 +0000 Subject: [PATCH] Cleaned and restored the project git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget@84560 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/GwtTestSDMXExportWizardTD.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/test/java/org/gcube/portlets/user/td/sdmxexportwidget/client/GwtTestSDMXExportWizardTD.java diff --git a/src/test/java/org/gcube/portlets/user/td/sdmxexportwidget/client/GwtTestSDMXExportWizardTD.java b/src/test/java/org/gcube/portlets/user/td/sdmxexportwidget/client/GwtTestSDMXExportWizardTD.java new file mode 100644 index 0000000..eb2884f --- /dev/null +++ b/src/test/java/org/gcube/portlets/user/td/sdmxexportwidget/client/GwtTestSDMXExportWizardTD.java @@ -0,0 +1,78 @@ +package org.gcube.portlets.user.td.sdmxexportwidget.client; + +import org.gcube.portlets.user.td.sdmxexportwidget.shared.FieldVerifier; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.junit.client.GWTTestCase; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; + +/** + * GWT JUnit integration tests must extend GWTTestCase. + * Using "GwtTest*" naming pattern exclude them from running with + * surefire during the test phase. + * + * If you run the tests using the Maven command line, you will have to + * navigate with your browser to a specific url given by Maven. + * See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html + * for details. + */ +public class GwtTestSDMXExportWizardTD extends GWTTestCase { + + /** + * Must refer to a valid module that sources this class. + */ + public String getModuleName() { + return "org.gcube.portlets.user.SDMXImportWizardTD.SDMXImportWizardTDJUnit"; + } + + /** + * Tests the FieldVerifier. + */ + public void testFieldVerifier() { + assertFalse(FieldVerifier.isValidName(null)); + assertFalse(FieldVerifier.isValidName("")); + assertFalse(FieldVerifier.isValidName("a")); + assertFalse(FieldVerifier.isValidName("ab")); + assertFalse(FieldVerifier.isValidName("abc")); + assertTrue(FieldVerifier.isValidName("abcd")); + } + + /** + * 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() + "SDMXImportWizardTD/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(10000); + + // Send a request to the server. + /* greetingService.greetServer("GWT User", new AsyncCallback() { + 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(); + } + });*/ + + } + + +}