Fixing plugin

Luca Frosini 3 years ago
parent ec18c46c82
commit c21b7143dd

@ -16,6 +16,7 @@ import org.gcube.accounting.accounting.summary.access.AccountingDao;
import org.gcube.accounting.accounting.summary.access.model.ScopeDescriptor;
import org.gcube.accounting.accounting.summary.access.model.internal.Dimension;
import org.gcube.accounting.accounting.summary.access.model.update.AccountingRecord;
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
@ -78,7 +79,7 @@ public class AccountingDashboardHarvesterPlugin extends Plugin {
super();
}
private static final InheritableThreadLocal<Properties> properties = new InheritableThreadLocal<Properties>() {
private static final InheritableThreadLocal<Properties> configProperties = new InheritableThreadLocal<Properties>() {
@Override
protected Properties initialValue() {
@ -87,8 +88,8 @@ public class AccountingDashboardHarvesterPlugin extends Plugin {
};
public static InheritableThreadLocal<Properties> getProperties() {
return properties;
public static InheritableThreadLocal<Properties> getConfigProperties() {
return configProperties;
}
public static Dimension getDimension(String key) {
@ -134,6 +135,7 @@ public class AccountingDashboardHarvesterPlugin extends Plugin {
};
@JsonIgnore
public Properties getConfigParameters() throws IOException {
Properties properties = new Properties();
try {
@ -209,7 +211,7 @@ public class AccountingDashboardHarvesterPlugin extends Plugin {
DateUtils.format(end), reRun, getVREUsers, dryRun);
Properties properties = getConfigParameters();
getProperties().set(properties);
getConfigProperties().set(properties);
ContextAuthorization contextAuthorization = new ContextAuthorization();

@ -77,7 +77,7 @@ public abstract class SoBigDataHarvester extends BasicHarvester {
* @throws ObjectNotFound
*/
protected void initMappingMaps() throws ObjectNotFound, Exception {
Properties properties = AccountingDashboardHarvesterPlugin.getProperties().get();
Properties properties = AccountingDashboardHarvesterPlugin.getConfigProperties().get();
Set<String> keys = properties.stringPropertyNames();
mapSystemTypeToDBEntry = new HashMap<String,String>();

@ -52,7 +52,7 @@ public class ContextAuthorization {
public String generateTokenForContext(String context, Properties properties) throws Exception {
if(properties==null) {
properties = AccountingDashboardHarvesterPlugin.getProperties().get();
properties = AccountingDashboardHarvesterPlugin.getConfigProperties().get();
}
logger.info("Going to generate Token for Context {}", context);
UserInfo userInfo = new UserInfo(properties.getProperty(USERNAME, DEFAULT_USERNAME),
@ -74,7 +74,7 @@ public class ContextAuthorization {
try {
Properties properties = AccountingDashboardHarvesterPlugin.getProperties().get();
Properties properties = AccountingDashboardHarvesterPlugin.getConfigProperties().get();
LinkedHashMap<String,ScopeBean> map = ContextManager.readContexts();
for(String scope : map.keySet()) {

@ -225,7 +225,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
Properties properties = accountingDataHarvesterPlugin.getConfigParameters();
AccountingDashboardHarvesterPlugin.getProperties().set(properties);
AccountingDashboardHarvesterPlugin.getConfigProperties().set(properties);
ContextAuthorization contextAuthorization = new ContextAuthorization();
SortedSet<String> contexts = contextAuthorization.getContexts();
@ -506,7 +506,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
Properties properties = accountingDataHarvesterPlugin.getConfigParameters();
AccountingDashboardHarvesterPlugin.getProperties().set(properties);
AccountingDashboardHarvesterPlugin.getConfigProperties().set(properties);
ContextAuthorization contextAuthorization = new ContextAuthorization();
@ -711,7 +711,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin();
Properties properties = accountingDataHarvesterPlugin.getConfigParameters();
AccountingDashboardHarvesterPlugin.getProperties().set(properties);
AccountingDashboardHarvesterPlugin.getConfigProperties().set(properties);
// AccountingDao dao = AccountingDao.get();
@ -931,7 +931,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
AccountingDashboardHarvesterPlugin adhp = new AccountingDashboardHarvesterPlugin();
Properties properties = adhp.getConfigParameters();
AccountingDashboardHarvesterPlugin.getProperties().set(properties);
AccountingDashboardHarvesterPlugin.getConfigProperties().set(properties);
ContextAuthorization contextAuthorization = new ContextAuthorization();

@ -24,7 +24,7 @@ public class ContextAuthorizationTest extends ContextTest {
properties = new Properties();
InputStream input = AccountingDashboardHarvesterPlugin.class.getClassLoader().getResourceAsStream(PROPERTY_FILENAME);
properties.load(input);
AccountingDashboardHarvesterPlugin.getProperties().set(properties);
AccountingDashboardHarvesterPlugin.getConfigProperties().set(properties);
}
@Ignore

Loading…
Cancel
Save