Skip to content

Commit 90b77b7

Browse files
Bug fix : Set the connection history end date of a WellboreCompletion which is not a perforation
1 parent 802c4fb commit 90b77b7

5 files changed

Lines changed: 105 additions & 21 deletions

File tree

src/witsml2_1/WellboreCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ void WellboreCompletion::setConnectionHistoryEndDate(uint64_t historyIndex,
745745
if (statusHistory->EndDate == nullptr) {
746746
statusHistory->EndDate = soap_new_tm(gsoapProxy2_3->soap);
747747
}
748-
*statusHistory->StartDate = timeTools::to_calendar_time(timeTools::from_time_t(endDate));
748+
*statusHistory->EndDate = timeTools::to_calendar_time(timeTools::from_time_t(endDate));
749749
}
750750
}
751751

test/unitTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ under the License.
8080
#include "witsml2_test/Trajectory.h"
8181
#include "witsml2_test/Perforation.h"
8282
#include "witsml2_test/WellboreGeometryTest.h"
83+
#include "witsml2_test/WellboreCompletion.h"
8384
#if WITH_RESQML2_2
8485
#include "eml2_3test/GraphicalInformationSetTest.h"
8586
#include "resqml2_2test/DiscreteColorMapTest.h"
@@ -273,6 +274,7 @@ FESAPI_TEST("Export and import a WITSML well", "[well]", WellTest)
273274
FESAPI_TEST("Export and import a WITSML trajectory", "[well]", Trajectory)
274275
FESAPI_TEST("Export and import a WITSML perforation", "[well]", Perforation)
275276
FESAPI_TEST("Export and import a WITSML Wellbore Geometry", "[well]", WellboreGeometryTest)
277+
FESAPI_TEST("Export and import a WITSML Wellbore Completion", "[well]", WellboreCompletion)
276278

277279
// SEISMIC
278280
FESAPI_TEST("Export and import a seismic lattice feature", "[seismic]", SeismicLatticeRepresentationTest)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*-----------------------------------------------------------------------
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"; you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-----------------------------------------------------------------------*/
19+
#include "WellboreCompletion.h"
20+
21+
#include <stdexcept>
22+
23+
#include "../catch.hpp"
24+
25+
#include "witsml2_1/Wellbore.h"
26+
#include "witsml2_1/WellboreCompletion.h"
27+
28+
using namespace std;
29+
using namespace witsml2_test;
30+
using namespace COMMON_NS;
31+
32+
WellboreCompletion::WellboreCompletion(const string& epcDocPath)
33+
: AbstractTest(epcDocPath) {
34+
}
35+
36+
void WellboreCompletion::initRepo() {
37+
WITSML2_NS::Wellbore* wellbore = repo->createPartial<WITSML2_1_NS::Wellbore>("", "");
38+
WITSML2_1_NS::WellboreCompletion* witsmlWbCompletion = repo->createWellboreCompletion(wellbore, defaultUuid, defaultTitle);
39+
40+
witsmlWbCompletion->pushBackConnection(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, gsoap_eml2_3::eml23__LengthUom::m, 1000, 1100, "uid0");
41+
witsmlWbCompletion->pushBackConnection(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, gsoap_eml2_3::eml23__LengthUom::m, 1200, 1300, "uid1");
42+
witsmlWbCompletion->pushBackConnection(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::OPEN_HOLE, gsoap_eml2_3::eml23__LengthUom::m, 1300, 1400, "uid2");
43+
witsmlWbCompletion->pushBackConnection(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::SLOTS, gsoap_eml2_3::eml23__LengthUom::ft, 5500, 5600, "uid3");
44+
witsmlWbCompletion->pushBackConnection(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, gsoap_eml2_3::eml23__LengthUom::m, 10000, 11000, "uid4");
45+
46+
witsmlWbCompletion->pushBackConnectionHistory(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1);
47+
witsmlWbCompletion->pushBackConnectionHistory(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1);
48+
witsmlWbCompletion->pushBackConnectionHistory(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, 0);
49+
witsmlWbCompletion->pushBackConnectionHistory(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::OPEN_HOLE, 0);
50+
witsmlWbCompletion->pushBackConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::SLOTS, 0, "testingExtraMetadataKey", "testingExtraMetadataValue");
51+
52+
witsmlWbCompletion->setConnectionHistoryMdInterval(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1, gsoap_eml2_3::eml23__LengthUom::m, 1000, 1100);
53+
witsmlWbCompletion->setConnectionHistoryMdInterval(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1, gsoap_eml2_3::eml23__LengthUom::m, 1000, 1100);
54+
witsmlWbCompletion->setConnectionHistoryStatus(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1, gsoap_eml2_3::witsml21__PhysicalStatus::open);
55+
witsmlWbCompletion->setConnectionHistoryStatus(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1, gsoap_eml2_3::witsml21__PhysicalStatus::closed);
56+
witsmlWbCompletion->setConnectionHistoryStartDate(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1, 0);
57+
witsmlWbCompletion->setConnectionHistoryEndDate(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1, 3600);
58+
witsmlWbCompletion->setConnectionHistoryStartDate(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, 0, 7200);
59+
witsmlWbCompletion->setConnectionHistoryEndDate(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, 0, 8000);
60+
}
61+
62+
void WellboreCompletion::readRepo() {
63+
WITSML2_1_NS::WellboreCompletion* witsmlWbCompletion = repo->getDataObjectByUuid<WITSML2_1_NS::WellboreCompletion>(defaultUuid);
64+
REQUIRE (witsmlWbCompletion != nullptr);
65+
66+
REQUIRE(witsmlWbCompletion->getConnectionCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION) == 2);
67+
REQUIRE(witsmlWbCompletion->getConnectionCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK) == 1);
68+
REQUIRE(witsmlWbCompletion->getConnectionCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::OPEN_HOLE) == 1);
69+
REQUIRE(witsmlWbCompletion->getConnectionCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::SLOTS) == 1);
70+
71+
REQUIRE(witsmlWbCompletion->getConnectionHistoryCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 0) == 0);
72+
REQUIRE(witsmlWbCompletion->getConnectionHistoryCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == 2);
73+
REQUIRE(witsmlWbCompletion->getConnectionHistoryCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, 0) == 1);
74+
REQUIRE(witsmlWbCompletion->getConnectionHistoryCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::OPEN_HOLE, 0) == 1);
75+
REQUIRE(witsmlWbCompletion->getConnectionHistoryCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::SLOTS, 0) == 0);
76+
REQUIRE(witsmlWbCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::SLOTS, 0, "testingExtraMetadataKey").size() == 1);
77+
REQUIRE(witsmlWbCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::SLOTS, 0, "testingExtraMetadataKey")[0] == "testingExtraMetadataValue");
78+
REQUIRE_THROWS(witsmlWbCompletion->getConnectionHistoryCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, 1) == 0);
79+
80+
REQUIRE(witsmlWbCompletion->getConnectionHistoryTopMd(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == 1000);
81+
REQUIRE(witsmlWbCompletion->getConnectionHistoryBaseMd(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == 1100);
82+
REQUIRE(witsmlWbCompletion->getConnectionHistoryTopMd(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == 1000);
83+
REQUIRE(witsmlWbCompletion->getConnectionHistoryBaseMd(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == 1100);
84+
REQUIRE(witsmlWbCompletion->getConnectionHistoryStatus(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == gsoap_eml2_3::witsml21__PhysicalStatus::open);
85+
REQUIRE(witsmlWbCompletion->getConnectionHistoryStatus(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == gsoap_eml2_3::witsml21__PhysicalStatus::closed);
86+
REQUIRE(witsmlWbCompletion->getConnectionHistoryStartDate(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == 0);
87+
REQUIRE(!witsmlWbCompletion->hasConnectionHistoryEndDate(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1));
88+
REQUIRE(witsmlWbCompletion->getConnectionHistoryEndDate(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1) == 3600);
89+
REQUIRE(!witsmlWbCompletion->hasConnectionHistoryStartDate(1, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, 1));
90+
REQUIRE(witsmlWbCompletion->getConnectionHistoryStartDate(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, 0) == 7200);
91+
REQUIRE(witsmlWbCompletion->getConnectionHistoryEndDate(0, WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::GRAVEL_PACK, 0) == 8000);
92+
}
Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,21 @@ under the License.
2121
#include "../AbstractTest.h"
2222
#include <string>
2323

24-
namespace COMMON_NS {
25-
class DataObjectRepository;
26-
}
27-
2824
namespace witsml2_test {
29-
class WellboreGeometryTest : public commontest::AbstractTest {
25+
class WellboreCompletion : public commontest::AbstractTest {
3026
public:
31-
static const char* defaultUuid;
32-
static const char* defaultTitle;
27+
static constexpr char const* defaultUuid = "27ff6ec3-ad84-4ac2-baa1-1f050259404d";
28+
static constexpr char const* defaultTitle = "testing wellbore completion";
3329

3430
/**
3531
* Creation of a testing object from an EPC document path. At serialize() call,
36-
* exising .epc file will be erased.
32+
* existing .epc file will be erased.
3733
* @param epcDocPath the path of the .epc file (including .epc extension)
3834
*/
39-
WellboreGeometryTest(const std::string & epcDocPath);
35+
WellboreCompletion(const std::string& epcDocPath);
4036

41-
/**
42-
* Creation of a testing object from an existing EPC document.
43-
* @param repo an existing EPC document
44-
* @param init true if this object is created for initialization purpose else false if it is
45-
* created for reading purpose. According to init value a iniEpcDoc() or readRepo() is called.
46-
*/
47-
WellboreGeometryTest(COMMON_NS::DataObjectRepository* repo, bool init);
4837
protected:
4938
void initRepo();
5039
void readRepo();
5140
};
5241
}
53-

test/witsml2_test/WellboreGeometryTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ specific language governing permissions and limitations
1717
under the License.
1818
-----------------------------------------------------------------------*/
1919
#include "WellboreGeometryTest.h"
20+
21+
#include <stdexcept>
22+
2023
#include "../catch.hpp"
21-
#include "witsml2_1/Well.h"
24+
2225
#include "witsml2_1/Wellbore.h"
2326
#include "witsml2_1/WellboreGeometry.h"
24-
#include <stdexcept>
2527

2628
using namespace std;
2729
using namespace witsml2_test;
@@ -35,7 +37,7 @@ WellboreGeometryTest::WellboreGeometryTest(const string & epcDocPath)
3537
}
3638

3739
void WellboreGeometryTest::initRepo() {
38-
WITSML2_1_NS::Wellbore* wellbore = repo->createPartial<WITSML2_1_NS::Wellbore>("", "");
40+
WITSML2_NS::Wellbore* wellbore = repo->createPartial<WITSML2_1_NS::Wellbore>("", "");
3941
WITSML2_1_NS::WellboreGeometry* witsmlWbGeom = repo->createWellboreGeometry(wellbore, defaultUuid, "WellboreGeometry TEST", false);
4042

4143
witsmlWbGeom->pushBackSection(0, 250, gsoap_eml2_3::eml23__LengthUom::m);

0 commit comments

Comments
 (0)