use of org.commonjava.indy.conf.DefaultIndyConfiguration in project indy by Commonjava.
the class ExpiringMemoryNotFoundCacheTest method expireUsingConfiguredValue_DirectCheckDoesntAffectAggregateChecks.
@Test
public void expireUsingConfiguredValue_DirectCheckDoesntAffectAggregateChecks() throws Exception {
final DefaultIndyConfiguration config = new DefaultIndyConfiguration();
config.setNotFoundCacheTimeoutSeconds(1);
final ExpiringMemoryNotFoundCache nfc = new ExpiringMemoryNotFoundCache(config);
final ConcreteResource res = new ConcreteResource(new SimpleLocation("test:uri"), "/path/to/expired/object");
nfc.addMissing(res);
assertThat(nfc.isMissing(res), equalTo(true));
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
Set<String> locMissing = nfc.getMissing(res.getLocation());
assertThat(locMissing == null || locMissing.isEmpty(), equalTo(true));
Map<Location, Set<String>> allMissing = nfc.getAllMissing();
assertThat(allMissing == null || allMissing.isEmpty(), equalTo(true));
assertThat(nfc.isMissing(res), equalTo(false));
locMissing = nfc.getMissing(res.getLocation());
assertThat(locMissing == null || locMissing.isEmpty(), equalTo(true));
allMissing = nfc.getAllMissing();
assertThat(allMissing == null || allMissing.isEmpty(), equalTo(true));
}
use of org.commonjava.indy.conf.DefaultIndyConfiguration in project indy by Commonjava.
the class LegacyDataMigrationActionTest method setup.
@Before
public void setup() throws Exception {
dfm = new DataFileManager(temp.newFolder("stores"), new DataFileEventManager());
IndyObjectMapper mapper = new IndyObjectMapper(true);
final StoreEventDispatcher sed = new StoreEventDispatcherStub();
action = new LegacyDataMigrationAction(dfm, new DataFileStoreDataManager(dfm, mapper, sed, new DefaultIndyConfiguration()), mapper);
}
use of org.commonjava.indy.conf.DefaultIndyConfiguration in project indy by Commonjava.
the class ConcurrencyTest method deadlockOnListAllDuringDelete.
@BMRules(rules = { @BMRule(name = "init rendezvous", targetClass = "MemoryStoreDataManager", targetMethod = "<init>", targetLocation = "ENTRY", action = "createRendezvous($0, 2)"), @BMRule(name = "delete call", targetClass = "MemoryStoreDataManager", targetMethod = "deleteArtifactStore", targetLocation = "EXIT", action = "rendezvous($0); debug(Thread.currentThread().getName() + \": deletion thread proceeding.\")"), @BMRule(name = "streamArtifactStores call", targetClass = "MemoryStoreDataManager", targetMethod = "streamArtifactStores", targetLocation = "ENTRY", action = "rendezvous($0); debug(Thread.currentThread().getName() + \": streamArtifactStores() thread proceeding.\")") })
@Test
public void deadlockOnListAllDuringDelete() throws IndyDataException, InterruptedException, ExecutionException {
ExecutorService executor = Executors.newFixedThreadPool(2);
ExecutorCompletionService<String> completionService = new ExecutorCompletionService<>(executor);
RemoteRepository repo = new RemoteRepository(MAVEN_PKG_KEY, "central", "http://repo.maven.apache.org/maven2");
TestDeletingEventDispatcher dispatcher = new TestDeletingEventDispatcher(completionService);
MemoryStoreDataManager dataManager = new MemoryStoreDataManager(dispatcher, new DefaultIndyConfiguration());
dispatcher.setDataManager(dataManager);
ChangeSummary summary = new ChangeSummary(ChangeSummary.SYSTEM_USER, "Test init");
dataManager.storeArtifactStore(repo, summary, false, false, new EventMetadata());
dataManager.deleteArtifactStore(repo.getKey(), new ChangeSummary(ChangeSummary.SYSTEM_USER, "Test deletion"), new EventMetadata());
Future<String> future = completionService.take();
assertThat(future.get(), nullValue());
}
Aggregations