forked from telefonicaid/fiware-orion
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixeda bug about expanding attribute names in URL. Moved orionldAttri…
…buteExpand+orionldSubAttributeExpand to own modules. Added an exhaustive TRoE test for deleting attributes
- Loading branch information
Showing
13 changed files
with
1,108 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* | ||
* Copyright 2021 FIWARE Foundation e.V. | ||
* | ||
* This file is part of Orion-LD Context Broker. | ||
* | ||
* Orion-LD Context Broker is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* Orion-LD Context Broker is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Orion-LD Context Broker. If not, see http://www.gnu.org/licenses/. | ||
* | ||
* For those usages not covered by this license please contact with | ||
* orionld at fiware dot org | ||
* | ||
* Author: Ken Zangelin | ||
*/ | ||
#include <string.h> // strchr | ||
|
||
#include "logMsg/logMsg.h" // LM_* | ||
#include "logMsg/traceLevels.h" // Lmt* | ||
|
||
#include "orionld/context/orionldContextItemAlreadyExpanded.h" // orionldContextItemAlreadyExpanded | ||
#include "orionld/context/orionldContextItemExpand.h" // orionldContextItemExpand | ||
#include "orionld/context/orionldAttributeExpand.h" // Own interface | ||
|
||
|
||
// ----------------------------------------------------------------------------- | ||
// | ||
// orionldAttributeExpand - | ||
// | ||
// This function expands unless: | ||
// - has already been expanded | ||
// - is a special attribute such as 'location' | ||
// | ||
char* orionldAttributeExpand | ||
( | ||
OrionldContext* contextP, | ||
char* shortName, | ||
bool useDefaultUrlIfNotFound, | ||
OrionldContextItem** contextItemPP | ||
) | ||
{ | ||
if (orionldContextItemAlreadyExpanded(shortName) == true) | ||
return shortName; | ||
|
||
if (strcmp(shortName, "location") == 0) return shortName; | ||
else if (strcmp(shortName, "observationSpace") == 0) return shortName; | ||
else if (strcmp(shortName, "operationSpace") == 0) return shortName; | ||
|
||
return orionldContextItemExpand(contextP, shortName, useDefaultUrlIfNotFound, contextItemPP); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef SRC_LIB_ORIONLD_CONTEXT_ORIONLDATTRIBUTEEXPAND_H_ | ||
#define SRC_LIB_ORIONLD_CONTEXT_ORIONLDATTRIBUTEEXPAND_H_ | ||
|
||
/* | ||
* | ||
* Copyright 2019 FIWARE Foundation e.V. | ||
* | ||
* This file is part of Orion-LD Context Broker. | ||
* | ||
* Orion-LD Context Broker is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* Orion-LD Context Broker is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Orion-LD Context Broker. If not, see http://www.gnu.org/licenses/. | ||
* | ||
* For those usages not covered by this license please contact with | ||
* orionld at fiware dot org | ||
* | ||
* Author: Ken Zangelin | ||
*/ | ||
#include "orionld/context/OrionldContext.h" // OrionldContext | ||
#include "orionld/context/OrionldContextItem.h" // OrionldContextItem | ||
|
||
|
||
|
||
// ----------------------------------------------------------------------------- | ||
// | ||
// orionldAttributeExpand.h - | ||
// | ||
// This function expands unless: | ||
// - has already been expanded | ||
// - is a special attribute such as location, datasetId, ... | ||
// | ||
extern char* orionldAttributeExpand | ||
( | ||
OrionldContext* contextP, | ||
char* shortName, | ||
bool useDefaultUrlIfNotFound, | ||
OrionldContextItem** contextItemPP | ||
); | ||
|
||
#endif // SRC_LIB_ORIONLD_CONTEXT_ORIONLDATTRIBUTEEXPAND_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* | ||
* Copyright 2021 FIWARE Foundation e.V. | ||
* | ||
* This file is part of Orion-LD Context Broker. | ||
* | ||
* Orion-LD Context Broker is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* Orion-LD Context Broker is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Orion-LD Context Broker. If not, see http://www.gnu.org/licenses/. | ||
* | ||
* For those usages not covered by this license please contact with | ||
* orionld at fiware dot org | ||
* | ||
* Author: Ken Zangelin | ||
*/ | ||
#include <string.h> // strchr | ||
|
||
#include "logMsg/logMsg.h" // LM_* | ||
#include "logMsg/traceLevels.h" // Lmt* | ||
|
||
#include "orionld/context/orionldContextItemAlreadyExpanded.h" // orionldContextItemAlreadyExpanded | ||
#include "orionld/context/orionldContextItemExpand.h" // orionldContextItemExpand | ||
#include "orionld/context/orionldSubAttributeExpand.h" // Own interface | ||
|
||
|
||
// ----------------------------------------------------------------------------- | ||
// | ||
// orionldSubAttributeExpand - | ||
// | ||
// This function expands unless: | ||
// - has already been expanded | ||
// - is a special sub-attribute such as 'location', 'datasetyId', ... | ||
// | ||
char* orionldSubAttributeExpand | ||
( | ||
OrionldContext* contextP, | ||
char* shortName, | ||
bool useDefaultUrlIfNotFound, | ||
OrionldContextItem** contextItemPP | ||
) | ||
{ | ||
if (orionldContextItemAlreadyExpanded(shortName) == true) | ||
return shortName; | ||
|
||
if (strcmp(shortName, "location") == 0) return shortName; | ||
else if (strcmp(shortName, "observedAt") == 0) return shortName; | ||
else if (strcmp(shortName, "unitCode") == 0) return shortName; | ||
else if (strcmp(shortName, "datasetId") == 0) return shortName; | ||
|
||
return orionldContextItemExpand(contextP, shortName, useDefaultUrlIfNotFound, contextItemPP); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef SRC_LIB_ORIONLD_CONTEXT_ORIONLDSUBATTRIBUTEEXPAND_H_ | ||
#define SRC_LIB_ORIONLD_CONTEXT_ORIONLDSUBATTRIBUTEEXPAND_H_ | ||
|
||
/* | ||
* | ||
* Copyright 2019 FIWARE Foundation e.V. | ||
* | ||
* This file is part of Orion-LD Context Broker. | ||
* | ||
* Orion-LD Context Broker is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* Orion-LD Context Broker is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Orion-LD Context Broker. If not, see http://www.gnu.org/licenses/. | ||
* | ||
* For those usages not covered by this license please contact with | ||
* orionld at fiware dot org | ||
* | ||
* Author: Ken Zangelin | ||
*/ | ||
#include "orionld/context/OrionldContext.h" // OrionldContext | ||
#include "orionld/context/OrionldContextItem.h" // OrionldContextItem | ||
|
||
|
||
|
||
// ----------------------------------------------------------------------------- | ||
// | ||
// orionldSubAttributeExpand.h - | ||
// | ||
// This function expands unless: | ||
// - has already been expanded | ||
// - is a special attribute such as location, datasetId, ... | ||
// | ||
extern char* orionldSubAttributeExpand | ||
( | ||
OrionldContext* contextP, | ||
char* shortName, | ||
bool useDefaultUrlIfNotFound, | ||
OrionldContextItem** contextItemPP | ||
); | ||
|
||
#endif // SRC_LIB_ORIONLD_CONTEXT_ORIONLDSUBATTRIBUTEEXPAND_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.