Added test
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@120070 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ba74d231a4
commit
8ee5fedccd
6
pom.xml
6
pom.xml
|
@ -81,6 +81,12 @@
|
||||||
<version>1.0.13</version>
|
<version>1.0.13</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.core</groupId>
|
||||||
|
<artifactId>common-encryption</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1,43 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.accounting.analytics.persistence;
|
||||||
|
|
||||||
|
import org.gcube.accounting.persistence.AccountingPersistenceConfiguration;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AccountingPersistenceConfigurationTest {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(AccountingPersistenceConfigurationTest.class);
|
||||||
|
|
||||||
|
public static final String COUCHDB_CLASS_NAME = "AccountingPersistenceQueryCouchDB";
|
||||||
|
|
||||||
|
public static final String[] SCOPES = new String[]{"/gcube", "/gcube/devNext", "/gcube/devsec"};
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getUsernamePasswordForScopes() throws Exception{
|
||||||
|
for(String scope : SCOPES){
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
try {
|
||||||
|
AccountingPersistenceConfiguration persitenceConfiguration = new AccountingPersistenceConfiguration(COUCHDB_CLASS_NAME);
|
||||||
|
logger.debug("{} {} - {} : {}", scope,
|
||||||
|
persitenceConfiguration.getUri(),
|
||||||
|
persitenceConfiguration.getUsername(),
|
||||||
|
persitenceConfiguration.getPassword());
|
||||||
|
}catch(IndexOutOfBoundsException e){
|
||||||
|
logger.debug("No AccountingPersistenceConfiguration : \n {} {} \n\n", e.getClass().getName(), e.getMessage());
|
||||||
|
} catch(Exception e){
|
||||||
|
logger.error("Error getting AccountingPersistenceConfiguration", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue