private Topic convertToTopic() { return new Topic(this.getQualifiedName(), this.getDescription(), this.getOwner(), this.getRetentionTime(), this.isJsonToAvroDryRunEnabled(), this.getAck(), this.isTrackingEnabled(), this.wasMigratedFromJsonType(), this.isSchemaVersionAwareSerializationEnabled(), this.getContentType(), this.getMaxMessageSize(), this.getPublishingAuth(), this.isSubscribingRestricted(), this.getOfflineStorage()); }
public TopicWithSchema createTopic(Topic topic, String schema) { return createTopic(topicWithSchema(topic, schema)); }
public static TopicWithSchema topicWithSchema(Topic topic, String schema) { return new TopicWithSchema(topic, schema); }
private void registerAvroSchema(boolean shouldRegister, TopicWithSchema topicWithSchema, String createdBy) { if (shouldRegister) { try { schemaService.registerSchema(topicWithSchema.getTopic(), topicWithSchema.getSchema(), true); } catch (Exception e) { logger.error("Rolling back topic {} creation due to schema registration error", topicWithSchema.getQualifiedName(), e); removeTopic(topicWithSchema.getTopic(), createdBy); throw e; } } }
public TopicWithSchema createTopic(TopicWithSchema topicWithSchema) { if (endpoints.findTopics(topicWithSchema, topicWithSchema.isTrackingEnabled()).contains(topicWithSchema.getQualifiedName())) { return topicWithSchema; } assertThat(endpoints.topic().create(topicWithSchema).getStatus()).isEqualTo(CREATED.getStatusCode()); wait.untilTopicCreated(topicWithSchema); return topicWithSchema; }
public TopicWithSchema buildTopicWithSchema(TopicWithSchema topic) { createGroup(topic.getName().getGroupName()); return createTopic(topic); }
public void untilTopicUpdated(Topic reference) { waitAtMost(adjust(Duration.ONE_MINUTE)).until(() -> endpoints.topic().get(reference.getQualifiedName()).equals(reference) ); }
@JsonCreator public TopicWithSchema(@JsonProperty("schema") String schema, @JsonProperty("name") String qualifiedName, @JsonProperty("description") String description, @JsonProperty("owner") OwnerId owner, @JsonProperty("retentionTime") RetentionTime retentionTime, @JsonProperty("jsonToAvroDryRun") boolean jsonToAvroDryRunEnabled, @JsonProperty("ack") Ack ack, @JsonProperty("trackingEnabled") boolean trackingEnabled, @JsonProperty("migratedFromJsonType") boolean migratedFromJsonType, @JsonProperty("schemaVersionAwareSerializationEnabled") boolean schemaVersionAwareSerializationEnabled, @JsonProperty("contentType") ContentType contentType, @JsonProperty("maxMessageSize") Integer maxMessageSize, @JsonProperty("auth") PublishingAuth publishingAuth, @JsonProperty("subscribingRestricted") boolean subscribingRestricted, @JsonProperty("offlineStorage") TopicDataOfflineStorage offlineStorage) { super(qualifiedName, description, owner, retentionTime, jsonToAvroDryRunEnabled, ack, trackingEnabled, migratedFromJsonType, schemaVersionAwareSerializationEnabled, contentType, maxMessageSize, publishingAuth, subscribingRestricted, offlineStorage); this.topic = convertToTopic(); this.schema = schema; }
public TopicWithSchema createTopic(TopicWithSchema topicWithSchema) { if (endpoints.findTopics(topicWithSchema, topicWithSchema.isTrackingEnabled()).contains(topicWithSchema.getQualifiedName())) { return topicWithSchema; } assertThat(endpoints.topic().create(topicWithSchema).getStatus()).isEqualTo(CREATED.getStatusCode()); wait.untilTopicCreated(topicWithSchema); return topicWithSchema; }
public TopicWithSchema buildTopicWithSchema(TopicWithSchema topic) { createGroup(topic.getName().getGroupName()); return createTopic(topic); }
public void untilTopicUpdated(Topic reference) { waitAtMost(adjust(Duration.ONE_MINUTE)).until(() -> endpoints.topic().get(reference.getQualifiedName()).equals(reference) ); }
public TopicWithSchema createTopic(Topic topic, String schema) { return createTopic(topicWithSchema(topic, schema)); }
public static TopicWithSchema topicWithSchema(Topic topic) { return new TopicWithSchema(topic, null); }
public TopicWithSchema getTopicWithSchema(TopicName topicName) { Topic topic = getTopicDetails(topicName); Optional<RawSchema> schema = Optional.empty(); if (AVRO.equals(topic.getContentType())) { schema = schemaService.getSchema(topicName.qualifiedName()); } return schema .map(s -> topicWithSchema(topic, s.value())) .orElseGet(() -> topicWithSchema(topic)); }