2016-02-10 15:15:01 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.accounting.analytics.persistence;
|
|
|
|
|
2017-07-14 11:11:50 +02:00
|
|
|
import org.gcube.accounting.analytics.persistence.couchbase.AccountingPersistenceQueryCouchBase;
|
2016-02-10 15:15:01 +01:00
|
|
|
import org.gcube.accounting.persistence.AccountingPersistenceConfiguration;
|
2016-02-17 14:17:31 +01:00
|
|
|
import org.gcube.testutility.ScopedTest;
|
2016-02-10 15:15:01 +01:00
|
|
|
import org.junit.Test;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
/**
|
2016-10-12 14:24:02 +02:00
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
2016-02-10 15:15:01 +01:00
|
|
|
*
|
|
|
|
*/
|
2016-02-12 17:56:12 +01:00
|
|
|
public class AccountingPersistenceQueryConfigurationTest extends ScopedTest {
|
2016-02-10 15:15:01 +01:00
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(AccountingPersistenceQueryConfigurationTest.class);
|
2017-07-14 11:11:50 +02:00
|
|
|
|
2016-02-10 15:15:01 +01:00
|
|
|
@Test
|
2016-02-10 16:01:43 +01:00
|
|
|
public void accountingPersistenceQueryCouchDBConfigurationTest() throws Exception {
|
2017-07-14 11:11:50 +02:00
|
|
|
AccountingPersistenceBackendQueryConfiguration acbqc = new AccountingPersistenceBackendQueryConfiguration(
|
|
|
|
AccountingPersistenceQueryCouchBase.class);
|
2016-02-10 15:15:01 +01:00
|
|
|
logger.debug("{}", acbqc);
|
|
|
|
}
|
2017-07-14 11:11:50 +02:00
|
|
|
|
|
|
|
// @Test
|
|
|
|
public void getUsernamePasswordForScopes() throws Exception {
|
2016-02-10 15:15:01 +01:00
|
|
|
try {
|
2017-07-14 11:11:50 +02:00
|
|
|
AccountingPersistenceBackendQueryConfiguration persitenceConfiguration = new AccountingPersistenceBackendQueryConfiguration(
|
|
|
|
AccountingPersistenceQueryCouchBase.class);
|
2016-02-10 15:15:01 +01:00
|
|
|
String uri = persitenceConfiguration.getProperty(AccountingPersistenceConfiguration.URL_PROPERTY_KEY);
|
2017-07-14 11:11:50 +02:00
|
|
|
String username = persitenceConfiguration
|
|
|
|
.getProperty(AccountingPersistenceConfiguration.USERNAME_PROPERTY_KEY);
|
|
|
|
String password = persitenceConfiguration
|
|
|
|
.getProperty(AccountingPersistenceConfiguration.PASSWORD_PROPERTY_KEY);
|
|
|
|
logger.debug("{} {} - {} : {}", ScopedTest.getCurrentContext(), uri, username, password);
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
logger.debug("No AccountingPersistenceConfiguration : \n {} {} \n\n", e.getClass().getName(),
|
|
|
|
e.getMessage());
|
|
|
|
} catch (Exception e) {
|
2016-02-10 15:15:01 +01:00
|
|
|
logger.error("Error getting AccountingPersistenceConfiguration", e);
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
2017-07-14 11:11:50 +02:00
|
|
|
|
2016-02-10 15:15:01 +01:00
|
|
|
}
|