Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes publishing status and steps visible in BatchItemResponse. #265

Merged
merged 1 commit into from
Sep 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions nakadi-java-client/src/main/java/nakadi/BatchItemResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ public PublishingStatus publishingStatus() {
return publishing_status;
}

@VisibleForTesting
BatchItemResponse publishingStatus(PublishingStatus publishingStatus) {
this.publishing_status = publishingStatus;
return this;
}

@VisibleForTesting
BatchItemResponse step(Step step) {
this.step = step;
return this;
}

public Step step() {
return step;
}
Expand Down Expand Up @@ -47,11 +59,11 @@ public String detail() {
'}';
}

enum PublishingStatus {
public enum PublishingStatus {
failed, submitted, aborted
}

enum Step {
public enum Step {
none, validating, partitioning, enriching, publishing
}
}
21 changes: 21 additions & 0 deletions nakadi-java-client/src/test/java/nakadi/BatchItemResponseTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package nakadi;

import org.junit.Test;

import static org.junit.Assert.*;

public class BatchItemResponseTest {


@Test
public void statusStep() {

BatchItemResponse bir = new BatchItemResponse();
bir.publishingStatus(BatchItemResponse.PublishingStatus.failed);
bir.step(BatchItemResponse.Step.partitioning);

assertEquals(bir.publishingStatus(), BatchItemResponse.PublishingStatus.failed);
assertEquals(bir.step(), BatchItemResponse.Step.partitioning);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package nakadi.test;

import java.util.EnumSet;
import nakadi.BatchItemResponse;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class BatchItemResponseVisibilityTest {


@Test
public void visibility_gh264() {
// https://github.com/dehora/nakadi-java/issues/264
EnumSet<BatchItemResponse.PublishingStatus> errors = EnumSet.of(
BatchItemResponse.PublishingStatus.failed,
BatchItemResponse.PublishingStatus.aborted
);

assertTrue(errors.size() == 2);
}

}