Skip to content
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

Merged
merged 4 commits into from
Mar 27, 2024

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Mar 26, 2024

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec added component - Measures component - Utilities Other Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Mar 26, 2024
@jmarrec jmarrec self-assigned this Mar 26, 2024
@jmarrec jmarrec marked this pull request as ready for review March 26, 2024 14:00
jmarrec added a commit to openstudiocoalition/OpenStudioApplication that referenced this pull request Mar 26, 2024
Comment on lines +184 to +187
std::string org() const;
std::string repo() const;
std::string releaseTag() const;
boost::optional<openstudio::DateTime> versionModified() const;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New functions for BCLSearchResults

Comment on lines +450 to +467
if (auto orgElement = componentElement.child("org")) {
m_org = orgElement.text().as_string();
}
if (auto repoElement = componentElement.child("repo")) {
m_repo = repoElement.text().as_string();
}
if (auto release_tagElement = componentElement.child("release_tag")) {
m_releaseTag = release_tagElement.text().as_string();
}
if (auto versionModifiedElement = componentElement.child("version_modified")) {
const std::string versionModified = versionModifiedElement.text().as_string();
if (!versionModified.empty()) {
// fromXsdDateTime forwards to fromISO8601 and handles both formats
if (auto dt_ = openstudio::DateTime::fromXsdDateTime(versionModified)) {
m_versionModified = *dt_;
}
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grab 'em

Comment on lines 421 to 461
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());
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());

auto dt_ = response.versionModified();
ASSERT_TRUE(dt_);
const openstudio::DateTime dateTime(Date(MonthOfYear::Nov, 14, 2022));
EXPECT_GT(*dt_, dateTime);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New test

src/utilities/bcl/test/BCL_GTest.cpp Outdated Show resolved Hide resolved
@ci-commercialbuildings
Copy link
Collaborator

ci-commercialbuildings commented Mar 27, 2024

CI Results for 8dc8a9c:

EXPECT_EQ("NREL", response.org());
EXPECT_FALSE(response.repo().empty());
EXPECT_EQ("openstudio-common-measures-gem", response.repo());
EXPECT_FALSE(response.releaseTag().empty());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it equal then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

@jmarrec jmarrec merged commit 1b653ae into develop Mar 27, 2024
3 of 6 checks passed
@jmarrec jmarrec deleted the 5125_BCLSearchResult_Improve branch March 27, 2024 16:03
jmarrec added a commit to openstudiocoalition/OpenStudioApplication that referenced this pull request May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Measures component - Utilities Other Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
3 participants