Skip to content

Commit a8546cd

Browse files
committed
Merge tests into one
1 parent fce4fa1 commit a8546cd

File tree

5 files changed

+175
-214
lines changed

5 files changed

+175
-214
lines changed

eventstream_rpc/tests/EchoTestRpcModel.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -926,14 +926,14 @@ namespace Awstest
926926
{
927927
}
928928

929-
Aws::Crt::ScopedResource<OperationResponse> GetAllProductsOperationContext::AllocateInitialResponseFromPayload(
929+
Aws::Crt::ScopedResource<AbstractShapeBase> GetAllProductsOperationContext::AllocateInitialResponseFromPayload(
930930
Aws::Crt::StringView stringView,
931931
Aws::Crt::Allocator *allocator) const noexcept
932932
{
933933
return GetAllProductsResponse::s_allocateFromPayload(stringView, allocator);
934934
}
935935

936-
Aws::Crt::ScopedResource<OperationResponse> GetAllProductsOperationContext::AllocateStreamingResponseFromPayload(
936+
Aws::Crt::ScopedResource<AbstractShapeBase> GetAllProductsOperationContext::AllocateStreamingResponseFromPayload(
937937
Aws::Crt::StringView stringView,
938938
Aws::Crt::Allocator *allocator) const noexcept
939939
{
@@ -979,7 +979,7 @@ namespace Awstest
979979
const GetAllProductsRequest &request,
980980
OnMessageFlushCallback onMessageFlushCallback) noexcept
981981
{
982-
return ClientOperation::Activate(static_cast<const OperationRequest *>(&request), onMessageFlushCallback);
982+
return ClientOperation::Activate(static_cast<const AbstractShapeBase *>(&request), onMessageFlushCallback);
983983
}
984984

985985
Aws::Crt::String GetAllProductsOperation::GetModelName() const noexcept
@@ -993,14 +993,14 @@ namespace Awstest
993993
{
994994
}
995995

996-
Aws::Crt::ScopedResource<OperationResponse> CauseServiceErrorOperationContext::AllocateInitialResponseFromPayload(
996+
Aws::Crt::ScopedResource<AbstractShapeBase> CauseServiceErrorOperationContext::AllocateInitialResponseFromPayload(
997997
Aws::Crt::StringView stringView,
998998
Aws::Crt::Allocator *allocator) const noexcept
999999
{
10001000
return CauseServiceErrorResponse::s_allocateFromPayload(stringView, allocator);
10011001
}
10021002

1003-
Aws::Crt::ScopedResource<OperationResponse> CauseServiceErrorOperationContext::AllocateStreamingResponseFromPayload(
1003+
Aws::Crt::ScopedResource<AbstractShapeBase> CauseServiceErrorOperationContext::AllocateStreamingResponseFromPayload(
10041004
Aws::Crt::StringView stringView,
10051005
Aws::Crt::Allocator *allocator) const noexcept
10061006
{
@@ -1047,15 +1047,15 @@ namespace Awstest
10471047
const CauseServiceErrorRequest &request,
10481048
OnMessageFlushCallback onMessageFlushCallback) noexcept
10491049
{
1050-
return ClientOperation::Activate(static_cast<const OperationRequest *>(&request), onMessageFlushCallback);
1050+
return ClientOperation::Activate(static_cast<const AbstractShapeBase *>(&request), onMessageFlushCallback);
10511051
}
10521052

10531053
Aws::Crt::String CauseServiceErrorOperation::GetModelName() const noexcept
10541054
{
10551055
return m_operationModelContext.GetOperationName();
10561056
}
10571057

1058-
void CauseStreamServiceToErrorStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource<OperationResponse> response)
1058+
void CauseStreamServiceToErrorStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource<AbstractShapeBase> response)
10591059
{
10601060
OnStreamEvent(static_cast<EchoStreamingMessage *>(response.get()));
10611061
}
@@ -1077,14 +1077,14 @@ namespace Awstest
10771077
{
10781078
}
10791079

1080-
Aws::Crt::ScopedResource<OperationResponse> CauseStreamServiceToErrorOperationContext::
1080+
Aws::Crt::ScopedResource<AbstractShapeBase> CauseStreamServiceToErrorOperationContext::
10811081
AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator)
10821082
const noexcept
10831083
{
10841084
return EchoStreamingResponse::s_allocateFromPayload(stringView, allocator);
10851085
}
10861086

1087-
Aws::Crt::ScopedResource<OperationResponse> CauseStreamServiceToErrorOperationContext::
1087+
Aws::Crt::ScopedResource<AbstractShapeBase> CauseStreamServiceToErrorOperationContext::
10881088
AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator)
10891089
const noexcept
10901090
{
@@ -1132,15 +1132,15 @@ namespace Awstest
11321132
const EchoStreamingRequest &request,
11331133
OnMessageFlushCallback onMessageFlushCallback) noexcept
11341134
{
1135-
return ClientOperation::Activate(static_cast<const OperationRequest *>(&request), onMessageFlushCallback);
1135+
return ClientOperation::Activate(static_cast<const AbstractShapeBase *>(&request), onMessageFlushCallback);
11361136
}
11371137

11381138
Aws::Crt::String CauseStreamServiceToErrorOperation::GetModelName() const noexcept
11391139
{
11401140
return m_operationModelContext.GetOperationName();
11411141
}
11421142

1143-
void EchoStreamMessagesStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource<OperationResponse> response)
1143+
void EchoStreamMessagesStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource<AbstractShapeBase> response)
11441144
{
11451145
OnStreamEvent(static_cast<EchoStreamingMessage *>(response.get()));
11461146
}
@@ -1158,14 +1158,14 @@ namespace Awstest
11581158
{
11591159
}
11601160

1161-
Aws::Crt::ScopedResource<OperationResponse> EchoStreamMessagesOperationContext::AllocateInitialResponseFromPayload(
1161+
Aws::Crt::ScopedResource<AbstractShapeBase> EchoStreamMessagesOperationContext::AllocateInitialResponseFromPayload(
11621162
Aws::Crt::StringView stringView,
11631163
Aws::Crt::Allocator *allocator) const noexcept
11641164
{
11651165
return EchoStreamingResponse::s_allocateFromPayload(stringView, allocator);
11661166
}
11671167

1168-
Aws::Crt::ScopedResource<OperationResponse> EchoStreamMessagesOperationContext::
1168+
Aws::Crt::ScopedResource<AbstractShapeBase> EchoStreamMessagesOperationContext::
11691169
AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator)
11701170
const noexcept
11711171
{
@@ -1213,7 +1213,7 @@ namespace Awstest
12131213
const EchoStreamingRequest &request,
12141214
OnMessageFlushCallback onMessageFlushCallback) noexcept
12151215
{
1216-
return ClientOperation::Activate(static_cast<const OperationRequest *>(&request), onMessageFlushCallback);
1216+
return ClientOperation::Activate(static_cast<const AbstractShapeBase *>(&request), onMessageFlushCallback);
12171217
}
12181218

12191219
Aws::Crt::String EchoStreamMessagesOperation::GetModelName() const noexcept
@@ -1226,14 +1226,14 @@ namespace Awstest
12261226
{
12271227
}
12281228

1229-
Aws::Crt::ScopedResource<OperationResponse> EchoMessageOperationContext::AllocateInitialResponseFromPayload(
1229+
Aws::Crt::ScopedResource<AbstractShapeBase> EchoMessageOperationContext::AllocateInitialResponseFromPayload(
12301230
Aws::Crt::StringView stringView,
12311231
Aws::Crt::Allocator *allocator) const noexcept
12321232
{
12331233
return EchoMessageResponse::s_allocateFromPayload(stringView, allocator);
12341234
}
12351235

1236-
Aws::Crt::ScopedResource<OperationResponse> EchoMessageOperationContext::AllocateStreamingResponseFromPayload(
1236+
Aws::Crt::ScopedResource<AbstractShapeBase> EchoMessageOperationContext::AllocateStreamingResponseFromPayload(
12371237
Aws::Crt::StringView stringView,
12381238
Aws::Crt::Allocator *allocator) const noexcept
12391239
{
@@ -1279,7 +1279,7 @@ namespace Awstest
12791279
const EchoMessageRequest &request,
12801280
OnMessageFlushCallback onMessageFlushCallback) noexcept
12811281
{
1282-
return ClientOperation::Activate(static_cast<const OperationRequest *>(&request), onMessageFlushCallback);
1282+
return ClientOperation::Activate(static_cast<const AbstractShapeBase *>(&request), onMessageFlushCallback);
12831283
}
12841284

12851285
Aws::Crt::String EchoMessageOperation::GetModelName() const noexcept
@@ -1293,14 +1293,14 @@ namespace Awstest
12931293
{
12941294
}
12951295

1296-
Aws::Crt::ScopedResource<OperationResponse> GetAllCustomersOperationContext::AllocateInitialResponseFromPayload(
1296+
Aws::Crt::ScopedResource<AbstractShapeBase> GetAllCustomersOperationContext::AllocateInitialResponseFromPayload(
12971297
Aws::Crt::StringView stringView,
12981298
Aws::Crt::Allocator *allocator) const noexcept
12991299
{
13001300
return GetAllCustomersResponse::s_allocateFromPayload(stringView, allocator);
13011301
}
13021302

1303-
Aws::Crt::ScopedResource<OperationResponse> GetAllCustomersOperationContext::AllocateStreamingResponseFromPayload(
1303+
Aws::Crt::ScopedResource<AbstractShapeBase> GetAllCustomersOperationContext::AllocateStreamingResponseFromPayload(
13041304
Aws::Crt::StringView stringView,
13051305
Aws::Crt::Allocator *allocator) const noexcept
13061306
{
@@ -1346,7 +1346,7 @@ namespace Awstest
13461346
const GetAllCustomersRequest &request,
13471347
OnMessageFlushCallback onMessageFlushCallback) noexcept
13481348
{
1349-
return ClientOperation::Activate(static_cast<const OperationRequest *>(&request), onMessageFlushCallback);
1349+
return ClientOperation::Activate(static_cast<const AbstractShapeBase *>(&request), onMessageFlushCallback);
13501350
}
13511351

13521352
Aws::Crt::String GetAllCustomersOperation::GetModelName() const noexcept

eventstream_rpc/tests/EventStreamClientTest.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,6 @@ static int s_TestEventStreamConnect(struct aws_allocator *allocator, void *ctx)
8181
config.SetHostName(Aws::Crt::String("127.0.0.1"));
8282
config.SetPort(8033U);
8383

84-
/* Happy path case. */
85-
{
86-
TestLifecycleHandler lifecycleHandler;
87-
ClientConnection connection(allocator);
88-
connectionAmendment.AddHeader(EventStreamHeader(
89-
Aws::Crt::String("client-name"), Aws::Crt::String("accepted.testy_mc_testerson"), allocator));
90-
auto future = connection.Connect(config, &lifecycleHandler, clientBootstrap);
91-
ASSERT_TRUE(future.get().baseStatus == EVENT_STREAM_RPC_SUCCESS);
92-
lifecycleHandler.WaitOnCondition([&]() { return lifecycleHandler.isConnected; });
93-
/* Test all protocol messages. */
94-
future = connection.SendPing(
95-
Aws::Crt::List<EventStreamHeader>(), Aws::Crt::Optional<Aws::Crt::ByteBuf>(), nullptr);
96-
ASSERT_TRUE(future.get().baseStatus == EVENT_STREAM_RPC_SUCCESS);
97-
future = connection.SendPingResponse(
98-
Aws::Crt::List<EventStreamHeader>(), Aws::Crt::Optional<Aws::Crt::ByteBuf>(), nullptr);
99-
ASSERT_TRUE(future.get().baseStatus == EVENT_STREAM_RPC_SUCCESS);
100-
/* Close connection gracefully. */
101-
connection.Close();
102-
lifecycleHandler.WaitOnCondition([&]() { return lifecycleHandler.lastErrorCode == AWS_OP_SUCCESS; });
103-
}
104-
10584
/* Empty amendment headers. */
10685
{
10786
TestLifecycleHandler lifecycleHandler;
@@ -123,29 +102,11 @@ static int s_TestEventStreamConnect(struct aws_allocator *allocator, void *ctx)
123102
}
124103

125104
{
126-
Aws::Crt::ApiHandle apiHandle(allocator);
127-
Aws::Crt::Io::TlsContextOptions tlsCtxOptions = Aws::Crt::Io::TlsContextOptions::InitDefaultClient();
128-
Aws::Crt::Io::TlsContext tlsContext(tlsCtxOptions, Aws::Crt::Io::TlsMode::CLIENT, allocator);
129-
ASSERT_TRUE(tlsContext);
130-
131-
Aws::Crt::Io::TlsConnectionOptions tlsConnectionOptions = tlsContext.NewConnectionOptions();
132-
133-
Aws::Crt::Io::EventLoopGroup eventLoopGroup(0, allocator);
134-
ASSERT_TRUE(eventLoopGroup);
135-
136-
Aws::Crt::Io::DefaultHostResolver socketResolver(eventLoopGroup, 8, 30, allocator);
137-
ASSERT_TRUE(socketResolver);
138-
139-
Aws::Crt::Io::ClientBootstrap clientBootstrap(eventLoopGroup, socketResolver, allocator);
140-
ASSERT_TRUE(clientBootstrap);
141-
clientBootstrap.EnableBlockingShutdown();
142-
143105
ConnectionLifecycleHandler lifecycleHandler;
144106
Awstest::EchoTestRpcClient client(clientBootstrap, allocator);
145107
auto connectedStatus = client.Connect(lifecycleHandler);
146108
ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS);
147-
148-
//client.Close();
109+
client.Close().wait();
149110
}
150111
}
151112

eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -489,10 +489,10 @@ namespace Awstest
489489
{
490490
public:
491491
GetAllProductsOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept;
492-
Aws::Crt::ScopedResource<OperationResponse> AllocateInitialResponseFromPayload(
492+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
493493
Aws::Crt::StringView stringView,
494494
Aws::Crt::Allocator *allocator) const noexcept override;
495-
Aws::Crt::ScopedResource<OperationResponse> AllocateStreamingResponseFromPayload(
495+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
496496
Aws::Crt::StringView stringView,
497497
Aws::Crt::Allocator *allocator) const noexcept override;
498498
Aws::Crt::String GetRequestModelName() const noexcept override;
@@ -542,10 +542,10 @@ namespace Awstest
542542
{
543543
public:
544544
CauseServiceErrorOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept;
545-
Aws::Crt::ScopedResource<OperationResponse> AllocateInitialResponseFromPayload(
545+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
546546
Aws::Crt::StringView stringView,
547547
Aws::Crt::Allocator *allocator) const noexcept override;
548-
Aws::Crt::ScopedResource<OperationResponse> AllocateStreamingResponseFromPayload(
548+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
549549
Aws::Crt::StringView stringView,
550550
Aws::Crt::Allocator *allocator) const noexcept override;
551551
Aws::Crt::String GetRequestModelName() const noexcept override;
@@ -606,7 +606,7 @@ namespace Awstest
606606
/**
607607
* Invoked when a message is received on this continuation.
608608
*/
609-
void OnStreamEvent(Aws::Crt::ScopedResource<OperationResponse> response) override;
609+
void OnStreamEvent(Aws::Crt::ScopedResource<AbstractShapeBase> response) override;
610610
/**
611611
* Invoked when a message is received on this continuation but results in an error.
612612
*
@@ -618,10 +618,10 @@ namespace Awstest
618618
{
619619
public:
620620
CauseStreamServiceToErrorOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept;
621-
Aws::Crt::ScopedResource<OperationResponse> AllocateInitialResponseFromPayload(
621+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
622622
Aws::Crt::StringView stringView,
623623
Aws::Crt::Allocator *allocator) const noexcept override;
624-
Aws::Crt::ScopedResource<OperationResponse> AllocateStreamingResponseFromPayload(
624+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
625625
Aws::Crt::StringView stringView,
626626
Aws::Crt::Allocator *allocator) const noexcept override;
627627
Aws::Crt::String GetRequestModelName() const noexcept override;
@@ -679,7 +679,7 @@ namespace Awstest
679679
/**
680680
* Invoked when a message is received on this continuation.
681681
*/
682-
void OnStreamEvent(Aws::Crt::ScopedResource<OperationResponse> response) override;
682+
void OnStreamEvent(Aws::Crt::ScopedResource<AbstractShapeBase> response) override;
683683
/**
684684
* Invoked when a message is received on this continuation but results in an error.
685685
*
@@ -691,10 +691,10 @@ namespace Awstest
691691
{
692692
public:
693693
EchoStreamMessagesOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept;
694-
Aws::Crt::ScopedResource<OperationResponse> AllocateInitialResponseFromPayload(
694+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
695695
Aws::Crt::StringView stringView,
696696
Aws::Crt::Allocator *allocator) const noexcept override;
697-
Aws::Crt::ScopedResource<OperationResponse> AllocateStreamingResponseFromPayload(
697+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
698698
Aws::Crt::StringView stringView,
699699
Aws::Crt::Allocator *allocator) const noexcept override;
700700
Aws::Crt::String GetRequestModelName() const noexcept override;
@@ -745,10 +745,10 @@ namespace Awstest
745745
{
746746
public:
747747
EchoMessageOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept;
748-
Aws::Crt::ScopedResource<OperationResponse> AllocateInitialResponseFromPayload(
748+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
749749
Aws::Crt::StringView stringView,
750750
Aws::Crt::Allocator *allocator) const noexcept override;
751-
Aws::Crt::ScopedResource<OperationResponse> AllocateStreamingResponseFromPayload(
751+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
752752
Aws::Crt::StringView stringView,
753753
Aws::Crt::Allocator *allocator) const noexcept override;
754754
Aws::Crt::String GetRequestModelName() const noexcept override;
@@ -798,10 +798,10 @@ namespace Awstest
798798
{
799799
public:
800800
GetAllCustomersOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept;
801-
Aws::Crt::ScopedResource<OperationResponse> AllocateInitialResponseFromPayload(
801+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
802802
Aws::Crt::StringView stringView,
803803
Aws::Crt::Allocator *allocator) const noexcept override;
804-
Aws::Crt::ScopedResource<OperationResponse> AllocateStreamingResponseFromPayload(
804+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
805805
Aws::Crt::StringView stringView,
806806
Aws::Crt::Allocator *allocator) const noexcept override;
807807
Aws::Crt::String GetRequestModelName() const noexcept override;

0 commit comments

Comments
 (0)