@@ -0,0 +1,2460 @@
+/*%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 */%0A%0Apackage org.elasticsearch.ingest;%0A%0Aimport org.elasticsearch.test.ESTestCase;%0A%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Aimport static org.hamcrest.CoreMatchers.equalTo;%0A%0Apublic class ProcessorsRegistryTests extends ESTestCase %7B%0A%0A    public void testAddProcessor() %7B%0A        ProcessorsRegistry processorsRegistry = new ProcessorsRegistry();%0A        TestProcessor.Factory factory1 = new TestProcessor.Factory();%0A        processorsRegistry.addProcessor(%221%22, (environment, templateService) -%3E factory1);%0A        TestProcessor.Factory factory2 = new TestProcessor.Factory();%0A        processorsRegistry.addProcessor(%222%22, (environment, templateService) -%3E factory2);%0A        TestProcessor.Factory factory3 = new TestProcessor.Factory();%0A        try %7B%0A            processorsRegistry.addProcessor(%221%22, (environment, templateService) -%3E factory3);%0A            fail(%22addProcessor should have failed%22);%0A        %7D catch(IllegalArgumentException e) %7B%0A            assertThat(e.getMessage(), equalTo(%22Processor factory already registered for name %5B1%5D%22));%0A        %7D%0A%0A        Set%3CMap.Entry%3CString, ProcessorFactoryProvider%3E%3E entrySet = processorsRegistry.entrySet();%0A        assertThat(entrySet.size(), equalTo(2));%0A        for (Map.Entry%3CString, ProcessorFactoryProvider%3E entry : entrySet) %7B%0A            if (entry.getKey().equals(%221%22)) %7B%0A                assertThat(entry.getValue().apply(null, null), equalTo(factory1));%0A            %7D else if (entry.getKey().equals(%222%22)) %7B%0A                assertThat(entry.getValue().apply(null, null), equalTo(factory2));%0A            %7D else %7B%0A                fail(%22unexpected processor id %5B%22 + entry.getKey() + %22%5D%22);%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

add test for ProcessorsRegistry