-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef3e4c8
commit 09a0b13
Showing
14 changed files
with
189 additions
and
136 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
java-client/session-dagger/src/test/java/io/deephaven/client/SessionBatchMixinTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
*/ | ||
package io.deephaven.client; | ||
|
||
import io.deephaven.api.TableOperations; | ||
import io.deephaven.client.impl.TableHandle; | ||
import io.deephaven.client.impl.TableHandle.TableHandleException; | ||
import io.deephaven.qst.TableCreationLogic; | ||
import io.deephaven.qst.TableCreator; | ||
import org.junit.Test; | ||
|
||
import java.time.Duration; | ||
import java.util.stream.Stream; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; | ||
|
||
public class SessionBatchMixinTest extends DeephavenSessionTestBase { | ||
|
||
@Test | ||
public void noMixin() throws InterruptedException { | ||
try (final TableHandle ignored = session | ||
.batch(false) | ||
.executeLogic((TableCreationLogic) SessionBatchMixinTest::thisIsTheMethodName)) { | ||
failBecauseExceptionWasNotThrown(TableHandleException.class); | ||
} catch (TableHandleException e) { | ||
assertThat(Stream.of(e.getStackTrace()).map(StackTraceElement::getMethodName)) | ||
.doesNotContain("thisIsTheMethodName"); | ||
} | ||
} | ||
|
||
@Test | ||
public void yesMixin() throws InterruptedException { | ||
try (final TableHandle ignored = session | ||
.batch(true) | ||
.executeLogic((TableCreationLogic) SessionBatchMixinTest::thisIsTheMethodName)) { | ||
failBecauseExceptionWasNotThrown(TableHandleException.class); | ||
} catch (TableHandleException e) { | ||
assertThat(Stream.of(e.getStackTrace()).map(StackTraceElement::getMethodName)) | ||
.contains("thisIsTheMethodName"); | ||
} | ||
} | ||
|
||
static <T extends TableOperations<T, T>> T thisIsTheMethodName(TableCreator<T> creation) { | ||
T t1 = creation.timeTable(Duration.ofSeconds(1)).view("I=i"); | ||
T t2 = t1.where("I % 3 == 0").tail(3); | ||
T t3 = t1.where("I % 5 == 0").tail(5); | ||
T t4 = t1.where("This is not a good filter").tail(6); | ||
return creation.merge(t2, t3, t4); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.