Skip to content

Commit

Permalink
Fix test scripts and inactivity timeout test (#2893)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored Oct 14, 2024
1 parent 9663bc8 commit 462dee3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 22 deletions.
1 change: 1 addition & 0 deletions cpp/test/Ice/inactivityTimeout/Test.ice
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Test
{
interface TestIntf
{
["amd"]
void sleep(int ms);

void shutdown();
Expand Down
10 changes: 8 additions & 2 deletions cpp/test/Ice/inactivityTimeout/TestI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
using namespace std;

void
TestIntfI::sleep(int32_t ms, const Ice::Current&)
TestIntfI::sleepAsync(int32_t ms, function<void()> response, function<void(exception_ptr)>, const Ice::Current&)
{
this_thread::sleep_for(chrono::milliseconds(ms));
_sleepFuture = std::async(
std::launch::async,
[ms, response]
{
this_thread::sleep_for(chrono::milliseconds(ms));
response();
});
}

void
Expand Down
10 changes: 9 additions & 1 deletion cpp/test/Ice/inactivityTimeout/TestI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
class TestIntfI final : public Test::TestIntf
{
public:
void sleep(std::int32_t, const Ice::Current&) final;
void sleepAsync(
std::int32_t ms,
std::function<void()> response,
std::function<void(std::exception_ptr)> exception,
const Ice::Current& current) final;

void shutdown(const Ice::Current&) final;

private:
// has a blocking destructor
std::future<void> _sleepFuture;
};
#endif
2 changes: 2 additions & 0 deletions csharp/test/Ice/inactivityTimeout/Test.ice
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ module Test
{
interface TestIntf
{
["amd"]
void sleep(int ms);

void shutdown();
}
}
2 changes: 1 addition & 1 deletion csharp/test/Ice/inactivityTimeout/TestI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Ice.inactivityTimeout;

internal sealed class TestIntfI : Test.TestIntfDisp_
{
public override void sleep(int ms, Current current) => Thread.Sleep(ms);
public override Task sleepAsync(int ms, Current current) => Task.Delay(ms);

public override void shutdown(Current current) => current.adapter.getCommunicator().shutdown();
}
2 changes: 2 additions & 0 deletions java/test/src/main/java/test/Ice/inactivityTimeout/Test.ice
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ module Test
{
interface TestIntf
{
["amd"]
void sleep(int ms);

void shutdown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

class TestIntfI implements TestIntf {
@Override
public void sleep(int ms, Current current) {
try {
Thread.sleep(ms);
} catch (InterruptedException ex) {
// ignored
}
public java.util.concurrent.CompletionStage<Void> sleepAsync(int ms, Current current) {
return java.util.concurrent.CompletableFuture.runAsync(
() -> {
try {
Thread.sleep(ms);
} catch (InterruptedException ex) {
// ignored
}
});
}

@Override
Expand Down
11 changes: 0 additions & 11 deletions scripts/tests/Ice/inactivityTimeout.py

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/tests/Ice/maxConnections.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
TestSuite(
__name__,
testcases,
options={"compress": [False], "protocol": ["ssl", "ws", "tcp"]},
options={"compress": [False]},
multihost=False,
)

0 comments on commit 462dee3

Please sign in to comment.