File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed 
operator-framework-core/src 
main/java/io/javaoperatorsdk/operator/processing/event 
test/java/io/javaoperatorsdk/operator/processing/event Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 1616
1717class  EventSources <R  extends  HasMetadata > implements  Iterable <NamedEventSource > {
1818
19+   private  static  final  String  CONTROLLER_EVENT_SOURCE_KEY  = "0" ;
1920  private  final  ConcurrentNavigableMap <String , Map <String , EventSource >> sources  =
2021      new  ConcurrentSkipListMap <>();
2122  private  final  TimerEventSource <R > retryAndRescheduleTimerEventSource  = new  TimerEventSource <>();
@@ -80,6 +81,9 @@ private Class<?> getResourceType(EventSource source) {
8081  }
8182
8283  private  String  keyFor (EventSource  source ) {
84+     if  (source  instanceof  ControllerResourceEventSource ) {
85+       return  CONTROLLER_EVENT_SOURCE_KEY ;
86+     }
8387    return  keyFor (getResourceType (source ));
8488  }
8589
Original file line number Diff line number Diff line change @@ -76,17 +76,14 @@ void retrievingEventSourceForClassShouldWork() {
7676
7777    // manager is initialized with a controller configured to handle HasMetadata 
7878    EventSourceManager  manager  = initManager ();
79-     EventSource  source  = manager .getResourceEventSourceFor (HasMetadata .class );
80-     assertThat (source ).isInstanceOf (ControllerResourceEventSource .class );
81- 
8279    assertThatExceptionOfType (IllegalArgumentException .class )
8380        .isThrownBy (() -> manager .getResourceEventSourceFor (HasMetadata .class , "unknown_name" ));
8481
8582    CachingEventSource  eventSource  = mock (CachingEventSource .class );
8683    when (eventSource .resourceType ()).thenReturn (String .class );
8784    manager .registerEventSource (eventSource );
8885
89-     source  = manager .getResourceEventSourceFor (String .class );
86+     var   source  = manager .getResourceEventSourceFor (String .class );
9087    assertThat (source ).isNotNull ();
9188    assertEquals (eventSource , source );
9289  }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments