diff --git a/src/main/java/org/gcube/accounting/persistence/Persistence.java b/src/main/java/org/gcube/accounting/persistence/Persistence.java index 5d3f993..8f46c8a 100644 --- a/src/main/java/org/gcube/accounting/persistence/Persistence.java +++ b/src/main/java/org/gcube/accounting/persistence/Persistence.java @@ -63,18 +63,25 @@ public abstract class Persistence { continue; } try { - logger.debug(String.format("Testing %s", persistence.getClass().getSimpleName())); + logger.debug(String.format("Testing %s", foundPersistence.getClass().getSimpleName())); foundPersistence.prepareConnection(); + /* + * Uncomment the following line of code if you want to try + * to create a test UsageRecord before setting the + * foundPersistence as default + * + * foundPersistence.accountWithFallback(TestUsageRecord.createTestServiceUsageRecord()); + */ persistence = foundPersistence; break; } catch (Exception e) { logger.debug(String.format("%s not initialized correctly. It will not be used", foundPersistence.getClass().getSimpleName())); + } } if(persistence==null){ persistence = fallback; } - //persistence.accountWithFallback(TestUsageRecord.createTestServiceUsageRecord()); } catch(Exception e){ logger.error("Unable to instance a Persistence Implementation. Using fallback as default", e.getCause());