From 83e70acd04e4e3f3bca5266c405e04d9e0f2e0e7 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 20 Nov 2013 16:12:03 +0000 Subject: [PATCH] Minor updated git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@85779 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../td/gwtservice/client/TestOperations.java | 31 -------------- .../client/TestServiceOperations.java | 41 ++++++++++++++++--- 2 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestOperations.java diff --git a/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestOperations.java b/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestOperations.java deleted file mode 100644 index c89c46d..0000000 --- a/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestOperations.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.client; - -import java.util.List; - - -import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.data.analysis.tabulardata.operation.worker.EligibleOperation; -import org.gcube.data.analysis.tabulardata.service.TabularDataService; -import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory; -import org.gcube.portlets.user.td.gwtservice.shared.Constants; -import org.junit.Assert; -import org.junit.Test; - -public class TestOperations { - - @Test - public void TestTROperation() { - ScopeProvider.instance.set(Constants.DEFAULT_SCOPE); - TabularDataService service = TabularDataServiceFactory - .getService(Constants.DEFAULT_USER); - List trOperations=service.getCapabilities(); - System.out.println("------------Tabular Resource Operation--------------"); - for(EligibleOperation operation: trOperations){ - System.out.println(operation.toString()); - } - Assert.assertTrue(trOperations.size()>0); - - - } - -} diff --git a/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestServiceOperations.java b/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestServiceOperations.java index 94b5dd9..1e025d4 100644 --- a/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestServiceOperations.java +++ b/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestServiceOperations.java @@ -2,11 +2,13 @@ package org.gcube.portlets.user.td.gwtservice.client; import java.util.List; - import org.gcube.common.scope.api.ScopeProvider; import org.gcube.data.analysis.tabulardata.operation.worker.EligibleOperation; import org.gcube.data.analysis.tabulardata.service.TabularDataService; +import org.gcube.data.analysis.tabulardata.service.exception.InvalidTabularResourceException; +import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTabularResourceException; import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory; +import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource; import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.junit.Assert; import org.junit.Test; @@ -18,14 +20,43 @@ public class TestServiceOperations { ScopeProvider.instance.set(Constants.DEFAULT_SCOPE); TabularDataService service = TabularDataServiceFactory .getService(Constants.DEFAULT_USER); - List trOperations=service.getCapabilities(); - System.out.println("------------Tabular Resource Operation--------------"); - for(EligibleOperation operation: trOperations){ + List trOperations = service.getCapabilities(); + Assert.assertTrue(trOperations.size() > 0); + System.out + .println("------------Tabular Resource Operation--------------"); + for (EligibleOperation operation : trOperations) { System.out.println(operation.toString()); } - Assert.assertTrue(trOperations.size()>0); + List trs = service.getTabularResources(); + Assert.assertTrue(trs.size() > 0); + System.out + .println("------------Tabular Resource--------------"); + for (TabularResource tr : trs) { + System.out.println("TabularResource:"+tr.getId()); + } + + List tableOperations = null; + try { + tableOperations = service.getCapabilities(trs.get(0).getId()); + } catch (NoSuchTabularResourceException e) { + e.printStackTrace(); + Assert.fail("No Tabular Resource on Service: " + + e.getLocalizedMessage()); + } catch (InvalidTabularResourceException e) { + e.printStackTrace(); + Assert.fail("Invalid Tabular Resource on Service: " + + e.getLocalizedMessage()); + } + Assert.assertTrue("No operations present", + tableOperations.size() > 0); + + System.out.println("------------Table Operation--------------"); + for (EligibleOperation operation : tableOperations) { + System.out.println(operation.toString()); + } + } }