-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #721 from apache/feature/674-improve-properties
Feature/674 improve properties
- Loading branch information
Showing
56 changed files
with
4,399 additions
and
604 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
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
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,39 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
set(RSA_UTILS_SRC | ||
src/celix_rsa_utils.c | ||
) | ||
|
||
add_library(rsa_utils STATIC ${RSA_UTILS_SRC}) | ||
set_target_properties(rsa_utils PROPERTIES OUTPUT_NAME "celix_rsa_utils") | ||
target_include_directories(rsa_utils PRIVATE src) | ||
target_include_directories(rsa_utils PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>) | ||
target_link_libraries(rsa_utils PUBLIC Celix::utils PRIVATE Celix::framework) | ||
|
||
install(TARGETS rsa_utils EXPORT celix LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT rsa | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/rsa_utils) | ||
install(DIRECTORY include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/rsa_utils/ | ||
COMPONENT rsa) | ||
|
||
#Setup target aliases to match external usage | ||
add_library(Celix::rsa_utils ALIAS rsa_utils) | ||
|
||
if (ENABLE_TESTING) | ||
add_subdirectory(gtest) | ||
endif () |
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,35 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
add_executable(test_rsa_utils | ||
src/RsaUtilsTestSuite.cc | ||
) | ||
|
||
target_link_libraries(test_rsa_utils PRIVATE rsa_utils GTest::gtest GTest::gtest_main Celix::framework) | ||
target_include_directories(test_utils PRIVATE ../src) #for version_private (needs refactoring of test) | ||
add_test(NAME test_rsa_utils COMMAND test_rsa_utils) | ||
setup_target_for_coverage(test_rsa_utils SCAN_DIR ..) | ||
|
||
if (EI_TESTS) | ||
add_executable(test_rsa_utils_ei | ||
src/RsaUtilsErrorInjectionTestSuite.cc | ||
) | ||
target_link_libraries(test_rsa_utils_ei PRIVATE rsa_utils GTest::gtest GTest::gtest_main) | ||
target_link_libraries(test_rsa_utils_ei PRIVATE properties_ei) | ||
add_test(NAME test_rsa_utils_ei COMMAND test_rsa_utils_ei) | ||
setup_target_for_coverage(test_rsa_utils_ei SCAN_DIR ..) | ||
endif () |
53 changes: 53 additions & 0 deletions
53
bundles/remote_services/rsa_utils/gtest/src/RsaUtilsErrorInjectionTestSuite.cc
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,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "celix_rsa_utils.h" | ||
#include "celix_properties_ei.h" | ||
#include "celix_err.h" | ||
|
||
class RsaUtilsErrorInjectionTestSuite : public ::testing::Test { | ||
public: | ||
RsaUtilsErrorInjectionTestSuite() { | ||
celix_ei_expect_celix_properties_copy(nullptr, 0, nullptr); | ||
celix_err_printErrors(stderr, nullptr, nullptr); | ||
} | ||
~RsaUtilsErrorInjectionTestSuite() override = default; | ||
}; | ||
|
||
TEST_F(RsaUtilsErrorInjectionTestSuite, PropertiesCopyFailureTest) { | ||
// Given an error injection for celix_properties_copy | ||
celix_ei_expect_celix_properties_copy((void*)celix_rsaUtils_createServicePropertiesFromEndpointProperties, 0, nullptr); | ||
|
||
// And an endpointProperties | ||
celix_autoptr(celix_properties_t) endpointProperties = celix_properties_create(); | ||
EXPECT_NE(endpointProperties, nullptr); | ||
|
||
// When calling celix_rsaUtils_createServicePropertiesFromEndpointProperties | ||
celix_properties_t* serviceProperties = nullptr; | ||
celix_status_t status = | ||
celix_rsaUtils_createServicePropertiesFromEndpointProperties(endpointProperties, &serviceProperties); | ||
|
||
// Then the status is CELIX_ENOMEM | ||
EXPECT_EQ(status, CELIX_ENOMEM); | ||
|
||
// And the serviceProperties is nullptr | ||
EXPECT_EQ(serviceProperties, nullptr); | ||
} |
Oops, something went wrong.