Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@115596 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fec8de84e6
commit
5aa624f7ac
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.td.gwtservice.client;
|
package org.gcube.portlets.user.td.gwtservice.client;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -17,43 +18,57 @@ import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestServiceListTR {
|
public class TestServiceListTR {
|
||||||
|
|
||||||
|
private static SimpleDateFormat sdf = new SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm z");
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void listTR() throws Exception {
|
public void listTR() throws Exception {
|
||||||
System.out.println("------------List of Tabular Resources--------------");
|
System.out
|
||||||
|
.println("------------List of Tabular Resources--------------");
|
||||||
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
|
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(Constants.DEFAULT_USER));
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
|
Constants.DEFAULT_USER));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
List<TabularResource> trs = service.getTabularResources();
|
List<TabularResource> trs = service.getTabularResources();
|
||||||
Assert.assertTrue(trs.size() > 0);
|
Assert.assertTrue(trs.size() > 0);
|
||||||
|
|
||||||
Table lastTable=null;
|
Table lastTable = null;
|
||||||
for (TabularResource tr : trs) {
|
for (TabularResource tr : trs) {
|
||||||
lastTable=service.getLastTable(tr.getId());
|
lastTable = service.getLastTable(tr.getId());
|
||||||
Collection<TabularResourceMetadata<?>> metas=tr.getAllMetadata();
|
Collection<TabularResourceMetadata<?>> metas = tr.getAllMetadata();
|
||||||
|
|
||||||
if(lastTable!=null){
|
if (lastTable != null) {
|
||||||
System.out.println("TabularResource: [ id=" + tr.getId().getValue()+", type="+tr.getTabularResourceType()+", lastTable=[ id="+lastTable.getId().getValue()+", type="+lastTable.getTableType().getName()+"]]");
|
System.out
|
||||||
System.out.println("Last table id="+lastTable.getId()+", name="+lastTable.getName());
|
.println("TabularResource: [ id="
|
||||||
for(Column col:lastTable.getColumns()){
|
+ tr.getId().getValue() + ", type="
|
||||||
System.out.println("Column: [name:" + col.getName()+", localId:"+col.getLocalId()+", dataType:"+col.getDataType()+"]");
|
+ tr.getTabularResourceType() + ", date="
|
||||||
|
+ sdf.format(tr.getCreationDate().getTime())
|
||||||
|
+ ", lastTable=[ id="
|
||||||
|
+ lastTable.getId().getValue() + ", type="
|
||||||
|
+ lastTable.getTableType().getName() + "]]");
|
||||||
|
System.out.println("Last table id=" + lastTable.getId()
|
||||||
|
+ ", name=" + lastTable.getName());
|
||||||
|
for (Column col : lastTable.getColumns()) {
|
||||||
|
System.out.println("Column: [name:" + col.getName()
|
||||||
|
+ ", localId:" + col.getLocalId() + ", dataType:"
|
||||||
|
+ col.getDataType() + "]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("TabularResource: [ id=" + tr.getId().getValue()+", lastTable= "+lastTable+"]");
|
System.out.println("TabularResource: [ id="
|
||||||
|
+ tr.getId().getValue() + ", lastTable= " + lastTable
|
||||||
|
+ "]");
|
||||||
|
|
||||||
}
|
}
|
||||||
for(TabularResourceMetadata<?> meta:metas){
|
for (TabularResourceMetadata<?> meta : metas) {
|
||||||
System.out.println("Meta: "+meta);
|
System.out.println("Meta: " + meta);
|
||||||
}
|
}
|
||||||
System.out.println("---------------------------------");
|
System.out.println("---------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue