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

View File

@ -62,6 +62,17 @@ public interface TDGWTService extends RemoteService {
*/ */
public TabResource getTabResourceInformation() throws TDGWTServiceException; public TabResource getTabResourceInformation() throws TDGWTServiceException;
/**
* Get informations on tabular resource
*
* @return
* @throws TDGWTServiceException
*/
public TabResource getTabResourceInformation(TRId trId) throws TDGWTServiceException;
/** /**
* Set current tabular resource * 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.CSVImportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; 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.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.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
@ -48,6 +49,8 @@ public interface TDGWTServiceAsync {
void getTabResourceInformation(AsyncCallback<TabResource> callback); void getTabResourceInformation(AsyncCallback<TabResource> callback);
void getTabResourceInformation(TRId trId,AsyncCallback<TabResource> callback);
void setTabResource(TabResource tabResource, AsyncCallback<Void> callback); void setTabResource(TabResource tabResource, AsyncCallback<Void> callback);
void getTabularResources(AsyncCallback<ArrayList<TabResource>> callback); void getTabularResources(AsyncCallback<ArrayList<TabResource>> callback);

View File

@ -1,22 +1,29 @@
package org.gcube.portlets.user.td.gwtservice.client; 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.TDGWTService;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; 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.core.client.GWT;
import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget; import com.google.gwt.user.client.rpc.ServiceDefTarget;
/** /**
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi" <a
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class GwtTestTDGWTService extends GWTTestCase { public class GwtTestTDGWTService extends GWTTestCase {
// protected static final Logger logger=
// LoggerFactory.getLogger(GwtTestTDGWTService.class);
/** /**
* Must refer to a valid module that sources this 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 * 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. // Create the service that we will test.
TDGWTServiceAsync tdGWTService = GWT.create(TDGWTService.class); TDGWTServiceAsync tdGWTService = GWT.create(TDGWTService.class);
ServiceDefTarget target = (ServiceDefTarget) tdGWTService; ServiceDefTarget target = (ServiceDefTarget) tdGWTService;
@ -40,34 +49,35 @@ public class GwtTestTDGWTService extends GWTTestCase {
// wait // wait
// up to 7 seconds before timing out. // up to 7 seconds before timing out.
delayTestFinish(7000); 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. // Send a request to the server.
TDGWTServiceAsync.INSTANCE.createTabularResource(tabResource,new AsyncCallback<TabResource>() { TDGWTServiceAsync.INSTANCE
.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
// The request resulted in an unexpected error. // The request resulted in an unexpected error.
fail("Request failure: " + caught.getMessage()); fail("Request failure: " + caught.getMessage());
}
@Override }
public void onSuccess(TabResource result) {
assertTrue(result != null); @Override
System.out.println(result); public void onSuccess(ArrayList<TabResource> result) {
finishTest(); 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()); System.out.println("TabularResource:" + tr.getId());
} }
} }
} }