@@ -0,0 +1,2548 @@
+/*%0A * Licensed to Elasticsearch under one or more contributor%0A * license agreements. See the NOTICE file distributed with%0A * this work for additional information regarding copyright%0A * ownership. Elasticsearch licenses this file to you under%0A * the Apache License, Version 2.0 (the %22License%22); you may%0A * not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied.  See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0Apackage org.elasticsearch.common.util;%0A%0Aimport org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider;%0Aimport org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;%0Aimport org.elasticsearch.common.inject.*;%0Aimport org.elasticsearch.common.settings.Settings;%0Aimport org.elasticsearch.test.ESTestCase;%0A%0Aimport java.util.Set;%0Aimport java.util.concurrent.atomic.AtomicInteger;%0A%0Apublic class ExtensionPointTests extends ESTestCase %7B%0A%0A    public void testClassSet() %7B%0A        final ExtensionPoint.ClassSet%3CAllocationDecider%3E allocationDeciders = new ExtensionPoint.ClassSet%3C%3E(%22allocation_decider%22, AllocationDecider.class, AllocationDeciders.class);%0A        allocationDeciders.registerExtension(TestAllocationDecider.class);%0A        Injector injector = new ModulesBuilder().add(new Module() %7B%0A            @Override%0A            public void configure(Binder binder) %7B%0A                binder.bind(Settings.class).toInstance(Settings.EMPTY);%0A                binder.bind(Consumer.class).asEagerSingleton();%0A                allocationDeciders.bind(binder);%0A            %7D%0A        %7D).createInjector();%0A        assertEquals(1, TestAllocationDecider.instances.get());%0A%0A    %7D%0A%0A    public static class Consumer %7B%0A        @Inject%0A        public Consumer(Set%3CAllocationDecider%3E deciders, TestAllocationDecider other) %7B%0A            // we require the TestAllocationDecider more than once to ensure it's bound as a singleton%0A        %7D%0A    %7D%0A%0A    public static class TestAllocationDecider extends AllocationDecider %7B%0A        static final AtomicInteger instances = new AtomicInteger(0);%0A%0A        @Inject%0A        public TestAllocationDecider(Settings settings) %7B%0A            super(settings);%0A            instances.incrementAndGet();%0A        %7D%0A    %7D%0A%7D%0A

Add test for #14232