@Test public void testGetPortForIdentityNoListeners() throws SchemaRegistryException { List<String> listeners = new LinkedList<String>(); KafkaSchemaRegistry.SchemeAndPort schemeAndPort = KafkaSchemaRegistry.getSchemeAndPortForIdentity(123, listeners, SchemaRegistryConfig.HTTP); assertEquals("Expected port to take the configured port value", 123, schemeAndPort.port); assertEquals("Expected Scheme match", SchemaRegistryConfig.HTTP, schemeAndPort.scheme); }
static SchemeAndPort getSchemeAndPortForIdentity(int port, List<String> configuredListeners, String requestedScheme) throws SchemaRegistryException { List<URI> listeners = Application.parseListeners(configuredListeners, port, Arrays.asList( SchemaRegistryConfig.HTTP, SchemaRegistryConfig.HTTPS ), SchemaRegistryConfig.HTTP ); if (requestedScheme.isEmpty()) { requestedScheme = SchemaRegistryConfig.HTTP; } for (URI listener: listeners) { if (requestedScheme.equalsIgnoreCase(listener.getScheme())) { return new SchemeAndPort(listener.getScheme(), listener.getPort()); } } throw new SchemaRegistryException(" No listener configured with requested scheme " + requestedScheme); }
KafkaSchemaRegistry implements SchemaRegistry, LeaderAwareSchemaRegistry { static SchemeAndPort getSchemeAndPortForIdentity(int port, List<String> configuredListeners, String requestedScheme) throws SchemaRegistryException { List<URI> listeners = Application.parseListeners(configuredListeners, port, Arrays.asList( SchemaRegistryConfig.HTTP, SchemaRegistryConfig.HTTPS ), SchemaRegistryConfig.HTTP ); if (requestedScheme.isEmpty()) { requestedScheme = SchemaRegistryConfig.HTTP; } for (URI listener: listeners) { if (requestedScheme.equalsIgnoreCase(listener.getScheme())) { return new SchemeAndPort(listener.getScheme(), listener.getPort()); } } throw new SchemaRegistryException(" No listener configured with requested scheme " + requestedScheme); } }
KafkaSchemaRegistry implements SchemaRegistry, LeaderAwareSchemaRegistry { static SchemeAndPort getSchemeAndPortForIdentity(int port, List<String> configuredListeners, String requestedScheme) throws SchemaRegistryException { List<URI> listeners = Application.parseListeners(configuredListeners, port, Arrays.asList( SchemaRegistryConfig.HTTP, SchemaRegistryConfig.HTTPS ), SchemaRegistryConfig.HTTP ); if (requestedScheme.isEmpty()) { requestedScheme = SchemaRegistryConfig.HTTP; } for (URI listener: listeners) { if (requestedScheme.equalsIgnoreCase(listener.getScheme())) { return new SchemeAndPort(listener.getScheme(), listener.getPort()); } } throw new SchemaRegistryException(" No listener configured with requested scheme " + requestedScheme); } KafkaSchemaRegistry(SchemaRegistryConfig config,
                             Serializer<SchemaRegistryKey, SchemaRegistryValue> serializer); }
KafkaSchemaRegistry implements SchemaRegistry, LeaderAwareSchemaRegistry { static SchemeAndPort getSchemeAndPortForIdentity(int port, List<String> configuredListeners, String requestedScheme) throws SchemaRegistryException { List<URI> listeners = Application.parseListeners(configuredListeners, port, Arrays.asList( SchemaRegistryConfig.HTTP, SchemaRegistryConfig.HTTPS ), SchemaRegistryConfig.HTTP ); if (requestedScheme.isEmpty()) { requestedScheme = SchemaRegistryConfig.HTTP; } for (URI listener: listeners) { if (requestedScheme.equalsIgnoreCase(listener.getScheme())) { return new SchemeAndPort(listener.getScheme(), listener.getPort()); } } throw new SchemaRegistryException(" No listener configured with requested scheme " + requestedScheme); } KafkaSchemaRegistry(SchemaRegistryConfig config,
                             Serializer<SchemaRegistryKey, SchemaRegistryValue> serializer); LookupCache<SchemaRegistryKey, SchemaRegistryValue> getLookupCache(); Serializer<SchemaRegistryKey, SchemaRegistryValue> getSerializer(); IdGenerator getIdentityGenerator(); MetricsContainer getMetricsContainer(); @Override void init(); boolean initialized(); boolean isLeader(); @Override void setLeader(@Nullable SchemaRegistryIdentity newLeader); SchemaRegistryIdentity myIdentity(); SchemaRegistryIdentity leaderIdentity(); Set<String> schemaTypes(); @Override int register(String subject,
                      Schema schema); int registerOrForward(String subject,
                               Schema schema,
                               Map<String, String> headerProperties); @Override void deleteSchemaVersion(String subject,
                                  Schema schema,
                                  boolean permanentDelete); void deleteSchemaVersionOrForward(
      Map<String, String> headerProperties, String subject,
      Schema schema, boolean permanentDelete); @Override List<Integer> deleteSubject(String subject,
                                     boolean permanentDelete); List<Integer> deleteSubjectOrForward(
      Map<String, String> requestProperties,
      String subject,
      boolean permanentDelete); Schema lookUpSchemaUnderSubject(String subject, Schema schema, boolean lookupDeletedSchema); ParsedSchema parseSchema(
      String schemaType,
      String schema,
      List<io.confluent.kafka.schemaregistry.client.rest.entities.SchemaReference> references); Schema validateAndGetSchema(String subject, VersionId versionId, boolean
      returnDeletedSchema); boolean schemaVersionExists(String subject, VersionId versionId, boolean
          returnDeletedSchema); @Override Schema get(String subject, int version, boolean returnDeletedSchema); @Override SchemaString get(int id); SchemaString get(
      int id,
      String format,
      boolean fetchMaxId
  ); List<Integer> getReferencedBy(String subject, VersionId versionId); @Override Set<String> listSubjects(boolean returnDeletedSubjects); Set<String> listSubjectsForId(int id); Set<String> listSubjectsForId(int id, boolean returnDeleted); List<SubjectVersion> listVersionsForId(int id); List<SubjectVersion> listVersionsForId(int id, boolean lookupDeleted); Set<String> subjects(String subject,
                              boolean lookupDeletedSubjects); boolean hasSubjects(String subject,
                             boolean lookupDeletedSubjects); @Override Iterator<Schema> getAllVersions(String subject, boolean returnDeletedSchemas); @Override Iterator<Schema> getVersionsWithSubjectPrefix(String prefix,
      boolean returnDeletedSchemas,
      boolean returnLatestOnly); @Override Schema getLatestVersion(String subject); @Override void close(); void updateCompatibilityLevel(String subject, CompatibilityLevel newCompatibilityLevel); void updateConfigOrForward(String subject, CompatibilityLevel newCompatibilityLevel,
                                    Map<String, String> headerProperties); String getKafkaClusterId(); CompatibilityLevel getCompatibilityLevel(String subject); CompatibilityLevel getCompatibilityLevelInScope(String subject); @Override List<String> isCompatible(String subject,
                                   Schema newSchema,
                                   Schema latestSchema); @Override List<String> isCompatible(String subject,
                                   Schema newSchema,
                                   List<Schema> previousSchemas); Mode getMode(String subject); void setMode(String subject, Mode mode); void setModeOrForward(String subject, Mode mode, Map<String, String> headerProperties); @Override SchemaRegistryConfig config(); @Override Map<String, Object> properties(); HostnameVerifier getHostnameVerifier(); }
KafkaSchemaRegistry implements SchemaRegistry, LeaderAwareSchemaRegistry { static SchemeAndPort getSchemeAndPortForIdentity(int port, List<String> configuredListeners, String requestedScheme) throws SchemaRegistryException { List<URI> listeners = Application.parseListeners(configuredListeners, port, Arrays.asList( SchemaRegistryConfig.HTTP, SchemaRegistryConfig.HTTPS ), SchemaRegistryConfig.HTTP ); if (requestedScheme.isEmpty()) { requestedScheme = SchemaRegistryConfig.HTTP; } for (URI listener: listeners) { if (requestedScheme.equalsIgnoreCase(listener.getScheme())) { return new SchemeAndPort(listener.getScheme(), listener.getPort()); } } throw new SchemaRegistryException(" No listener configured with requested scheme " + requestedScheme); } KafkaSchemaRegistry(SchemaRegistryConfig config,
                             Serializer<SchemaRegistryKey, SchemaRegistryValue> serializer); LookupCache<SchemaRegistryKey, SchemaRegistryValue> getLookupCache(); Serializer<SchemaRegistryKey, SchemaRegistryValue> getSerializer(); IdGenerator getIdentityGenerator(); MetricsContainer getMetricsContainer(); @Override void init(); boolean initialized(); boolean isLeader(); @Override void setLeader(@Nullable SchemaRegistryIdentity newLeader); SchemaRegistryIdentity myIdentity(); SchemaRegistryIdentity leaderIdentity(); Set<String> schemaTypes(); @Override int register(String subject,
                      Schema schema); int registerOrForward(String subject,
                               Schema schema,
                               Map<String, String> headerProperties); @Override void deleteSchemaVersion(String subject,
                                  Schema schema,
                                  boolean permanentDelete); void deleteSchemaVersionOrForward(
      Map<String, String> headerProperties, String subject,
      Schema schema, boolean permanentDelete); @Override List<Integer> deleteSubject(String subject,
                                     boolean permanentDelete); List<Integer> deleteSubjectOrForward(
      Map<String, String> requestProperties,
      String subject,
      boolean permanentDelete); Schema lookUpSchemaUnderSubject(String subject, Schema schema, boolean lookupDeletedSchema); ParsedSchema parseSchema(
      String schemaType,
      String schema,
      List<io.confluent.kafka.schemaregistry.client.rest.entities.SchemaReference> references); Schema validateAndGetSchema(String subject, VersionId versionId, boolean
      returnDeletedSchema); boolean schemaVersionExists(String subject, VersionId versionId, boolean
          returnDeletedSchema); @Override Schema get(String subject, int version, boolean returnDeletedSchema); @Override SchemaString get(int id); SchemaString get(
      int id,
      String format,
      boolean fetchMaxId
  ); List<Integer> getReferencedBy(String subject, VersionId versionId); @Override Set<String> listSubjects(boolean returnDeletedSubjects); Set<String> listSubjectsForId(int id); Set<String> listSubjectsForId(int id, boolean returnDeleted); List<SubjectVersion> listVersionsForId(int id); List<SubjectVersion> listVersionsForId(int id, boolean lookupDeleted); Set<String> subjects(String subject,
                              boolean lookupDeletedSubjects); boolean hasSubjects(String subject,
                             boolean lookupDeletedSubjects); @Override Iterator<Schema> getAllVersions(String subject, boolean returnDeletedSchemas); @Override Iterator<Schema> getVersionsWithSubjectPrefix(String prefix,
      boolean returnDeletedSchemas,
      boolean returnLatestOnly); @Override Schema getLatestVersion(String subject); @Override void close(); void updateCompatibilityLevel(String subject, CompatibilityLevel newCompatibilityLevel); void updateConfigOrForward(String subject, CompatibilityLevel newCompatibilityLevel,
                                    Map<String, String> headerProperties); String getKafkaClusterId(); CompatibilityLevel getCompatibilityLevel(String subject); CompatibilityLevel getCompatibilityLevelInScope(String subject); @Override List<String> isCompatible(String subject,
                                   Schema newSchema,
                                   Schema latestSchema); @Override List<String> isCompatible(String subject,
                                   Schema newSchema,
                                   List<Schema> previousSchemas); Mode getMode(String subject); void setMode(String subject, Mode mode); void setModeOrForward(String subject, Mode mode, Map<String, String> headerProperties); @Override SchemaRegistryConfig config(); @Override Map<String, Object> properties(); HostnameVerifier getHostnameVerifier(); static final int MIN_VERSION; static final int MAX_VERSION; }