test_class.declarator: DATA_SOURCE_FILE = "yaml/data-source.yaml"
test_class.modifier: private static final
test_class.original_string: private static final String DATA_SOURCE_FILE = "yaml/data-source.yaml";
test_class.type: String
test_class.var_name: DATA_SOURCE_FILE
test_class.declarator: SHARDING_RULE_FILE = "yaml/sharding-rule.yaml"
test_class.modifier: private static final
test_class.original_string: private static final String SHARDING_RULE_FILE = "yaml/sharding-rule.yaml";
test_class.type: String
test_class.var_name: SHARDING_RULE_FILE
test_class.declarator: PRIMARY_REPLICA_REPLICATION_RULE_FILE = "yaml/primary-replica-replication-rule.yaml"
test_class.modifier: private static final
test_class.original_string: private static final String PRIMARY_REPLICA_REPLICATION_RULE_FILE = "yaml/primary-replica-replication-rule.yaml";
test_class.type: String
test_class.var_name: PRIMARY_REPLICA_REPLICATION_RULE_FILE
test_class.declarator: ENCRYPT_RULE_FILE = "yaml/encrypt-rule.yaml"
test_class.modifier: private static final
test_class.original_string: private static final String ENCRYPT_RULE_FILE = "yaml/encrypt-rule.yaml";
test_class.type: String
test_class.var_name: ENCRYPT_RULE_FILE
test_class.declarator: META_DATA_FILE = "yaml/metadata.yaml"
test_class.modifier: private static final
test_class.original_string: private static final String META_DATA_FILE = "yaml/metadata.yaml";
test_class.type: String
test_class.var_name: META_DATA_FILE
test_class.declarator: schemaChangedListener
test_class.modifier: private
test_class.original_string: private SchemaChangedListener schemaChangedListener;
test_class.type: SchemaChangedListener
test_class.var_name: schemaChangedListener
test_class.declarator: configurationRepository
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ConfigurationRepository configurationRepository;
test_class.type: ConfigurationRepository
test_class.var_name: configurationRepository
test_class.file: shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/test/java/org/apache/shardingsphere/governance/core/config/listener/SchemaChangedListenerTest.java
test_class.identifier: SchemaChangedListenerTest
test_case.body: @Test
      public void assertCreateSchemaDeletedEventForNewSchema() {
          String dataSource = readYAML(DATA_SOURCE_FILE);
          DataChangedEvent dataChangedEvent = new DataChangedEvent("/schemas/logic_db/datasource", dataSource, ChangedType.DELETED);
          Optional<GovernanceEvent> actual = schemaChangedListener.createGovernanceEvent(dataChangedEvent);
          assertTrue(actual.isPresent());
          assertThat(((SchemaDeletedEvent) actual.get()).getSchemaName(), is("logic_db"));
      }
test_case.class_method_signature: SchemaChangedListenerTest.assertCreateSchemaDeletedEventForNewSchema()
test_case.full_signature: @Test public void assertCreateSchemaDeletedEventForNewSchema()
test_case.identifier: assertCreateSchemaDeletedEventForNewSchema
test_case.invocations: readYAML createGovernanceEvent assertTrue isPresent assertThat getSchemaName get is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertCreateSchemaDeletedEventForNewSchema()
focal_class.declarator: configurationNode
focal_class.modifier: private final
focal_class.original_string: private final ConfigCenterNode configurationNode;
focal_class.type: ConfigCenterNode
focal_class.var_name: configurationNode
focal_class.declarator: existedSchemaNames
focal_class.modifier: private final
focal_class.original_string: private final Collection<String> existedSchemaNames;
focal_class.type: Collection<String>
focal_class.var_name: existedSchemaNames
focal_class.file: shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/main/java/org/apache/shardingsphere/governance/core/config/listener/SchemaChangedListener.java
focal_class.identifier: SchemaChangedListener
focal_class.class_method_signature: SchemaChangedListener.SchemaChangedListener(final ConfigurationRepository configurationRepository, final Collection<String> schemaNames)
focal_class.full_signature: public  SchemaChangedListener(final ConfigurationRepository configurationRepository, final Collection<String> schemaNames)
focal_class.identifier: SchemaChangedListener
focal_class.modifiers: public
focal_class.parameters: (final ConfigurationRepository configurationRepository, final Collection<String> schemaNames)
focal_class.signature:  SchemaChangedListener(final ConfigurationRepository configurationRepository, final Collection<String> schemaNames)
focal_class.class_method_signature: SchemaChangedListener.createGovernanceEvent(final DataChangedEvent event)
focal_class.full_signature: @Override protected Optional<GovernanceEvent> createGovernanceEvent(final DataChangedEvent event)
focal_class.identifier: createGovernanceEvent
focal_class.modifiers: @Override protected
focal_class.parameters: (final DataChangedEvent event)
focal_class.return: Optional<GovernanceEvent>
focal_class.signature: Optional<GovernanceEvent> createGovernanceEvent(final DataChangedEvent event)
focal_class.class_method_signature: SchemaChangedListener.createSchemaNamesUpdatedEvent(final String schemaNames)
focal_class.full_signature: private Optional<GovernanceEvent> createSchemaNamesUpdatedEvent(final String schemaNames)
focal_class.identifier: createSchemaNamesUpdatedEvent
focal_class.modifiers: private
focal_class.parameters: (final String schemaNames)
focal_class.return: Optional<GovernanceEvent>
focal_class.signature: Optional<GovernanceEvent> createSchemaNamesUpdatedEvent(final String schemaNames)
focal_class.class_method_signature: SchemaChangedListener.isValidNodeChangedEvent(final String schemaName, final String nodeFullPath)
focal_class.full_signature: private boolean isValidNodeChangedEvent(final String schemaName, final String nodeFullPath)
focal_class.identifier: isValidNodeChangedEvent
focal_class.modifiers: private
focal_class.parameters: (final String schemaName, final String nodeFullPath)
focal_class.return: boolean
focal_class.signature: boolean isValidNodeChangedEvent(final String schemaName, final String nodeFullPath)
focal_class.class_method_signature: SchemaChangedListener.createAddedEvent(final String schemaName)
focal_class.full_signature: private GovernanceEvent createAddedEvent(final String schemaName)
focal_class.identifier: createAddedEvent
focal_class.modifiers: private
focal_class.parameters: (final String schemaName)
focal_class.return: GovernanceEvent
focal_class.signature: GovernanceEvent createAddedEvent(final String schemaName)
focal_class.class_method_signature: SchemaChangedListener.createUpdatedEvent(final String schemaName, final DataChangedEvent event)
focal_class.full_signature: private GovernanceEvent createUpdatedEvent(final String schemaName, final DataChangedEvent event)
focal_class.identifier: createUpdatedEvent
focal_class.modifiers: private
focal_class.parameters: (final String schemaName, final DataChangedEvent event)
focal_class.return: GovernanceEvent
focal_class.signature: GovernanceEvent createUpdatedEvent(final String schemaName, final DataChangedEvent event)
focal_class.class_method_signature: SchemaChangedListener.createUpdatedEventForExistedSchema(final String schemaName, final DataChangedEvent event)
focal_class.full_signature: private GovernanceEvent createUpdatedEventForExistedSchema(final String schemaName, final DataChangedEvent event)
focal_class.identifier: createUpdatedEventForExistedSchema
focal_class.modifiers: private
focal_class.parameters: (final String schemaName, final DataChangedEvent event)
focal_class.return: GovernanceEvent
focal_class.signature: GovernanceEvent createUpdatedEventForExistedSchema(final String schemaName, final DataChangedEvent event)
focal_class.class_method_signature: SchemaChangedListener.createDataSourceChangedEvent(final String schemaName, final DataChangedEvent event)
focal_class.full_signature: private DataSourceChangedEvent createDataSourceChangedEvent(final String schemaName, final DataChangedEvent event)
focal_class.identifier: createDataSourceChangedEvent
focal_class.modifiers: private
focal_class.parameters: (final String schemaName, final DataChangedEvent event)
focal_class.return: DataSourceChangedEvent
focal_class.signature: DataSourceChangedEvent createDataSourceChangedEvent(final String schemaName, final DataChangedEvent event)
focal_class.class_method_signature: SchemaChangedListener.createRuleChangedEvent(final String schemaName, final DataChangedEvent event)
focal_class.full_signature: private GovernanceEvent createRuleChangedEvent(final String schemaName, final DataChangedEvent event)
focal_class.identifier: createRuleChangedEvent
focal_class.modifiers: private
focal_class.parameters: (final String schemaName, final DataChangedEvent event)
focal_class.return: GovernanceEvent
focal_class.signature: GovernanceEvent createRuleChangedEvent(final String schemaName, final DataChangedEvent event)
focal_class.class_method_signature: SchemaChangedListener.createMetaDataChangedEvent(final DataChangedEvent event)
focal_class.full_signature: private GovernanceEvent createMetaDataChangedEvent(final DataChangedEvent event)
focal_class.identifier: createMetaDataChangedEvent
focal_class.modifiers: private
focal_class.parameters: (final DataChangedEvent event)
focal_class.return: GovernanceEvent
focal_class.signature: GovernanceEvent createMetaDataChangedEvent(final DataChangedEvent event)
focal_class.superclass: extends PostGovernanceRepositoryEventListener
focal_method.body: @Override
      protected Optional<GovernanceEvent> createGovernanceEvent(final DataChangedEvent event) {
          // TODO Consider removing the following one.
          if (configurationNode.getSchemasPath().equals(event.getKey())) {
              return createSchemaNamesUpdatedEvent(event.getValue());
          }
          String schemaName = configurationNode.getSchemaName(event.getKey());
          if (Strings.isNullOrEmpty(schemaName) || !isValidNodeChangedEvent(schemaName, event.getKey())) {
              return Optional.empty();
          }
          if (ChangedType.ADDED == event.getChangedType()) {
              return Optional.of(createAddedEvent(schemaName));
          }
          if (ChangedType.UPDATED == event.getChangedType()) {
              return Optional.of(createUpdatedEvent(schemaName, event));
          }
          if (ChangedType.DELETED == event.getChangedType()) {
              existedSchemaNames.remove(schemaName);
              return Optional.of(new SchemaDeletedEvent(schemaName));
          }
          return Optional.empty();
      }
focal_method.class_method_signature: SchemaChangedListener.createGovernanceEvent(final DataChangedEvent event)
focal_method.full_signature: @Override protected Optional<GovernanceEvent> createGovernanceEvent(final DataChangedEvent event)
focal_method.identifier: createGovernanceEvent
focal_method.invocations: equals getSchemasPath getKey createSchemaNamesUpdatedEvent getValue getSchemaName getKey isNullOrEmpty isValidNodeChangedEvent getKey empty getChangedType of createAddedEvent getChangedType of createUpdatedEvent getChangedType remove of empty
focal_method.modifiers: @Override protected
focal_method.parameters: (final DataChangedEvent event)
focal_method.return: Optional<GovernanceEvent>
focal_method.signature: Optional<GovernanceEvent> createGovernanceEvent(final DataChangedEvent event)