Updated to support Git and Jenkins

This commit is contained in:
Giancarlo Panichi 2019-10-15 11:32:43 +02:00
parent e7fa4ab98a
commit 7abbb54444
2 changed files with 33 additions and 38 deletions

View File

@ -11,7 +11,7 @@ package org.gcube.portlets.user.td.widgetcommonevent.client.type;
*/ */
public enum RibbonType { public enum RibbonType {
OPEN, OPEN,
CLONE, CLONE,
CLOSE, CLOSE,
DELETE, DELETE,
PROPERTIES, PROPERTIES,

View File

@ -8,49 +8,45 @@ import com.google.gwt.junit.client.GWTTestCase;
import com.google.web.bindery.event.shared.SimpleEventBus; import com.google.web.bindery.event.shared.SimpleEventBus;
/** /**
* Test Event * Test Event
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* *
* *
*/ */
public class GwtTestWidgetCommonEvent extends GWTTestCase { public class GwtTestWidgetCommonEvent extends GWTTestCase {
/** /**
* Must refer to a valid module that sources this class. * Must refer to a valid module that sources this class.
*/ */
@Override @Override
public String getModuleName() { public String getModuleName() {
return "org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEventJUnit"; return "org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEventJUnit";
} }
/**
/** * Test Events fire
* Test Events fire */
*/ @Test
@Test public void testEvents() {
public void testEvents() {
SimpleEventBus eventBus=new SimpleEventBus();
eventBus.addHandler(RibbonEvent.TYPE,
new RibbonEvent.RibbonEventHandler() {
public void onRibbon(RibbonEvent event) {
doRibbonCommand(event);
}
});
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORT_SDMX));
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORT_CSV));
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORT_JSON));
}
private void doRibbonCommand(RibbonEvent event) { SimpleEventBus eventBus = new SimpleEventBus();
eventBus.addHandler(RibbonEvent.TYPE, new RibbonEvent.RibbonEventHandler() {
public void onRibbon(RibbonEvent event) {
doRibbonCommand(event);
}
});
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORT_SDMX));
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORT_CSV));
eventBus.fireEvent(new RibbonEvent(RibbonType.IMPORT_JSON));
}
private void doRibbonCommand(RibbonEvent event) {
System.out.println("doRibbonCommand Type: " + event.getRibbonType()); System.out.println("doRibbonCommand Type: " + event.getRibbonType());
try { try {
switch (event.getRibbonType()) { switch (event.getRibbonType()) {
@ -67,8 +63,7 @@ public class GwtTestWidgetCommonEvent extends GWTTestCase {
break; break;
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("doRibbonCommand Error : " + e.getLocalizedMessage() System.out.println("doRibbonCommand Error : " + e.getLocalizedMessage() + " \n " + e.getMessage());
+ " \n " + e.getMessage());
} }
} }