Skip to content

Commit

Permalink
chore: shutdown on test
Browse files Browse the repository at this point in the history
  • Loading branch information
fengjiachun committed Jan 8, 2024
1 parent 461588a commit baede06
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,8 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
WriteOk result = future.get();

LOG.info("Write result: {}", result);

// Shutdown the client when application exits.
greptimeDB.shutdownGracefully();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,8 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
WriteOk result = future.get();

LOG.info("Write result: {}", result);

// Shutdown the client when application exits.
greptimeDB.shutdownGracefully();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,8 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
} else {
LOG.error("Failed to delete: {}", result.getErr());
}

// Shutdown the client when application exits.
greptimeDB.shutdownGracefully();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,8 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
} else {
LOG.error("Failed to delete: {}", result.getErr());
}

// Shutdown the client when application exits.
greptimeDB.shutdownGracefully();
}
}
2 changes: 1 addition & 1 deletion ingester-protocol/src/main/java/io/greptime/Write.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface Write {
* @see #write(Collection, WriteOp, Context)
*/
default CompletableFuture<Result<WriteOk, Err>> write(Table... tables) {
return write(Arrays.asList(tables), WriteOp.Insert, Context.newDefault());
return write(Arrays.asList(tables));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion ingester-protocol/src/main/java/io/greptime/WritePOJO.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface WritePOJO {
* @see #writePOJOs(Collection, WriteOp, Context)
*/
default CompletableFuture<Result<WriteOk, Err>> writePOJOs(List<?>... pojos) {
return writePOJOs(Arrays.asList(pojos), WriteOp.Insert, Context.newDefault());
return writePOJOs(Arrays.asList(pojos));
}
/**
* @see #writePOJOs(Collection, WriteOp, Context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void testWriteSuccess() throws ExecutionException, InterruptedException {
Mockito.when(this.routerClient.invoke(Mockito.eq(addr), Mockito.any(), Mockito.any())) //
.thenReturn(Util.completedCf(response));

Result<WriteOk, Err> res = this.writeClient.write(Collections.singleton(table)).get();
Result<WriteOk, Err> res = this.writeClient.write(table).get();

Assert.assertTrue(res.isOk());
Assert.assertEquals(3, res.getOk().getSuccess());
Expand Down

0 comments on commit baede06

Please sign in to comment.