16 #ifndef AVS_CAPABILITIES_ASSETMANAGER_ACSDKASSETMANAGER_TEST_ARTIFACTUNDERTEST_H_ 17 #define AVS_CAPABILITIES_ASSETMANAGER_ACSDKASSETMANAGER_TEST_ARTIFACTUNDERTEST_H_ 31 #include "RequestFactory.h" 52 ,
public enable_shared_from_this<ArtifactUnderTest> {
55 return hasStateProp() && hasPriorityProp() && hasPathProp();
60 return commsHandler->readProperty(request->getSummary() + AMD::STATE_SUFFIX, value);
65 return commsHandler->readProperty(request->getSummary() + AMD::PRIORITY_SUFFIX, value);
69 return commsHandler->invoke(request->getSummary() + AMD::PATH_SUFFIX).isSucceeded();
74 commsHandler->readProperty(request->getSummary() + AMD::STATE_SUFFIX, value);
75 return static_cast<State>(value);
80 commsHandler->readProperty(request->getSummary() + AMD::PRIORITY_SUFFIX, temp);
85 return commsHandler->invoke(request->getSummary() + AMD::PATH_SUFFIX).value();
89 commsHandler->writeProperty(request->getSummary() + AMD::PRIORITY_SUFFIX,
static_cast<int>(p));
94 return waitUntil([
this, expectedState] {
return getStateProp() == expectedState; }, timeout);
98 if (PropertyName == request->getSummary() + AMD::STATE_SUFFIX) {
99 stateMap[
static_cast<State>(newValue)] += 1;
103 if (PropertyName == request->getSummary() + AMD::UPDATE_SUFFIX) {
108 updateEventCount = 0;
110 commsHandler->unsubscribeToPropertyChangeEvent(
111 request->getSummary() + AMD::STATE_SUFFIX,
113 commsHandler->unsubscribeToPropertyChangeEvent(
114 request->getSummary() + AMD::UPDATE_SUFFIX,
118 commsHandler->subscribeToPropertyChangeEvent(
119 request->getSummary() + AMD::STATE_SUFFIX,
121 commsHandler->subscribeToPropertyChangeEvent(
122 request->getSummary() + AMD::UPDATE_SUFFIX,
125 ArtifactUnderTest(std::shared_ptr<AmdCommunicationInterface> comm, shared_ptr<ArtifactRequest> request) :
131 unordered_map<State, int, alexaClientSDK::avsCommon::utils::functional::EnumClassHash>
stateMap;
132 int updateEventCount = 0;
135 #endif // AVS_CAPABILITIES_ASSETMANAGER_ACSDKASSETMANAGER_TEST_ARTIFACTUNDERTEST_H_ string getPathProp()
Definition: ArtifactUnderTest.h:84
State getStateProp()
Definition: ArtifactUnderTest.h:72
Definition: gmock-actions.h:53
void resetCounts()
Definition: ArtifactUnderTest.h:107
Priority getPriorityProp()
Definition: ArtifactUnderTest.h:78
ArtifactUnderTest(std::shared_ptr< AmdCommunicationInterface > comm, shared_ptr< ArtifactRequest > request)
Definition: ArtifactUnderTest.h:125
unordered_map< State, int, alexaClientSDK::avsCommon::utils::functional::EnumClassHash > stateMap
Definition: ArtifactUnderTest.h:131
::std::string string
Definition: gtest-port.h:1097
Definition: CapabilityConfiguration.h:190
Definition: CommunicationPropertyChangeSubscriber.h:28
void onCommunicationPropertyChange(const std::string &PropertyName, int newValue) override
Definition: ArtifactUnderTest.h:97
std::shared_ptr< AmdCommunicationInterface > commsHandler
Definition: ArtifactUnderTest.h:129
shared_ptr< ArtifactRequest > request
Definition: ArtifactUnderTest.h:130
Definition: ArtifactRequest.h:27
Definition: CommunicationInvokeHandlerInterface.h:27
Definition: AmdMetricWrapper.h:31
Definition: DavsClient.h:28
bool hasAllProps()
Definition: ArtifactUnderTest.h:54
bool hasPathProp()
Definition: ArtifactUnderTest.h:68
bool waitUntil(const std::function< bool()> &validate, std::chrono::milliseconds timeout=std::chrono::seconds(5))
Priority setPriorityProp(Priority p)
Definition: ArtifactUnderTest.h:88
State
Definition: State.h:35
bool waitUntilStateEquals(State expectedState, milliseconds timeout=milliseconds(500))
Definition: ArtifactUnderTest.h:93
bool hasPriorityProp()
Definition: ArtifactUnderTest.h:63
void onCommunicationPropertyChange(const std::string &PropertyName, string) override
Definition: ArtifactUnderTest.h:102
Definition: ArtifactHandlerInterface.h:24
bool hasStateProp()
Definition: ArtifactUnderTest.h:58
Definition: ArtifactUnderTest.h:49
Priority
Definition: Priority.h:27
void subscribeToChangeEvents()
Definition: ArtifactUnderTest.h:117