test_class.file: core/src/test/java/org/apache/sling/cms/core/publication/ForwardAgentEndpointSynchronizationTest.java
test_class.identifier: ForwardAgentEndpointSynchronizationTest
test_case.body: @Test
      public void testHandleTopologyEvent() throws IOException, InvalidSyntaxException {
          TopologyEvent event = Mockito.mock(TopologyEvent.class);
  
          TopologyView view = Mockito.mock(TopologyView.class);
  
          InstanceDescription description = Mockito.mock(InstanceDescription.class);
          Mockito.when(description.getProperty(Mockito.matches(InstanceDescription.PROPERTY_ENDPOINTS)))
                  .thenReturn("https://sling.apache.org");
          Mockito.when(description.getProperty(Mockito.matches(PublicationPropertyProvider.ENDPOINT_PATHS)))
                  .thenReturn("/libs/distribute");
          Mockito.when(view.findInstances(Mockito.any())).thenReturn(Collections.singleton(description));
          Mockito.when(event.getNewView()).thenReturn(view);
  
          ConfigurationAdmin configAdmin = Mockito.mock(ConfigurationAdmin.class);
          Configuration sampleConfig = new Configuration() {
              private Dictionary<String, Object> properties = new Hashtable<>();
  
              @Override
              public String getPid() {
                  return "org.apache.sling";
              }
  
              @Override
              public Dictionary<String, Object> getProperties() {
                  return properties;
              }
  
              @Override
              public void update(Dictionary<String, ?> properties) throws IOException {
                  this.properties = (Dictionary<String, Object>) properties;
              }
  
              @Override
              public void delete() throws IOException {
                  throw new UnsupportedOperationException();
              }
  
              @Override
              public String getFactoryPid() {
                  throw new UnsupportedOperationException();
              }
  
              @Override
              public void update() throws IOException {
                  throw new UnsupportedOperationException();
              }
  
              @Override
              public void setBundleLocation(String location) {
                  throw new UnsupportedOperationException();
              }
  
              @Override
              public String getBundleLocation() {
                  throw new UnsupportedOperationException();
              }
  
              @Override
              public long getChangeCount() {
                  throw new UnsupportedOperationException();
              }
          };
          Mockito.when(configAdmin.listConfigurations(Mockito.any())).thenReturn(new Configuration[] { sampleConfig });
  
          ForwardAgentEndpointSynchronization sync = new ForwardAgentEndpointSynchronization(configAdmin,
                  new ForwardAgentEndpointSynchronizationConfig() {
  
                      @Override
                      public Class<? extends Annotation> annotationType() {
                          return null;
                      }
  
                      @Override
                      public String agentTarget() {
                          return null;
                      }
  
                  });
          sync.handleTopologyEvent(event);
          assertTrue(Arrays.equals(new String[] { "https://sling.apache.org/libs/distribute" },
                  (String[]) sampleConfig.getProperties().get(ForwardAgentEndpointSynchronization.ENDPOINT_PROPERTY)));
      }
test_case.class_method_signature: ForwardAgentEndpointSynchronizationTest.testHandleTopologyEvent()
test_case.full_signature: @Test public void testHandleTopologyEvent()
test_case.identifier: testHandleTopologyEvent
test_case.invocations: mock mock mock thenReturn when getProperty matches thenReturn when getProperty matches thenReturn when findInstances any singleton thenReturn when getNewView mock thenReturn when listConfigurations any handleTopologyEvent assertTrue equals get getProperties
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testHandleTopologyEvent()
focal_class.declarator: log = LoggerFactory.getLogger(ForwardAgentEndpointSynchronization.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(ForwardAgentEndpointSynchronization.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: config
focal_class.modifier: private
focal_class.original_string: private ForwardAgentEndpointSynchronizationConfig config;
focal_class.type: ForwardAgentEndpointSynchronizationConfig
focal_class.var_name: config
focal_class.declarator: ENDPOINT_PROPERTY = "packageImporter.endpoints"
focal_class.modifier: public static final
focal_class.original_string: public static final String ENDPOINT_PROPERTY = "packageImporter.endpoints";
focal_class.type: String
focal_class.var_name: ENDPOINT_PROPERTY
focal_class.declarator: configAdmin
focal_class.modifier: private
focal_class.original_string: private ConfigurationAdmin configAdmin;
focal_class.type: ConfigurationAdmin
focal_class.var_name: configAdmin
focal_class.file: core/src/main/java/org/apache/sling/cms/core/publication/ForwardAgentEndpointSynchronization.java
focal_class.identifier: ForwardAgentEndpointSynchronization
focal_class.interfaces: implements TopologyEventListener
focal_class.class_method_signature: ForwardAgentEndpointSynchronization.ForwardAgentEndpointSynchronization(@Reference ConfigurationAdmin configAdmin,
              ForwardAgentEndpointSynchronizationConfig config)
focal_class.full_signature: @Activate public  ForwardAgentEndpointSynchronization(@Reference ConfigurationAdmin configAdmin,
              ForwardAgentEndpointSynchronizationConfig config)
focal_class.identifier: ForwardAgentEndpointSynchronization
focal_class.modifiers: @Activate public
focal_class.parameters: (@Reference ConfigurationAdmin configAdmin,
              ForwardAgentEndpointSynchronizationConfig config)
focal_class.signature:  ForwardAgentEndpointSynchronization(@Reference ConfigurationAdmin configAdmin,
              ForwardAgentEndpointSynchronizationConfig config)
focal_class.class_method_signature: ForwardAgentEndpointSynchronization.updateInstances(Set<InstanceDescription> instances)
focal_class.full_signature: private void updateInstances(Set<InstanceDescription> instances)
focal_class.identifier: updateInstances
focal_class.modifiers: private
focal_class.parameters: (Set<InstanceDescription> instances)
focal_class.return: void
focal_class.signature: void updateInstances(Set<InstanceDescription> instances)
focal_class.class_method_signature: ForwardAgentEndpointSynchronization.handleTopologyEvent(TopologyEvent event)
focal_class.full_signature: @Override public void handleTopologyEvent(TopologyEvent event)
focal_class.identifier: handleTopologyEvent
focal_class.modifiers: @Override public
focal_class.parameters: (TopologyEvent event)
focal_class.return: void
focal_class.signature: void handleTopologyEvent(TopologyEvent event)
focal_method.body: @Override
      public void handleTopologyEvent(TopologyEvent event) {
          Set<InstanceDescription> renderers = event.getNewView().findInstances(id -> INSTANCE_TYPE.RENDERER.toString()
                  .equals(id.getProperty(PublicationPropertyProvider.INSTANCE_TYPE)));
          updateInstances(renderers);
      }
focal_method.class_method_signature: ForwardAgentEndpointSynchronization.handleTopologyEvent(TopologyEvent event)
focal_method.full_signature: @Override public void handleTopologyEvent(TopologyEvent event)
focal_method.identifier: handleTopologyEvent
focal_method.invocations: findInstances getNewView equals toString getProperty updateInstances
focal_method.modifiers: @Override public
focal_method.parameters: (TopologyEvent event)
focal_method.return: void
focal_method.signature: void handleTopologyEvent(TopologyEvent event)