|
| 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 | +} |
0 commit comments