use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class FusionIndexProviderTest method shouldReportFailedIfAnyIsFailed.
@Test
void shouldReportFailedIfAnyIsFailed() {
// given
IndexProvider provider = fusionIndexProvider;
for (InternalIndexState state : InternalIndexState.values()) {
for (IndexProvider failedProvider : aliveProviders) {
// when
for (IndexProvider aliveProvider : aliveProviders) {
setInitialState(aliveProvider, failedProvider == aliveProvider ? InternalIndexState.FAILED : state);
}
InternalIndexState initialState = provider.getInitialState(AN_INDEX, NULL);
// then
assertEquals(InternalIndexState.FAILED, initialState);
}
}
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class FusionIndexProviderTest method getPopulationFailureMustReportFailureWhenMultipleFail.
@Test
void getPopulationFailureMustReportFailureWhenMultipleFail() {
// when
List<String> failureMessages = new ArrayList<>();
for (IndexProvider aliveProvider : aliveProviders) {
String failureMessage = "FAILURE[" + aliveProvider + "]";
failureMessages.add(failureMessage);
when(aliveProvider.getPopulationFailure(any(IndexDescriptor.class), any(CursorContext.class))).thenReturn(failureMessage);
}
// then
String populationFailure = fusionIndexProvider.getPopulationFailure(AN_INDEX, NULL);
for (String failureMessage : failureMessages) {
assertThat(populationFailure).contains(failureMessage);
}
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class FusionIndexProviderTest method getPopulationFailureMustReportFailureWhenAnyFailed.
@Test
void getPopulationFailureMustReportFailureWhenAnyFailed() {
for (IndexProvider failingProvider : aliveProviders) {
// when
String failure = "failure";
for (IndexProvider provider : aliveProviders) {
if (provider == failingProvider) {
when(provider.getPopulationFailure(any(IndexDescriptor.class), any(CursorContext.class))).thenReturn(failure);
} else {
when(provider.getPopulationFailure(any(IndexDescriptor.class), any(CursorContext.class))).thenReturn(StringUtils.EMPTY);
}
}
// then
assertThat(fusionIndexProvider.getPopulationFailure(AN_INDEX, NULL)).contains(failure);
}
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class FusionIndexProviderTest method shouldReportPopulatingIfAnyIsPopulating.
@Test
void shouldReportPopulatingIfAnyIsPopulating() {
// given
for (InternalIndexState state : array(InternalIndexState.ONLINE, InternalIndexState.POPULATING)) {
for (IndexProvider populatingProvider : aliveProviders) {
// when
for (IndexProvider aliveProvider : aliveProviders) {
setInitialState(aliveProvider, populatingProvider == aliveProvider ? InternalIndexState.POPULATING : state);
}
InternalIndexState initialState = fusionIndexProvider.getInitialState(AN_INDEX, NULL);
// then
assertEquals(InternalIndexState.POPULATING, initialState);
}
}
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class FusionSlotSelectorTest method throwIfToManyInstances.
@Test
void throwIfToManyInstances() {
// given
EnumMap<IndexSlot, IndexProvider> instances = new EnumMap<>(IndexSlot.class);
for (IndexSlot indexSlot : IndexSlot.values()) {
instances.put(indexSlot, IndexProvider.EMPTY);
}
IndexProvider mockedIndxProvider = mock(IndexProvider.class);
instances.put(GENERIC, mockedIndxProvider);
InstanceSelector<IndexProvider> instanceSelector = new InstanceSelector<>(instances);
// when, then
assertThrows(IllegalArgumentException.class, () -> validateSelectorInstances(instanceSelector));
}
Aggregations