refs #2201: Remove the use of ScopeProvider if any from accounting-lib

https://support.d4science.org/issues/2201

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@124021 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-02-09 17:55:16 +00:00
parent 67667da8d1
commit 1a10ead141
10 changed files with 56 additions and 22 deletions

View File

@ -8,9 +8,11 @@ import java.util.Set;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecordTest;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.gcube.documentstore.exception.NotAggregatableRecordsExceptions;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -27,7 +29,12 @@ public class AggregatedServiceUsageRecordTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}
@Test

View File

@ -6,9 +6,11 @@ package org.gcube.accounting.datamodel.aggregation;
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.gcube.documentstore.exception.NotAggregatableRecordsExceptions;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -25,7 +27,12 @@ public class AggregatedStorageUsageRecordTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}
@Test

View File

@ -9,6 +9,7 @@ import java.util.Set;
import org.gcube.accounting.datamodel.UsageRecord;
import org.gcube.accounting.datamodel.basetypes.AbstractJobUsageRecord;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.gcube.documentstore.records.Record;
@ -29,11 +30,11 @@ public class JobUsageRecordTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after(){
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}

View File

@ -9,6 +9,7 @@ import java.util.Set;
import org.gcube.accounting.datamodel.UsageRecord;
import org.gcube.accounting.datamodel.basetypes.AbstractServiceUsageRecord;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.gcube.documentstore.records.Record;
@ -29,11 +30,11 @@ public class ServiceUsageRecordTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after(){
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}

View File

@ -9,6 +9,7 @@ import java.util.Set;
import org.gcube.accounting.datamodel.UsageRecord;
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.gcube.documentstore.records.Record;
@ -29,11 +30,11 @@ public class StorageUsageRecordTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after(){
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}

View File

@ -9,6 +9,7 @@ import java.util.Set;
import org.gcube.accounting.datamodel.UsageRecord;
import org.gcube.accounting.datamodel.basetypes.AbstractTaskUsageRecord;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.gcube.documentstore.records.Record;
@ -29,11 +30,11 @@ public class TaskUsageRecordTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after(){
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}

View File

@ -0,0 +1,14 @@
/**
*
*/
package org.gcube.accounting.testutility;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class TestUtility {
public static final String TOKEN = "";
}

View File

@ -10,6 +10,7 @@ import org.gcube.accounting.datamodel.UsageRecord;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.testutility.StressTestUtility;
import org.gcube.accounting.testutility.TestOperation;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.junit.After;
@ -31,15 +32,14 @@ public class PersistenceBackendMonitorTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after(){
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}
@Test
public void parsingTest() throws Exception {
PersistenceBackendFactory.setFallbackLocation(null);

View File

@ -11,11 +11,12 @@ import org.gcube.accounting.datamodel.UsageRecord;
import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.testutility.StressTestUtility;
import org.gcube.accounting.testutility.TestOperation;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.exception.InvalidValueException;
import org.junit.AfterClass;
import org.junit.After;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,13 +37,13 @@ public class PersistenceBackendTest {
public static final TimeUnit timeUnit = TimeUnit.MILLISECONDS;
@BeforeClass
public static void before() throws Exception{
SecurityTokenProvider.instance.set("");
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@AfterClass
public static void after(){
@After
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}

View File

@ -12,6 +12,7 @@ import org.gcube.accounting.datamodel.basetypes.TestUsageRecord;
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
import org.gcube.accounting.testutility.StressTestUtility;
import org.gcube.accounting.testutility.TestOperation;
import org.gcube.accounting.testutility.TestUtility;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.documentstore.persistence.PersistenceExecutor;
import org.gcube.documentstore.records.AggregatedRecord;
@ -33,11 +34,11 @@ public class AggregationSchedulerTest {
@Before
public void before() throws Exception{
SecurityTokenProvider.instance.set("");
SecurityTokenProvider.instance.set(TestUtility.TOKEN);
}
@After
public void after(){
public void after() throws Exception{
SecurityTokenProvider.instance.reset();
}