From 1c63b51b8f1d4f218accf007b94af6c78d31fb7e Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 9 Feb 2016 16:21:07 +0000 Subject: [PATCH] refs #2112: Port SmartExecutor to be compliant with new Authorization https://support.d4science.org/issues/2112 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor-client@124007 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../executor/client/DefaultExecutorTest.java | 10 ++++++++-- .../executor/client/QueriedClientTest.java | 10 ++++++++-- .../client/SmartGenericWorkerDiscoveryQuery.java | 10 ++++++++-- .../vremanagement/executor/client/TestUtility.java | 14 ++++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 src/test/java/org/gcube/vremanagement/executor/client/TestUtility.java diff --git a/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java b/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java index 18337ad..63f6b5c 100644 --- a/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java @@ -17,6 +17,7 @@ import org.gcube.vremanagement.executor.client.proxies.SmartExecutorProxy; import org.gcube.vremanagement.executor.exception.PluginInstanceNotFoundException; import org.gcube.vremanagement.executor.exception.PluginNotFoundException; import org.gcube.vremanagement.executor.plugin.PluginState; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -34,12 +35,17 @@ public class DefaultExecutorTest { private SmartExecutorProxy proxy; @Before - public void init(){ - SecurityTokenProvider.instance.set("82a84741-debe-4c90-a907-c429c8272071"); + public void bfore(){ + SecurityTokenProvider.instance.set(TestUtility.TOKEN); proxy = ExecutorPlugin.getExecutorProxy().build(); Assert.assertNotNull(proxy); } + @After + public void after(){ + SecurityTokenProvider.instance.reset(); + } + @Test public void launch() { Map inputs = new HashMap(); diff --git a/src/test/java/org/gcube/vremanagement/executor/client/QueriedClientTest.java b/src/test/java/org/gcube/vremanagement/executor/client/QueriedClientTest.java index 2607021..ddabb93 100644 --- a/src/test/java/org/gcube/vremanagement/executor/client/QueriedClientTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/client/QueriedClientTest.java @@ -21,6 +21,7 @@ import org.gcube.vremanagement.executor.client.plugins.query.filter.RandomEndpoi import org.gcube.vremanagement.executor.client.plugins.query.filter.SpecificEndpointDiscoveryFilter; import org.gcube.vremanagement.executor.client.proxies.SmartExecutorProxy; import org.gcube.vremanagement.executor.client.util.Tuple; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -36,8 +37,13 @@ public class QueriedClientTest { private static Logger logger = LoggerFactory.getLogger(QueriedClientTest.class); @Before - public void before() throws Exception{ - SecurityTokenProvider.instance.set("82a84741-debe-4c90-a907-c429c8272071"); + public void bfore(){ + SecurityTokenProvider.instance.set(TestUtility.TOKEN); + } + + @After + public void after(){ + SecurityTokenProvider.instance.reset(); } private void launchTest(SmartExecutorProxy proxy) throws Exception { diff --git a/src/test/java/org/gcube/vremanagement/executor/client/SmartGenericWorkerDiscoveryQuery.java b/src/test/java/org/gcube/vremanagement/executor/client/SmartGenericWorkerDiscoveryQuery.java index abb53c0..0eac038 100644 --- a/src/test/java/org/gcube/vremanagement/executor/client/SmartGenericWorkerDiscoveryQuery.java +++ b/src/test/java/org/gcube/vremanagement/executor/client/SmartGenericWorkerDiscoveryQuery.java @@ -10,6 +10,7 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.vremanagement.executor.client.plugins.ExecutorPlugin; import org.gcube.vremanagement.executor.client.plugins.query.SmartExecutorPluginQuery; import org.gcube.vremanagement.executor.client.plugins.query.filter.ListEndpointDiscoveryFilter; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; @@ -24,8 +25,13 @@ public class SmartGenericWorkerDiscoveryQuery { private static Logger logger = LoggerFactory.getLogger(SmartGenericWorkerDiscoveryQuery.class); @Before - public void before() throws Exception{ - SecurityTokenProvider.instance.set("82a84741-debe-4c90-a907-c429c8272071"); + public void bfore(){ + SecurityTokenProvider.instance.set(TestUtility.TOKEN); + } + + @After + public void after(){ + SecurityTokenProvider.instance.reset(); } @Test diff --git a/src/test/java/org/gcube/vremanagement/executor/client/TestUtility.java b/src/test/java/org/gcube/vremanagement/executor/client/TestUtility.java new file mode 100644 index 0000000..c319fae --- /dev/null +++ b/src/test/java/org/gcube/vremanagement/executor/client/TestUtility.java @@ -0,0 +1,14 @@ +/** + * + */ +package org.gcube.vremanagement.executor.client; + +/** + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + * + */ +public class TestUtility { + + public static final String TOKEN = ""; + +}