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

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

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

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

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

Loading…
Cancel
Save