Minor updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@86556 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-12-04 16:11:40 +00:00
parent de31a646e5
commit f82b07df6a
5 changed files with 58 additions and 29 deletions

View File

@ -202,7 +202,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<skipTests>true</skipTests>
<exclude>**/GwtTest*.java</exclude>
<!-- <skipTests>true</skipTests> -->
</configuration>
<!-- TODO check if needed -->
<dependencies>
@ -222,6 +223,7 @@
<executions>
<execution>
<goals>
<goal>test</goal>
<goal>resources</goal>
</goals>
</execution>

View File

@ -62,6 +62,17 @@ public interface TDGWTService extends RemoteService {
*/
public TabResource getTabResourceInformation() throws TDGWTServiceException;
/**
* Get informations on tabular resource
*
* @return
* @throws TDGWTServiceException
*/
public TabResource getTabResourceInformation(TRId trId) throws TDGWTServiceException;
/**
* Set current tabular resource
*

View File

@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
@ -48,6 +49,8 @@ public interface TDGWTServiceAsync {
void getTabResourceInformation(AsyncCallback<TabResource> callback);
void getTabResourceInformation(TRId trId,AsyncCallback<TabResource> callback);
void setTabResource(TabResource tabResource, AsyncCallback<Void> callback);
void getTabularResources(AsyncCallback<ArrayList<TabResource>> callback);

View File

@ -1,22 +1,29 @@
package org.gcube.portlets.user.td.gwtservice.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTService;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
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;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class GwtTestTDGWTService extends GWTTestCase {
// protected static final Logger logger=
// LoggerFactory.getLogger(GwtTestTDGWTService.class);
/**
* Must refer to a valid module that sources this class.
*/
@ -28,7 +35,9 @@ public class GwtTestTDGWTService extends GWTTestCase {
/**
* This test will send a request to the server
*/
public void testCreateTabResource() {
public void testListTabularResource() {
System.out.println("---------TEST List Tabular Resource--------");
// Create the service that we will test.
TDGWTServiceAsync tdGWTService = GWT.create(TDGWTService.class);
ServiceDefTarget target = (ServiceDefTarget) tdGWTService;
@ -40,34 +49,35 @@ public class GwtTestTDGWTService extends GWTTestCase {
// wait
// up to 7 seconds before timing out.
delayTestFinish(7000);
TabResource tabResource=new TabResource();
tabResource.setName("TestTabularResource");
tabResource.setAgency("FAO");
tabResource.setDescription("Tabular Resource Test");
tabResource.setRight("");
// Send a request to the server.
TDGWTServiceAsync.INSTANCE.createTabularResource(tabResource,new AsyncCallback<TabResource>() {
TDGWTServiceAsync.INSTANCE
.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
@Override
public void onFailure(Throwable caught) {
// The request resulted in an unexpected error.
fail("Request failure: " + caught.getMessage());
}
@Override
public void onFailure(Throwable caught) {
// The request resulted in an unexpected error.
fail("Request failure: " + caught.getMessage());
@Override
public void onSuccess(TabResource result) {
assertTrue(result != null);
System.out.println(result);
finishTest();
}
}
@Override
public void onSuccess(ArrayList<TabResource> result) {
assertTrue(result != null);
System.out.println("");
if (result.size() <= 0) {
System.out.println("----------------->No tabular Resources for this user.");
} else {
for (TabResource tr : result) {
System.out.println("--------------->TR: " + tr);
}
}
finishTest();
}
});
});
}
}

View File

@ -200,4 +200,7 @@ public class TestService {
System.out.println("TabularResource:" + tr.getId());
}
}
}