diff --git a/pom.xml b/pom.xml
index 055fde3..8070bee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,7 +104,7 @@
3.0.1
-
+
@@ -141,7 +141,9 @@
maven-surefire-plugin
2.16
- true
+
+ **/GwtTest*.java
+
@@ -161,6 +163,7 @@
+ test
resources
@@ -169,6 +172,7 @@
WidgetCommonEvent.html
${webappDirectory}
org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent
+ **/GwtTest*.java
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index c22c80d..1292c3f 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -6,10 +6,7 @@
-
- TDGWTService
- org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl
-
+
jUnitHostImpl
@@ -17,19 +14,15 @@
-
- TDGWTService
- tdgwtservice/TDGWTService
-
jUnitHostImpl
- TDInformationManagerWidgets/junithost/*
+ WidgetCommonEvent/junithost/*
- Information.html
+ WidgetCommonEvent.html
diff --git a/src/test/java/org/gcube/portlets/user/td/widgetcommonevent/client/GwtTestWidgetCommonEvent.java b/src/test/java/org/gcube/portlets/user/td/widgetcommonevent/client/GwtTestWidgetCommonEvent.java
index 19a41ef..37f23d6 100644
--- a/src/test/java/org/gcube/portlets/user/td/widgetcommonevent/client/GwtTestWidgetCommonEvent.java
+++ b/src/test/java/org/gcube/portlets/user/td/widgetcommonevent/client/GwtTestWidgetCommonEvent.java
@@ -1,20 +1,18 @@
package org.gcube.portlets.user.td.widgetcommonevent.client;
-
-
+import org.gcube.portlets.user.td.widgetcommonevent.client.event.ImportTableEvent;
+import org.gcube.portlets.user.td.widgetcommonevent.client.type.ImportTableType;
import org.junit.Test;
import com.google.gwt.junit.client.GWTTestCase;
+import com.google.web.bindery.event.shared.SimpleEventBus;
/**
- * GWT JUnit integration tests must extend GWTTestCase.
- * Using "GwtTest*"
naming pattern exclude them from running with
- * surefire during the test phase.
+ * Test Event
*
- * 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.
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
*/
public class GwtTestWidgetCommonEvent extends GWTTestCase {
@@ -23,62 +21,54 @@ public class GwtTestWidgetCommonEvent extends GWTTestCase {
*/
@Override
public String getModuleName() {
- return "org.gcube.portlets.user.td.widgetcommonevent.test.WidgetCommonEventJUnit";
+ return "org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEventJUnit";
}
/**
- * This test will send a request to the server
+ * Test Events fire
*/
@Test
public void testEvents() {
- // Create the service that we will test.
- //TDGWTServiceAsync tdGXTService = GWT.create(TDGWTService.class);
- //ServiceDefTarget target = (ServiceDefTarget) tdGXTService;
- //System.out.println(GWT.getModuleBaseURL() + "/TDGWTService");
- //target.setServiceEntryPoint(GWT.getModuleBaseURL() + "/TDGWTService");
-
- // 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(2000);
- //finishTest();
- // Send a request to the server.
- /*try {
- TDGXTServiceAsync.INSTANCE.getTabResource(
- new AsyncCallback() {
-
-
- @Override
- public void onSuccess(TabResource result) {
- assertTrue(result!=null);
- System.out.println(result);
- // 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();
- }
+ SimpleEventBus eventBus=new SimpleEventBus();
+
+ eventBus.addHandler(ImportTableEvent.TYPE,
+ new ImportTableEvent.ImportTableHandler() {
- @Override
- public void onFailure(Throwable caught) {
- // The request resulted in an unexpected error.
- fail("Request failure: " + caught.getMessage());
-
-
+ @Override
+ public void onImportTable(ImportTableEvent event) {
+ doImportTable(event.getImportType());
+ }
+ });
+
+ eventBus.fireEvent(new ImportTableEvent(ImportTableType.SDMX));
+ eventBus.fireEvent(new ImportTableEvent(ImportTableType.CSV));
+ eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON));
- }
-
- });
- } catch (TDGXTServiceException e) {
- System.out.println("Error in comunications: "+e.getLocalizedMessage());
- e.printStackTrace();
- }
- */
-
-
+
}
-
+ private void doImportTable(ImportTableType importType) {
+ System.out.println("doImportTable importType: " + importType);
+ try {
+ switch (importType) {
+ case SDMX:
+ System.out.println("Start Import SDMX");
+ break;
+ case CSV:
+ System.out.println("Start Import CSV");
+ break;
+ case JSON:
+ System.out.println("Start Import JSON");
+ break;
+ default:
+ break;
+ }
+ } catch (Exception e) {
+ System.out.println("doImportTable Error : " + e.getLocalizedMessage()
+ + " \n " + e.getMessage());
+ }
+ }
}
diff --git a/src/test/resources/org/gcube/portlets/user/td/widgetcommonevent/test/WidgetCommonEventJUnit.gwt.xml b/src/test/resources/org/gcube/portlets/user/td/widgetcommonevent/WidgetCommonEventJUnit.gwt.xml
similarity index 85%
rename from src/test/resources/org/gcube/portlets/user/td/widgetcommonevent/test/WidgetCommonEventJUnit.gwt.xml
rename to src/test/resources/org/gcube/portlets/user/td/widgetcommonevent/WidgetCommonEventJUnit.gwt.xml
index f123262..349d200 100644
--- a/src/test/resources/org/gcube/portlets/user/td/widgetcommonevent/test/WidgetCommonEventJUnit.gwt.xml
+++ b/src/test/resources/org/gcube/portlets/user/td/widgetcommonevent/WidgetCommonEventJUnit.gwt.xml
@@ -1,8 +1,8 @@
-
+
+
-
@@ -10,5 +10,4 @@
-