Fix eclipse compilation problem (#26170)
This commit is contained in:
parent
3e3132fe3f
commit
6e085c75af
|
@ -216,28 +216,35 @@ public class ClusterModuleTests extends ModuleTestCase {
|
|||
assertTrue(customSuppliers.containsKey(RestoreInProgress.TYPE));
|
||||
assertTrue(customSuppliers.containsKey("foo"));
|
||||
|
||||
|
||||
IllegalStateException ise = expectThrows(IllegalStateException.class,
|
||||
() -> ClusterModule.getClusterStateCustomSuppliers(Collections.singletonList(new ClusterPlugin() {
|
||||
@Override
|
||||
public Map<String, Supplier<ClusterState.Custom>> getInitialClusterStateCustomSupplier() {
|
||||
return Collections.singletonMap(SnapshotsInProgress.TYPE, () -> null);
|
||||
}
|
||||
})));
|
||||
assertEquals(ise.getMessage(), "custom supplier key [snapshots] is registered more than once");
|
||||
|
||||
ise = expectThrows(IllegalStateException.class,
|
||||
() -> ClusterModule.getClusterStateCustomSuppliers(Arrays.asList(new ClusterPlugin() {
|
||||
@Override
|
||||
public Map<String, Supplier<ClusterState.Custom>> getInitialClusterStateCustomSupplier() {
|
||||
return Collections.singletonMap("foo", () -> null);
|
||||
}
|
||||
}, new ClusterPlugin() {
|
||||
@Override
|
||||
public Map<String, Supplier<ClusterState.Custom>> getInitialClusterStateCustomSupplier() {
|
||||
return Collections.singletonMap("foo", () -> null);
|
||||
}
|
||||
})));
|
||||
assertEquals(ise.getMessage(), "custom supplier key [foo] is registered more than once");
|
||||
{
|
||||
// Eclipse Neon 2 didn't compile the plugins definition inside the lambda expression,
|
||||
// probably due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=511750, which is
|
||||
// fixed in Eclipse Oxygon. Pulled out the plugins definition to make it work in older versions
|
||||
List<ClusterPlugin> plugins = Collections.singletonList(new ClusterPlugin() {
|
||||
@Override
|
||||
public Map<String, Supplier<ClusterState.Custom>> getInitialClusterStateCustomSupplier() {
|
||||
return Collections.singletonMap(SnapshotsInProgress.TYPE, () -> null);
|
||||
}
|
||||
});
|
||||
IllegalStateException ise = expectThrows(IllegalStateException.class,
|
||||
() -> ClusterModule.getClusterStateCustomSuppliers(plugins));
|
||||
assertEquals(ise.getMessage(), "custom supplier key [snapshots] is registered more than once");
|
||||
}
|
||||
{
|
||||
List<ClusterPlugin> plugins = Arrays.asList(new ClusterPlugin() {
|
||||
@Override
|
||||
public Map<String, Supplier<ClusterState.Custom>> getInitialClusterStateCustomSupplier() {
|
||||
return Collections.singletonMap("foo", () -> null);
|
||||
}
|
||||
}, new ClusterPlugin() {
|
||||
@Override
|
||||
public Map<String, Supplier<ClusterState.Custom>> getInitialClusterStateCustomSupplier() {
|
||||
return Collections.singletonMap("foo", () -> null);
|
||||
}
|
||||
});
|
||||
IllegalStateException ise = expectThrows(IllegalStateException.class,
|
||||
() -> ClusterModule.getClusterStateCustomSuppliers(plugins));
|
||||
assertEquals(ise.getMessage(), "custom supplier key [foo] is registered more than once");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue