Improved test

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@161983 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-01-08 11:50:35 +00:00
parent 53a47e7eb9
commit 92e0101d0f
1 changed files with 19 additions and 8 deletions

View File

@ -53,7 +53,7 @@ public class PersistenceBackendMonitorTest extends ScopedTest {
throw new RuntimeException(e);
}
}
});
}, 3);
logger.debug(" START -----------------------------------------------");
logger.debug("Flushing the buffered records");
@ -61,21 +61,32 @@ public class PersistenceBackendMonitorTest extends ScopedTest {
logger.debug(" END -----------------------------------------------");
PersistenceBackend persistenceBackend = PersistenceBackendFactory.getPersistenceBackend(ScopedTest.getCurrentContext());
persistenceBackend.setFallback((FallbackPersistenceBackend) persistenceBackend);
FallbackMonitor temporalDataPersistenceBackendMonitor = new FallbackMonitor(persistenceBackend);
temporalDataPersistenceBackendMonitor.run();
if(persistenceBackend instanceof FallbackPersistenceBackend) {
/* This line has no sense in real scenario is only used to avoid null pointer exception in test because
* the test has no time to get the real persistence
*/
persistenceBackend.setFallback((FallbackPersistenceBackend) persistenceBackend);
}
FallbackMonitor fallbackMonitor = new FallbackMonitor(persistenceBackend, false);
fallbackMonitor.run();
logger.debug("{} finished", FallbackMonitor.class.getSimpleName());
}
@Test
public void singleParsingTest() throws Exception {
PersistenceBackendFactory.setFallbackLocation(null);
PersistenceBackend persistenceBackend = PersistenceBackendFactory.getPersistenceBackend(ScopedTest.getCurrentContext());
//persistenceBackend.setFallback((FallbackPersistenceBackend) persistenceBackend);
FallbackMonitor temporalDataPersistenceBackendMonitor = new FallbackMonitor(persistenceBackend);
temporalDataPersistenceBackendMonitor.run();
if(persistenceBackend instanceof FallbackPersistenceBackend) {
/* This line has no sense in real scenario is only used to avoid null pointer exception in test because
* the test has no time to get the real persistence
*/
persistenceBackend.setFallback((FallbackPersistenceBackend) persistenceBackend);
}
FallbackMonitor fallbackMonitor = new FallbackMonitor(persistenceBackend);
fallbackMonitor.run();
}
}