Skip to content

Commit

Permalink
FIX several FIXME PR cases
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Aug 30, 2024
1 parent 3e0ac73 commit 0410d5c
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
- Fix: $max and $min operators were not supported with DateTime attributes (#4585)
- Fix: wrong date values should not allowed in subscription's expires field (#4541)
- Fix: do not raise DB alarm in case of wrong GeoJSON in client request
- Fix: registrations with more tha one contextRegistration element (not possible in NGSIv2) are logged as Runtime Errors
- Upgrade cjexl version from 0.3.0 to 0.4.0 (new transformations: now, getTime and toIsoString)
- Upgrade Debian version from 12.4 to 12.6 in Dockerfile
6 changes: 5 additions & 1 deletion src/lib/mongoBackend/MongoGlobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1854,9 +1854,13 @@ bool registrationsQuery
ngsiv2::Registration reg;
if (reg.fromBson(r))
{
// FIXME PR: control error if Registration comes from NGSIv1
regV->push_back(reg);
}
else
{
// FIXME #4611: this else branch will be no longer needed after fixing the issue
LM_E(("Runtime Error (registrations with more than one CR are considered runtime errors since Orion 4.1.0, please fix reg %s at DB)", reg.id.c_str()));
}

/* FIXME: note that given the response doesn't distinguish from which registration ID the
* response comes, it could have that we have same context registration elements, belong to different
Expand Down
8 changes: 4 additions & 4 deletions src/lib/mongoBackend/mongoRegistrationGet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ void mongoRegistrationGet
//
if (!regP->fromBson(r))
{
// FIXME #4611: this check will be no longer needed after fixing the issue. setDataProvided return type could be changed to void
// FIXME #4611: this check will be no longer needed after fixing the issue. fromBson return type could be changed to void
orion::releaseMongoConnection(connection);
LM_W(("Bad Input (getting registrations with more than one CR"));
LM_E(("Runtime Error (registrations with more than one CR are considered runtime errors since Orion 4.1.0, please fix reg %s at DB)", regP->id.c_str()));
reqSemGive(__FUNCTION__, "Mongo Get Registration", reqSemTaken);
oeP->fill(SccReceiverInternalError, err);
return;
Expand Down Expand Up @@ -193,9 +193,9 @@ void mongoRegistrationsGet
//
if (!reg.fromBson(r))
{
// FIXME #4611: this check will be no longer needed after fixing the issue. setDataProvided return type could be changed to void
// FIXME #4611: this check will be no longer needed after fixing the issue. fromBson return type could be changed to void
orion::releaseMongoConnection(connection);
LM_W(("Bad Input (getting registrations with more than one CR"));
LM_E(("Runtime Error (registrations with more than one CR are considered runtime errors since Orion 4.1.0, please fix reg %s at DB)", reg.id.c_str()));
reqSemGive(__FUNCTION__, "Mongo Get Registrations", reqSemTaken);
oeP->fill(SccReceiverInternalError, err);
return;
Expand Down
12 changes: 2 additions & 10 deletions src/lib/ngsi/Scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,7 @@ int Scope::fill
pointV.push_back(pointP);
}

// FIXME PR: remove this "circle" processing that comes from NGSIv1?
if (geometry.areaType == "circle")
{
*errorStringP = "circle geometry is not supported by Orion API v2";
pointVectorRelease(pointV);
pointV.clear();
return -1;
}
else if (geometry.areaType == "polygon")
if (geometry.areaType == "polygon")
{
areaType = orion::PolygonType;

Expand Down Expand Up @@ -357,7 +349,7 @@ int Scope::fill
*/
void Scope::release(void)
{
// NOTE: georel, circle, box, and point don't use dynamic memory, so they don't need release methods
// NOTE: georel, box, and point don't use dynamic memory, so they don't need release methods
polygon.release();
line.release();

Expand Down
2 changes: 1 addition & 1 deletion src/lib/ngsi10/UpdateContextRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ std::string UpdateContextRequest::toJson(void)
* "updateAction": "APPEND"
* }
*/
std::string UpdateContextRequest::toJsonV1(bool asJsonObject)
std::string UpdateContextRequest::toJsonV1(void)
{
JsonObjectHelper jh;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/ngsi10/UpdateContextRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef struct UpdateContextRequest
UpdateContextRequest();
UpdateContextRequest(const std::string& _contextProvider, bool _providerFormat, Entity* eP);

std::string toJsonV1(bool asJsonObject);
std::string toJsonV1(void);
std::string toJson(void);
void release(void);
ContextAttribute* attributeLookup(Entity* eP, const std::string& attributeName);
Expand Down
6 changes: 0 additions & 6 deletions src/lib/orionTypes/areas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,6 @@ int Geometry::parse(const char* in, std::string* errorString)
}
}

if ((areaType == "circle") && (radius == -1))
{
*errorString = "no radius for circle";
return -1;
}

if ((areaType == "polygon") && (radius != -1))
{
*errorString = "radius set for polygon";
Expand Down
5 changes: 1 addition & 4 deletions src/lib/serviceRoutines/postUpdateContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ static bool updateForward
int port;
std::string prefix;

// FIXME PR: not really needed...
bool asJsonObject = (ciP->uriParam[URI_PARAM_ATTRIBUTE_FORMAT] == "object" && ciP->outMimeType == JSON);

//
// 1. Parse the providing application to extract IP, port and URI-path
//
Expand Down Expand Up @@ -155,7 +152,7 @@ static bool updateForward

if (upcrP->legacyProviderFormat)
{
TIMED_RENDER(payload = upcrP->toJsonV1(asJsonObject));
TIMED_RENDER(payload = upcrP->toJsonV1());

op = "/updateContext";

Expand Down
4 changes: 0 additions & 4 deletions test/unittests/mongoBackend/mongoQueryContextGeo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ extern void setMongoConnectionForUnitTest(orion::DBClientBase _connection);
*
* Tests
*
*
* - queryGeoCircleIn1
* - queryGeoCircleIn2
* - queryGeoCircleOut
* - queryGeoPolygonIn1
* - queryGeoPolygonIn2
* - queryGeoPolygonIn3
Expand Down

0 comments on commit 0410d5c

Please sign in to comment.