-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #5125 - Add versionModified, repo, org, releaseTag to BCLSearchResult #5126
Changes from 3 commits
d78870d
80b5d88
c36bfae
8dc8a9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
#include "../core/Path.hpp" | ||
#include "../core/Logger.hpp" | ||
#include "../data/Attribute.hpp" | ||
#include "../time/DateTime.hpp" | ||
|
||
namespace pugi { | ||
class xml_node; | ||
|
@@ -180,6 +181,11 @@ class UTILITIES_API BCLSearchResult | |
std::vector<BCLFile> files() const; | ||
std::vector<BCLCost> costs() const; | ||
|
||
std::string org() const; | ||
std::string repo() const; | ||
std::string releaseTag() const; | ||
boost::optional<openstudio::DateTime> versionModified() const; | ||
Comment on lines
+184
to
+187
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New functions for BCLSearchResults |
||
|
||
private: | ||
REGISTER_LOGGER("openstudio.BCLSearchResult"); | ||
|
||
|
@@ -196,6 +202,11 @@ class UTILITIES_API BCLSearchResult | |
std::vector<Attribute> m_attributes; | ||
std::vector<BCLFile> m_files; | ||
std::vector<BCLCost> m_costs; | ||
|
||
std::string m_org; | ||
std::string m_repo; | ||
std::string m_releaseTag; | ||
boost::optional<openstudio::DateTime> m_versionModified; | ||
}; | ||
|
||
/// This is a generic interface that can be used for searching either the local or remote bcl. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -417,3 +417,45 @@ TEST_F(BCLFixture, RemoteBCL_EncodingURI) { | |
std::vector<BCLSearchResult> responses = remoteBCL.searchComponentLibrary("ashrae 4A", 127); | ||
ASSERT_GT(responses.size(), 0u); | ||
} | ||
|
||
TEST_F(BCLFixture, RemoteBCL_BCLSearchResult) { | ||
RemoteBCL remoteBCL; | ||
|
||
const std::string openstudio_results_uid = "a25386cd-60e4-46bc-8b11-c755f379d916"; | ||
// get openstudio_results | ||
// std::vector<BCLSearchResult> responses = remoteBCL.searchMeasureLibrary("openstudio_results", 980); | ||
std::vector<BCLSearchResult> responses = remoteBCL.searchMeasureLibrary(openstudio_results_uid, 980); | ||
|
||
ASSERT_EQ(1, responses.size()); | ||
auto& response = responses.front(); | ||
|
||
EXPECT_FALSE(response.name().empty()); | ||
EXPECT_EQ("Openstudio results", response.name()); | ||
|
||
EXPECT_FALSE(response.uid().empty()); | ||
EXPECT_EQ(openstudio_results_uid, response.uid()); | ||
|
||
EXPECT_FALSE(response.versionId().empty()); | ||
EXPECT_FALSE(response.description().empty()); | ||
EXPECT_FALSE(response.modelerDescription().empty()); | ||
EXPECT_TRUE(response.fidelityLevel().empty()); | ||
EXPECT_EQ("measure", response.componentType()); | ||
|
||
EXPECT_TRUE(response.provenanceRequired()); | ||
jmarrec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EXPECT_TRUE(response.provenances().empty()); | ||
EXPECT_FALSE(response.tags().empty()); | ||
EXPECT_FALSE(response.attributes().empty()); | ||
EXPECT_FALSE(response.files().empty()); | ||
EXPECT_TRUE(response.costs().empty()); | ||
|
||
EXPECT_FALSE(response.org().empty()); | ||
EXPECT_EQ("NREL", response.org()); | ||
EXPECT_FALSE(response.repo().empty()); | ||
EXPECT_EQ("openstudio-common-measures-gem", response.repo()); | ||
EXPECT_FALSE(response.releaseTag().empty()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does it equal then? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://bcl.nrel.gov/api/search/?fq=uuid:a25386cd-60e4-46bc-8b11-c755f379d916&all_content_versions=1 Currently that's v0.9.0. But this is going to change every time the openstudio_results is updated, so I don't want to pin it and have to update the test |
||
|
||
auto dt_ = response.versionModified(); | ||
ASSERT_TRUE(dt_); | ||
const openstudio::DateTime dateTime(Date(MonthOfYear::Nov, 14, 2022)); | ||
EXPECT_GT(*dt_, dateTime); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grab 'em