package org.axonframework.axonserver.connector.processor.grpc;

import com.google.common.collect.ImmutableMap;
import io.axoniq.axonserver.grpc.control.PlatformInboundInstruction;
import org.axonframework.axonserver.connector.AxonServerConnectionManager;
import org.axonframework.config.EventProcessingConfiguration;
import org.axonframework.eventhandling.EventProcessor;
import org.axonframework.eventhandling.TrackingEventProcessor;
import org.junit.jupiter.api.*;

import java.util.Map;

import static org.mockito.Mockito.*;

/**
 * Unit test to verify expected behaviour of the {@link GrpcEventProcessorInfoSource}.
 *
 * @author Steven van Beelen
 */
class GrpcEventProcessorInfoSourceTest {

    private static final String BOUNDED_CONTEXT = "some-context";

    private final EventProcessingConfiguration eventProcessingConfiguration = mock(EventProcessingConfiguration.class);
    private final AxonServerConnectionManager axonServerConnectionManager = mock(AxonServerConnectionManager.class);

    private GrpcEventProcessorInfoSource testSubject = new GrpcEventProcessorInfoSource(
            eventProcessingConfiguration, axonServerConnectionManager, BOUNDED_CONTEXT
    );

    @Test
    void testNotifyInformation() {
        EventProcessor mockEventProcessor = mock(TrackingEventProcessor.class);
        when(mockEventProcessor.getName()).thenReturn("eventProcessor");
        Map<String, EventProcessor> testEventProcessors = ImmutableMap.of("eventProcessor", mockEventProcessor);
        when(eventProcessingConfiguration.eventProcessors()).thenReturn(testEventProcessors);

        testSubject.notifyInformation();

        verify(eventProcessingConfiguration).eventProcessors();
        verify(axonServerConnectionManager).send(eq(BOUNDED_CONTEXT), any(PlatformInboundInstruction.class));
    }
}
@@ -1,8 +1,616 @@
+/*%0A * Copyright (c) 2010-2020. Axon Framework%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may 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, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0A
 package 
@@ -1616,16 +1616,22 @@
 private 
+final 
 GrpcEven
@@ -1847,16 +1847,24 @@
         
+Tracking
 EventPro
@@ -2000,16 +2000,111 @@
 ssor%22);%0A
+        when(mockEventProcessor.getTokenStoreIdentifier()).thenReturn(%22tokenStoreIdentifier%22);%0A
         

Fix test case