Skip to content

Commit

Permalink
Fix codestyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanrudn0303 authored and nvamelichev committed Feb 5, 2024
1 parent 8fbb8fe commit 33297ee
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@
/**
* Virtual timestamps
*/
boolean virtualTimestampsEnabled() default false;
boolean virtualTimestamps() default false;

/**
* Retention period for data in feed
* Retention period for data in feed, in {@link java.time.Duration} ISO format.
* E.g., {@code PT1M}
*/
String retentionPeriod() default "PT24H";

/**
* Initial table scan
*/
boolean initialScanEnabled() default false;
boolean initialScan() default false;

enum Mode {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ private Changefeed changefeedFromAnnotation(@NonNull tech.ydb.yoj.databind.schem
changefeed.name(),
changefeed.mode(),
changefeed.format(),
changefeed.virtualTimestampsEnabled(),
changefeed.virtualTimestamps(),
retentionPeriod,
changefeed.initialScanEnabled()
changefeed.initialScan()
);
}

Expand Down Expand Up @@ -708,12 +708,12 @@ public static class Changefeed {
@NonNull
tech.ydb.yoj.databind.schema.Changefeed.Format format;

boolean virtualTimestampsEnabled;
boolean virtualTimestamps;

@NonNull
Duration retentionPeriod;

boolean initialScanEnabled;
boolean initialScan;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tech.ydb.yoj.databind.schema;

import lombok.Value;
import org.assertj.core.api.Assertions;
import org.junit.Test;

import java.time.Duration;
Expand All @@ -21,12 +20,11 @@ public void testChangefeedDefaultsEntity() {
var entitySchema = schemaOf(ChangefeedDefaultsEntity.class);

assertThat(entitySchema.getChangefeeds()).hasSize(1);
Assertions.assertThat(entitySchema.getChangefeeds().get(0).getMode()).isEqualTo(Changefeed.Mode.NEW_IMAGE);
Assertions.assertThat(entitySchema.getChangefeeds().get(0).getFormat()).isEqualTo(Changefeed.Format.JSON);
Assertions.assertThat(entitySchema.getChangefeeds().get(0).getRetentionPeriod())
.isEqualTo(Duration.ofHours(24));
Assertions.assertThat(entitySchema.getChangefeeds().get(0).isVirtualTimestampsEnabled()).isFalse();
Assertions.assertThat(entitySchema.getChangefeeds().get(0).isInitialScanEnabled()).isFalse();
assertThat(entitySchema.getChangefeeds().get(0).getMode()).isEqualTo(Changefeed.Mode.NEW_IMAGE);
assertThat(entitySchema.getChangefeeds().get(0).getFormat()).isEqualTo(Changefeed.Format.JSON);
assertThat(entitySchema.getChangefeeds().get(0).getRetentionPeriod()).isEqualTo(Duration.ofHours(24));
assertThat(entitySchema.getChangefeeds().get(0).isVirtualTimestamps()).isFalse();
assertThat(entitySchema.getChangefeeds().get(0).isInitialScan()).isFalse();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
name = "test-changefeed1",
mode = KEYS_ONLY,
format = JSON,
virtualTimestampsEnabled = true,
virtualTimestamps = true,
retentionPeriod = "PT1H",
initialScanEnabled = true
initialScan = true
)
@Changefeed(name = "test-changefeed2")
public class ChangefeedEntity implements Entity<ChangefeedEntity> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ public void createTable(String name, List<EntitySchema.JavaField> columns, List<
changefeed.getName(),
Changefeed.Mode.valueOf(changefeed.getMode().name()),
Changefeed.Format.valueOf(changefeed.getFormat().name()),
changefeed.isVirtualTimestampsEnabled(),
changefeed.isVirtualTimestamps(),
changefeed.getRetentionPeriod(),
changefeed.isInitialScanEnabled()
changefeed.isInitialScan()
));
status = session.alterTable(tablespace + name, alterTableSettings).join();
if (status.getCode() != com.yandex.ydb.core.StatusCode.SUCCESS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ public void createTable(String name, List<EntitySchema.JavaField> columns, List<
Changefeed newChangefeed = Changefeed.newBuilder(changefeed.getName())
.withMode(Changefeed.Mode.valueOf(changefeed.getMode().name()))
.withFormat(Changefeed.Format.valueOf(changefeed.getFormat().name()))
.withVirtualTimestamps(changefeed.isVirtualTimestampsEnabled())
.withVirtualTimestamps(changefeed.isVirtualTimestamps())
.withRetentionPeriod(changefeed.getRetentionPeriod())
.withInitialScan(changefeed.isInitialScanEnabled())
.withInitialScan(changefeed.isInitialScan())
.build();

alterTableSettings.addChangefeed(newChangefeed);
Expand Down

0 comments on commit 33297ee

Please sign in to comment.