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

test: add data stream test case and update java demo #47

Merged
merged 7 commits into from
Jan 4, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix delete
  • Loading branch information
whhe committed Jan 4, 2024
commit cd356711e7c27a52efdfd9aca2d7c29a59a698fc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;

import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -80,14 +79,20 @@ public void before() throws Exception {
public void after() throws Exception {
client.delete(
Arrays.asList(
new Delete(Bytes.toBytes("1")),
new Delete(Bytes.toBytes("2")),
new Delete(Bytes.toBytes("3")),
new Delete(Bytes.toBytes("4"))));
deleteFamily("1", "family1"),
deleteFamily("1", "family2"),
deleteFamily("2", "family2"),
deleteFamily("3", "family1"),
deleteFamily("4", "family1"),
deleteFamily("4", "family2")));
client.close();
client = null;
}

private Delete deleteFamily(String rowKey, String family) {
return new Delete(Bytes.toBytes(rowKey)).deleteFamily(Bytes.toBytes(family));
}

@Test
public void testSink() throws Exception {
StreamExecutionEnvironment execEnv = StreamExecutionEnvironment.getExecutionEnvironment();
Expand Down Expand Up @@ -125,16 +130,6 @@ public void testSink() throws Exception {
}

private void validateSinkResults() throws Exception {
Function<KeyValue, String> valueFunc =
kv -> {
String column = Bytes.toString(kv.getQualifier());
if ("q2".equals(column)) {
return Bytes.toString(kv.getValue());
} else {
return String.valueOf(Bytes.toInt(kv.getValue()));
}
};

assertEqualsInAnyOrder(
Collections.singletonList("1,q1,1"), queryHTable(client, "family1", "1"));
assertTrue(queryHTable(client, "family1", "2").isEmpty());
Expand Down