platform/core/test/security-tests.git
9 years agoMerging tizen into ckm. Stage 1. 18/38318/1
Krzysztof Jackiewicz [Thu, 16 Apr 2015 09:36:22 +0000 (11:36 +0200)]
Merging tizen into ckm. Stage 1.

Merged commit '4f20901f76f8909da0d07f8b5f8f33e8651ea135' into ckm

Conflicts:
tests/common/dbus_access.cpp
tests/common/dbus_access.h
tests/cynara-tests/common/cynara_test_env.cpp
tests/security-server-tests/security_server_clean_env.cpp

Change-Id: I246988d04c104e990af34f06b10c6b79e3e5793d

9 years agoCKM: Security-server removed from dependencies 17/38317/1
Krzysztof Jackiewicz [Wed, 15 Apr 2015 11:56:56 +0000 (13:56 +0200)]
CKM: Security-server removed from dependencies

[Issue#] N/A
[Feature/Bug] N/A
[Problem] N/A
[Cause] Security server is not used.
[Solution] Removed.

[Verification] Successfull compilation

Change-Id: I398757dcba891feedd15d6ab51fa374e879975fa

9 years agoCKM: tizen.org does not use security-server: disabling security-server tests. 66/38066/2
Maciej J. Karpiuk [Thu, 9 Apr 2015 07:57:05 +0000 (09:57 +0200)]
CKM: tizen.org does not use security-server: disabling security-server tests.

Change-Id: I47c1ed4a6f0522b9c32954696521c19373841bbf

9 years agoCKM: no more "empty password for lockscreen" logics. 36/38236/2
Maciej J. Karpiuk [Tue, 14 Apr 2015 13:15:28 +0000 (15:15 +0200)]
CKM: no more "empty password for lockscreen" logics.

Change-Id: Ie30acad07523218f5474d531cc7fcc579584181f

9 years agoCKM: certificates refreshed (some were already expired). 85/35885/7
Maciej J. Karpiuk [Wed, 25 Feb 2015 12:58:44 +0000 (13:58 +0100)]
CKM: certificates refreshed (some were already expired).

Change-Id: Iad2449aed5ce3a2e07cdf60e0b57dce56e1e8f10

9 years agoModify some test codes according to key-manager's 2.4 API changes 77/36277/2
yuseok.jeon [Wed, 25 Feb 2015 09:21:41 +0000 (18:21 +0900)]
Modify some test codes according to key-manager's 2.4 API changes

Change-Id: Ibfd46fd0f3c3a4c4b11488788eabbc2bae105d2d

9 years agoCKM: CC mode uses user label to read & write keys. 48/35848/3
Maciej J. Karpiuk [Wed, 25 Feb 2015 10:02:51 +0000 (11:02 +0100)]
CKM: CC mode uses user label to read & write keys.

Buxton does not allow root to modify user owned keys.

Change-Id: I106422a866fb6048ff359721dc30af68153661c8

9 years agoCKM: access control tests use more descriptive error reporting 47/35847/2
Maciej J. Karpiuk [Wed, 25 Feb 2015 09:58:31 +0000 (10:58 +0100)]
CKM: access control tests use more descriptive error reporting

Change-Id: I02ce9162f4833b9a9175e88619a418c0045d0285

9 years agoCKM: Split signture tests into two groups. 93/35893/1
Bartlomiej Grzelewski [Wed, 18 Feb 2015 15:14:57 +0000 (16:14 +0100)]
CKM: Split signture tests into two groups.

Change-Id: I3277c009ad05889ef587923731f8aba3177174bc

9 years agoCKM: tests adjusted to tizenorg.
Maciej J. Karpiuk [Wed, 18 Feb 2015 11:49:18 +0000 (12:49 +0100)]
CKM: tests adjusted to tizenorg.

9 years agoInstall vconf key for testing key-manager in packaging install time.
kyungwook tak [Wed, 11 Feb 2015 06:08:03 +0000 (15:08 +0900)]
Install vconf key for testing key-manager in packaging install time.

vconf key cannot Install(set at first time)/unset in runtime.
It should be installed in package(rpm) install time.

Change-Id: I196df5cb8a7e6b6a9a0653d66dfc6e9e55e73e52
Signed-off-by: kyungwook tak <k.tak@samsung.com>
9 years agoCKM: Add new test to check if getCertificateChain return proper code.
Bartlomiej Grzelewski [Mon, 9 Feb 2015 18:15:50 +0000 (19:15 +0100)]
CKM: Add new test to check if getCertificateChain return proper code.

Change-Id: I293e6132dbe179254575940e6c51acd261e0145e

9 years agoCKM: Adopt tests to new PKCS12 api.
Bartlomiej Grzelewski [Wed, 4 Feb 2015 18:35:48 +0000 (19:35 +0100)]
CKM: Adopt tests to new PKCS12 api.

New api may take 2 passwords to decrypt data from pkcs12.

Change-Id: I6ea8e33005ce0b7b1db5cb69a265a68f2cc72398

9 years agoCKM: Fix Control::restUserPassword test.
Bartlomiej Grzelewski [Tue, 10 Feb 2015 15:33:40 +0000 (16:33 +0100)]
CKM: Fix Control::restUserPassword test.

resetUserPassword will work if no key exists for the user.

Change-Id: Idc5080dc48e3e965c4af791f86572d2897ee7a43

9 years agoCKM: Adopt tests to new api behaviour.
Bartlomiej Grzelewski [Wed, 4 Feb 2015 18:35:48 +0000 (19:35 +0100)]
CKM: Adopt tests to new api behaviour.

If Password is wrong api will return CKM_API_ERROR_AUTHENTICATION_ERROR
instead CKM_API_ERROR_SERVER_ERROR.

Change-Id: I9457414e44a1e95824371716a055bcd48855d370

9 years agoCKM: Add test for getData with broken password.
Bartlomiej Grzelewski [Wed, 4 Feb 2015 16:57:33 +0000 (17:57 +0100)]
CKM: Add test for getData with broken password.

Change-Id: Iad82b7c0523c5600a60cc5ed8d0c50a0e9a8f9a5

9 years agoCKM: Add negative test for CKM::Control::unlock function.
Bartlomiej Grzelewski [Wed, 4 Feb 2015 12:24:48 +0000 (13:24 +0100)]
CKM: Add negative test for CKM::Control::unlock function.

Change-Id: I2ddc8572d033eb7b138fe6ad255669082fc31245

9 years agoCKM: Add test for PKCS12 api.
Bartlomiej Grzelewski [Tue, 3 Feb 2015 16:31:56 +0000 (17:31 +0100)]
CKM: Add test for PKCS12 api.

Change-Id: I931405c6315053424425bec6ebfbe6e3de01d683

9 years agoCKM: Add support for CKMC_ERROR_FILE_SYSTEM error.
Bartlomiej Grzelewski [Thu, 29 Jan 2015 14:39:02 +0000 (15:39 +0100)]
CKM: Add support for CKMC_ERROR_FILE_SYSTEM error.

Change-Id: I5288d565269767b3043ba0c9ae9a4584c85c665c

9 years agoAdd tests for deprecated access control API.
Maciej J. Karpiuk [Mon, 2 Feb 2015 09:44:31 +0000 (10:44 +0100)]
Add tests for deprecated access control API.

[Issue#] N/A
[Feature/Bug] bug discovered in the key-manager. This commit verifies bug resolution.
[Problem] deprecated access control API incorrectly mapped values into permissions.
[Solution] fix to key-manager plus appropriate tests in the security-tests.
[Verification] all T300_CKMC_ACCESS_CONTROL_C_API should pass.

Change-Id: I9bc52b0e493bb7dbde14b5793d18d5b924806648

9 years agoCKM:Add compilation flag for MDPP
Krzysztof Jackiewicz [Tue, 27 Jan 2015 09:45:28 +0000 (10:45 +0100)]
CKM:Add compilation flag for MDPP

[Issue#] N/A
[Feature/Bug] N/A
[Problem] Failing CC mode tests
[Cause] Compilation flag that disables MDPP logic has been introduced in
key-manager
[Solution] The same flag added to tests. When MDPP is disabled we expect
reading private keys to succeed.

[Verification] Compile and install key-manager and tests. Run:
ckm-tests --group=CKM_CC_MODE

Change-Id: I497c703108b6e2ee21599311beaa0d153c147d13

9 years agoRUNNER_ASSERT wrappers moved to ckm-common.h
Krzysztof Jackiewicz [Mon, 26 Jan 2015 13:04:46 +0000 (14:04 +0100)]
RUNNER_ASSERT wrappers moved to ckm-common.h

[Issue#] N/A
[Feature/Bug] N/A
[Problem] N/A
[Cause] Wrappers for RUNNER_ASSERT could be used by other tests.
[Solution] Wrappers moved to ckm-common.h

[Verification] Successfull compilation

Change-Id: Id9766c09d07c142814c3f3acd65a7b581ab5a061

9 years agoReplace deprecated cert chain API with new one
Krzysztof Jackiewicz [Wed, 21 Jan 2015 13:22:18 +0000 (14:22 +0100)]
Replace deprecated cert chain API with new one

[Issue#] N/A
[Feature/Bug] N/A
[Problem] Old cert chain API is deprecated
[Cause] N/A
[Solution] Use new API

[Verification] Run tests

Change-Id: Ie1f6197af0afbebfc39e9661c010f176e718f7d3

9 years agoTest for certificate chain API
Krzysztof Jackiewicz [Wed, 10 Dec 2014 08:19:18 +0000 (09:19 +0100)]
Test for certificate chain API

[Issue#] N/A
[Feature/Bug] N/A
[Problem] N/A
[Cause] N/A
[Solution] Test for new certificate chain API added

[Verification] Run tests

Change-Id: I2b27db15d3424b8ed511509aadd77af829f9a055

9 years agoHelper functions for certificate chains
Krzysztof Jackiewicz [Thu, 18 Dec 2014 21:02:15 +0000 (22:02 +0100)]
Helper functions for certificate chains

[Issue#] N/A
[Feature/Bug] N/A
[Problem] Excessive code
[Cause] N/A
[Solution] Helper functions used

[Verification] Compile and run tests

Change-Id: I361b6f117b360a15f514cc1fce4e7c3f9bb39d89

9 years agoCertificate chain tests moved to separate file
Krzysztof Jackiewicz [Thu, 18 Dec 2014 17:26:03 +0000 (18:26 +0100)]
Certificate chain tests moved to separate file

[Issue#] N/A
[Feature/Bug] N/A
[Problem] Cpp file too long
[Cause] All CAPI tests in single file
[Solution] Certificate chains part moved to separate file

[Verification] Compile & run tests

Change-Id: Iada8d00c0356aab97defdf3ef60c0f6ebb9088cf

9 years agoCKM: Add error description in error message.
Bartlomiej Grzelewski [Fri, 16 Jan 2015 19:47:43 +0000 (20:47 +0100)]
CKM: Add error description in error message.

Change-Id: I9769865577579500bc774332dcc1fee12d828a00

9 years agoUpdate cc-mode tests with "Ready" setting
Krzysztof Jackiewicz [Tue, 20 Jan 2015 11:23:53 +0000 (12:23 +0100)]
Update cc-mode tests with "Ready" setting

[Issue#] N/A
[Feature/Bug] N/A
[Problem] "Ready" mode is not tested
[Cause] N/A
[Solution] Tests updated

[Verification] Run cc-mode tests

Change-Id: I16a86d9d10b5cef3ebbbd0880f981ef43b0ae6bc

9 years agoFixed dbus systemd interface
Krzysztof Jackiewicz [Thu, 15 Jan 2015 17:51:22 +0000 (18:51 +0100)]
Fixed dbus systemd interface

[Issue#] N/A
[Feature/Bug] N/A
[Problem] Services were not properly restarted. DBusAccess was waiting forever
for systemd job completion.
[Cause] Signal filter was set up too late
[Solution] Signal filter is set up before sending requests to systemd.

[Verification] Run CCMode tests.

Change-Id: I2e71a54ba44ddf0878a065e3b3bb8a7d117a6e3b

9 years agoAdd ocsp test for CAPI.
Bartlomiej Grzelewski [Fri, 16 Jan 2015 16:53:21 +0000 (17:53 +0100)]
Add ocsp test for CAPI.

Change-Id: I3e2b8f862f3129b21795e352366422364ce893fa

9 years agoRemove pointless code from capi tests.
Bartlomiej Grzelewski [Wed, 14 Jan 2015 16:21:08 +0000 (17:21 +0100)]
Remove pointless code from capi tests.

Change-Id: I7d5f5a03517da471c6aad5c03746f5c8a66ffb31

9 years agoAdd tests for storing PKCS12 files.
Maciej J. Karpiuk [Fri, 14 Nov 2014 15:08:52 +0000 (16:08 +0100)]
Add tests for storing PKCS12 files.

Change-Id: I444b07febf2dc78a3ac2a952f1cd29141716ecb9

9 years agoCAPI changes (set permission, remove alias): tests adjusted.
Maciej J. Karpiuk [Wed, 17 Dec 2014 14:31:39 +0000 (15:31 +0100)]
CAPI changes (set permission, remove alias): tests adjusted.

Change-Id: I1601606f9e4303d83b9840082c7093d9ac751b0a

9 years agoCAPI tests adjusted to new password logic
Krzysztof Jackiewicz [Mon, 15 Dec 2014 20:24:49 +0000 (21:24 +0100)]
CAPI tests adjusted to new password logic

[Issue#] N/A
[Feature/Bug] N/A
[Problem] N/A
[Cause] Password logic have changed
[Solution] Tests adjusted

[Verification] Run all CAPI tests

Change-Id: Ifb9a730b749eafa56d5107d13148935ef7353f60

9 years agoSecurity-server and CKM integration tests.
Bartlomiej Grzelewski [Fri, 9 Jan 2015 18:11:03 +0000 (19:11 +0100)]
Security-server and CKM integration tests.

Change-Id: I6ed1a68c2b7644c390d5ad05fe1512fc67e4dc80

9 years agoAdd test for using proper DKEK key to decrypt data.
Maciej J. Karpiuk [Mon, 8 Dec 2014 15:43:29 +0000 (16:43 +0100)]
Add test for using proper DKEK key to decrypt data.

Issue: another label is accessing data, while cached DKEK on data save
was already removed from the cache. This scenario was failing before
key-manager commit 4fe08778f9c31a698c6faace9b13fd6c5a4d9a7c.

Change-Id: I04c26c5ce5a86e83ab84ed78758984f7a0c2b5e4

9 years agoCKM table separation: tests adjusted to new C++ API.
Maciej J. Karpiuk [Thu, 13 Nov 2014 15:53:12 +0000 (16:53 +0100)]
CKM table separation: tests adjusted to new C++ API.

Change-Id: I74f742a75190fd66618cf0960836c3d7907059d4

9 years agoAdd tests for scenario trying to save/modify other label's data.
Maciej J. Karpiuk [Fri, 28 Nov 2014 16:15:29 +0000 (17:15 +0100)]
Add tests for scenario trying to save/modify other label's data.

Change-Id: I3940c7c88cb1e8bbd4f11cc04eaef1755b72a246

9 years agoAccess Control layer: tests adjusted to C++ API changes.
Maciej J. Karpiuk [Wed, 26 Nov 2014 14:39:52 +0000 (15:39 +0100)]
Access Control layer: tests adjusted to C++ API changes.

Change-Id: Ia3b045ab7a935d37186dee37de730ddea4d0ec1b

9 years agoTests use new CC variable scheme (Disabled means device disabled, not CC-mode disabled).
Maciej J. Karpiuk [Wed, 19 Nov 2014 09:57:59 +0000 (10:57 +0100)]
Tests use new CC variable scheme (Disabled means device disabled, not CC-mode disabled).

Minor logging change in CAPI tests (error code was not logged).

Change-Id: I2bedc75da254ee87977453aac736861162890baa

9 years agoCommonCriteria tests refactored and updated
Krzysztof Jackiewicz [Tue, 28 Oct 2014 17:02:04 +0000 (18:02 +0100)]
CommonCriteria tests refactored and updated

[Verification] Run ckm-tests --group=CKM_CC_MODE

Change-Id: Idb3e7a8d1e0df2913b3537d7cc4f109f12fffb0f

9 years agoStart&stop support added to DBusAccess
Krzysztof Jackiewicz [Thu, 30 Oct 2014 15:59:25 +0000 (16:59 +0100)]
Start&stop support added to DBusAccess

[Verification] Run security-server-tests-password --output=text
to make sure existing tests are not broken

Change-Id: Ib5b1353c5892fb3685ace4f8f6226ab842c07ec8

9 years agoAlias is not unique user-wide: modified test set.
Maciej J. Karpiuk [Wed, 22 Oct 2014 10:28:56 +0000 (12:28 +0200)]
Alias is not unique user-wide: modified test set.

Change-Id: I90577f4eaf02c24f5c7d390820c9de6817fc2142

9 years agoAdd service-side data verification test.
Maciej J. Karpiuk [Thu, 16 Oct 2014 13:25:04 +0000 (15:25 +0200)]
Add service-side data verification test.

Normally, data is validated on the client side.
New tests verify if data is verified on the service side.

Change-Id: Ia6f8ab71b8d03c0dea3140f4e2fb4bc175a26f9d

9 years agoMerge branch 'cynara' into tizen 77/34277/2
Marcin Niesluchowski [Thu, 22 Jan 2015 14:31:17 +0000 (15:31 +0100)]
Merge branch 'cynara' into tizen

Conflicts:
tests/common/dbus_access.cpp
tests/common/dbus_access.h
tests/cynara-tests/common/cynara_test_env.cpp
tests/framework/include/dpl/test/test_runner.h

Change-Id: I91f595f8a92ceafd071c4db0d70f7431447bab48

9 years agoRename file operation functions of cynara-tests 67/34267/2
Adam Malinowski [Thu, 22 Jan 2015 12:43:07 +0000 (13:43 +0100)]
Rename file operation functions of cynara-tests

Change-Id: Ie24d7360dacf9f236ed36eaaaafbba1913d6e8dd

9 years agoRefactor gdbbacktrace() function 51/33851/12
Marcin Niesluchowski [Thu, 15 Jan 2015 12:48:09 +0000 (13:48 +0100)]
Refactor gdbbacktrace() function

Add safer, less redundant code and make it part of DPL namespace

Change-Id: I19e4704f4600d9720e939b0d76aa143c5d82ec2f

9 years agoAdd timeout mechanism for time-limited function calls 01/33501/5
Lukasz Wojciechowski [Mon, 12 Jan 2015 10:16:34 +0000 (11:16 +0100)]
Add timeout mechanism for time-limited function calls

Timeout mechanism:
1) launches given function in new thread;
2) waits given time period;
3) cancels called function using custom user CancelFunction;
4) checks if function has finished in expected way;
5) returns function answer (value or exception).

Change-Id: Ia65d271095712e6afaaac96932f8d14d61b1702a

9 years agoAdd Agent class wrapping usage of libcynara-agent 87/33387/5
Lukasz Wojciechowski [Thu, 8 Jan 2015 10:24:27 +0000 (11:24 +0100)]
Add Agent class wrapping usage of libcynara-agent

With Agent object tests can play role of cynara agent and
communicate with cynara service. That can be useful for:
* testing libcynara-agent library;
* using agent in plugins testing;
* using agent in asynchronous client testing.

Change-Id: Idc783fa963074d5ff6f1dedb6a89b6aae6f65dbe

9 years agoAdd test-agent plugin 86/33386/5
Lukasz Wojciechowski [Fri, 9 Jan 2015 01:44:45 +0000 (02:44 +0100)]
Add test-agent plugin

This is a test plugin, that sends all requests to agent.
Security tests can play role of this agent, so they can decide
about time and value of a response.

Change-Id: I278229810a84cdb4a3ff01ad8ef714019507f0c1

9 years agoAdd agent data wrapping functions 85/33385/5
Lukasz Wojciechowski [Fri, 9 Jan 2015 01:41:17 +0000 (02:41 +0100)]
Add agent data wrapping functions

Add functions for easy joining and spliting data strings
used in communication between agent and plugins:
* wrapAgentData;
* unwrapAgentData.

This functions are defined in new file plugins.cpp - a common file
for both agent and plugins.

Change-Id: I29494928d752832aef7c8e14204a7e4ce63a911e

9 years agoAdd tests for cynara_admin_list_policies_descriptions 85/33085/8
Lukasz Wojciechowski [Mon, 5 Jan 2015 10:26:21 +0000 (11:26 +0100)]
Add tests for cynara_admin_list_policies_descriptions

Each of added tests uses the fact that every cynara test is wrapped in
CynaraTestEnv that saves cynara service plugins.
Every test clears cynara service plugins folder and restarts cynara.
Then proper combination of plugins (sometimes none) are loaded.
There are 4 tests added:
* tc30_admin_list_descriptions_no_plugins - no plugins are loaded,
 there are only default cynara policies;
* tc31_admin_list_descriptions_1_plugin_single_policy;
* tc32_admin_list_descriptions_1_plugin_multiple_policy;
* tc33_admin_list_descriptions_multiple_plugins.

Change-Id: Id778477c35a6d65a7d4f71df03dcccefcbb6e756

9 years agoAdd wrap for cynara_admin_list_policies_description 84/33084/8
Lukasz Wojciechowski [Mon, 5 Jan 2015 10:23:32 +0000 (11:23 +0100)]
Add wrap for cynara_admin_list_policies_description

Add method Admin::listDescriptions executing
cynara_admin_list_policies_description and checking if received result
match expected.

Change-Id: I1d729f83e2719360be5e4cdf405409561377c410

9 years agoAdd loadServicePlugins() for setting plugins env 27/33527/4
Lukasz Wojciechowski [Mon, 12 Jan 2015 16:55:23 +0000 (17:55 +0100)]
Add loadServicePlugins() for setting plugins env

Added function removes all cynara service plugins
and then import and load plugins from given directory.

Change-Id: I1fa559111c70c04e7522089a2bfed4ec9837f590

9 years agoEnhance CynaraTestEnv with operations on service plugins 83/33083/6
Lukasz Wojciechowski [Fri, 2 Jan 2015 19:18:13 +0000 (20:18 +0100)]
Enhance CynaraTestEnv with operations on service plugins

save() and restore() methods were enhanced with saving and restoring
cynara service plugins libraries.

Change-Id: If21707314d4a628db7c9d4034f1d4d7a9e82c55b

9 years agoIntroduce CynaraMask - a scoped cynara.service masker 26/33526/3
Lukasz Wojciechowski [Mon, 12 Jan 2015 16:13:17 +0000 (17:13 +0100)]
Introduce CynaraMask - a scoped cynara.service masker

Creation of CynaraMask object causes cynara.service to be masked and stopped.
Its removal causes cynara to be unmasked and run again.

Change-Id: Id7c20093fbd4ec19cdba783b20225ece04be5dfb

9 years agoSeparate file operations into separate file 25/33525/3
Lukasz Wojciechowski [Mon, 12 Jan 2015 15:34:56 +0000 (16:34 +0100)]
Separate file operations into separate file

All files operations done in cynara_test_env are moved to new namespace FileOperations
and implemented in cynara_test_file_operations.cpp file.
cynaraDbExists() function was generalized to dirExists(string) function.

Change-Id: Ic610078330074a648dbb24ddec7297a337a41de0

9 years agoAdd test cynara service plugins 57/33057/4
Lukasz Wojciechowski [Fri, 2 Jan 2015 17:09:17 +0000 (18:09 +0100)]
Add test cynara service plugins

There are two added plugins:
* single-policy plugin - declaring single policy type handling
* multiple-policy plugin - declaring multiple policy types handling

Plugins always return DENY policy type as result of check or update.
They are just test stubs for testing cynara_admin_list_policies_description.
Implementation of both plugins is embedded in BaseCynaraTestPlugin class.

Supported policies descriptions are put into plugins.h for later use in tests.

Change-Id: I38f4bcfe9624992eea3ef5a015885a397f5a0380

9 years agoRemove description param from test result collecting function 72/28772/8
Marcin Niesluchowski [Wed, 15 Oct 2014 15:44:38 +0000 (17:44 +0200)]
Remove description param from test result collecting function

Change-Id: I75f757abd6350456cbf572833b68a7a4aa8647e5

9 years agoFix uninitialized variable in Admin::listPolicies() 82/33082/1
Lukasz Wojciechowski [Fri, 2 Jan 2015 19:32:12 +0000 (20:32 +0100)]
Fix uninitialized variable in Admin::listPolicies()

struct cynara_admin_policy **policies was uninitialized.
Normally it should be filled with cynara_admin_list_policies() call.
However, when that function failes, it leaves policies unaffected.
If this pointer is not NULL then it is being freed after it is used
to construct vector of policies.

Change-Id: Iff469205035a5240eee64ec87ea724b83577d105

9 years agoAdd tests for cynara_admin_erase 49/33049/2
Lukasz Wojciechowski [Fri, 2 Jan 2015 14:28:42 +0000 (15:28 +0100)]
Add tests for cynara_admin_erase

All tests try erasing policies in different scenarios and then verify
if proper policies were removed from proper buckets, but listing what
is left and comparing to expected result.

There are 7 tests added:
* tc23_admin_erase_empty_bucket - erase policies from empty bucket;
* tc24_admin_erase_no_bucket - try to erase from not existing bucket;
* tc25_admin_erase_single_bucket - check all posibilities of matching
 policies during erase;
* tc26_admin_erase_recursive_not_linked_buckets - erase with recursive
 flag set to TRUE, but in case where no policy lead to subbucket;
* tc27_admin_erase_recursive_linked_buckets - erase with recursive flag
 set to TRUE with existance of policy leading to subbucket;
* tc28_admin_erase_non_recursive_linked_buckets - erase with recursive
 flag set to FALSE with existance of policy leading to subbucket;
* tc29_admin_erase_recursive_from_sub_bucket - start erase test in
 subbucket and check if parent bucket stays unaffected by erase.

Change-Id: Ib712a028d97773e70b98de85c51aff0238bb8586

9 years agoAdd wrap for cynara_admin_list_erase in Admin class 48/33048/2
Lukasz Wojciechowski [Fri, 2 Jan 2015 13:02:16 +0000 (14:02 +0100)]
Add wrap for cynara_admin_list_erase in Admin class

Add method erasePolicies executing cynara_admin_erase
and checking if received result match expected.

Change-Id: I21f9dfa542fe931e56b4e09ec00712ab539d48ef

9 years agoAdd tests for cynara_admin_list_policies 32/33032/3
Lukasz Wojciechowski [Wed, 31 Dec 2014 15:03:57 +0000 (16:03 +0100)]
Add tests for cynara_admin_list_policies

There are 3 tests:
* tc20_admin_list_empty_bucket - test listing policies from empty bucket
* tc21_admin_list_no_bucket - test listing policies from non-existing bucket
* tc22_admin_list_bucket - test listing policies from fully filled bucket

Change-Id: I814ceacf367d63b73b746689ab28e115bf38adfa

9 years agoAdd wrap for cynara_admin_list_policies in Admin class 31/33031/3
Lukasz Wojciechowski [Wed, 31 Dec 2014 13:54:55 +0000 (14:54 +0100)]
Add wrap for cynara_admin_list_policies in Admin class

Add method listPolicies executing cynara_admin_list_policies
and checking if received result match expected.

Enhance CynaraPoliciesContainer class by:
* removing copy and move constructors;
* adding sort method;
* adding operator<<.

Change-Id: Icff4a6aa0e27efa191b7eb9e9c2be79c21066cbf

9 years agoUse connection and message classes in service manager 09/32509/4
Marcin Niesluchowski [Thu, 18 Dec 2014 12:35:17 +0000 (13:35 +0100)]
Use connection and message classes in service manager

Change-Id: I4aef532bd3c447af8cd3164be2e77b08be71b01f

9 years agoChange DBusAccess class name to ServiceManager 08/32508/3
Marcin Niesluchowski [Thu, 18 Dec 2014 12:07:15 +0000 (13:07 +0100)]
Change DBusAccess class name to ServiceManager

Change-Id: I38483087929620e12bcd2b68146b36de7a266d9c

9 years agoRemove Bumjin Im as contact of dbus access class 08/32408/4
Marcin Niesluchowski [Wed, 17 Dec 2014 17:33:35 +0000 (18:33 +0100)]
Remove Bumjin Im as contact of dbus access class

Change-Id: Id894dce5e48b50114bd118d5b21b6099093fc590

9 years agoAdd dbus connection wrapper class 07/32207/5
Marcin Niesluchowski [Tue, 16 Dec 2014 15:40:06 +0000 (16:40 +0100)]
Add dbus connection wrapper class

Change-Id: I494354b5d0c262abd90b3c20d36b3db5f1efef93

9 years agoAdd dbus incoming message wrapper class 07/32407/4
Marcin Niesluchowski [Wed, 17 Dec 2014 10:42:55 +0000 (11:42 +0100)]
Add dbus incoming message wrapper class

Change-Id: I1f476b1c44605458e1168c60bf3c4e6b04462be5

9 years agoAdd dbus outgoing message wrapper class 06/32406/4
Marcin Niesluchowski [Wed, 17 Dec 2014 16:31:47 +0000 (17:31 +0100)]
Add dbus outgoing message wrapper class

Change-Id: I44199708452dd5c95b4e777f51890066199b7b1c

9 years agoAdjust Summary collector to test framework logic 65/28765/11
Marcin Niesluchowski [Wed, 15 Oct 2014 11:14:45 +0000 (13:14 +0200)]
Adjust Summary collector to test framework logic

Change-Id: Ia48421e8036bafe56cc8f2bffad7c7d70f4a3efe

9 years agoMerge branch 'tizen' into ckm 13/32113/1
Marcin Niesluchowski [Mon, 15 Dec 2014 15:52:20 +0000 (16:52 +0100)]
Merge branch 'tizen' into ckm

Change-Id: I534565bfd910dca35be33ca57c4467ca634bf716

9 years agoMerge branch 'tizen' into cynara 11/32111/1
Marcin Niesluchowski [Mon, 15 Dec 2014 15:46:43 +0000 (16:46 +0100)]
Merge branch 'tizen' into cynara

Change-Id: I7823ffc2dbd0955045402a32827db459c3083c97

9 years agoAdd tests for database cleanup mechanism 16/30716/11
Pawel Wieczorek [Mon, 24 Nov 2014 11:50:49 +0000 (12:50 +0100)]
Add tests for database cleanup mechanism

This patch adds remaining tests for database integrity mechanism, e.g.
removal of non-indexed files, removal of invalid backup files.

Change-Id: Ib6e373dba3ef24c5e69b058df2b8dd9403616eec

9 years agoAdd tests for database integrity mechanism 15/30715/11
Pawel Wieczorek [Mon, 17 Nov 2014 13:45:30 +0000 (14:45 +0100)]
Add tests for database integrity mechanism

Change-Id: I36771d8ef627b121e27df68bd7dbc7f56aa6fd10

9 years agoAdd compareDbs() function with database patterns 14/30714/11
Pawel Wieczorek [Mon, 1 Dec 2014 13:14:41 +0000 (14:14 +0100)]
Add compareDbs() function with database patterns

Added function can be used to compare expected with actual contents of
Cynara's database. Patterns are taken from test patterns directory.
Available patterns:
* minimal contents with default DENY policy
* minimal contents with default ALLOW policy
* database with sample DENY policy

Change-Id: I510ba58e1ce12ecc388fd560e71a0f67929db757

9 years agoDrop unneeded dependency against dbus-glib-1 83/31283/3
Rafal Krypa [Mon, 8 Dec 2014 12:00:11 +0000 (13:00 +0100)]
Drop unneeded dependency against dbus-glib-1

Change-Id: Id27aa959d0456c873ad3b5178b0f8b77a6d22a47

9 years agoCheck if cynara terminates, when no data are sent 40/30740/3
Lukasz Wojciechowski [Mon, 24 Nov 2014 11:37:10 +0000 (12:37 +0100)]
Check if cynara terminates, when no data are sent

Test case tca12 covers bug found in cynara. Cynara terminates,
when connection is closed and no data were sent.

Change-Id: I0859cc9db1b252cb5d8ea786183d80334de8725a

9 years agoEnhance DBusAccess with getServiceStartTimestamp() 70/31570/2
Lukasz Wojciechowski [Sat, 6 Dec 2014 03:55:51 +0000 (04:55 +0100)]
Enhance DBusAccess with getServiceStartTimestamp()

Newly added method returns timestamp of the last service start
measured as number of seconds and microseconds since epoch
and returned in struct timeval.

Change-Id: I4215cc8b727cb78bd03462d25b419a1589b6db0f

9 years agoAdd double request tests 93/29793/11
Lukasz Wojciechowski [Mon, 3 Nov 2014 11:33:06 +0000 (12:33 +0100)]
Add double request tests

These tests send sequentially two requests.
In second test connection with service is broken after
response to first request is received.

Change-Id: Idc319ad58d5755ec8833f899723f1de3800cbfea

9 years agoProvide CynaraTestClient namespace for sync client 04/29504/14
Lukasz Wojciechowski [Tue, 28 Oct 2014 09:47:56 +0000 (10:47 +0100)]
Provide CynaraTestClient namespace for sync client

CynaraTestClient is dedicated to contain all classes related
to synchronous client cynara interface wrap in cynara-tests.
CynaraTestClient class was renamed to simpler name Client.

Change-Id: I99808b0f3c17f9272deb6dfee1ed4ab6449abbb3

9 years agoProvide CynaraTestAdmin namespace for admin classes 03/29503/14
Lukasz Wojciechowski [Tue, 28 Oct 2014 08:05:31 +0000 (09:05 +0100)]
Provide CynaraTestAdmin namespace for admin classes

CynaraTestAdmin contains all classes related to administrative
cynara interface wrap in cynara-tests.
CynaraTestAdmin class was renamed to simpler name Admin.

Change-Id: Ic48a432346deaee5d55ff87640d9fb85a18457d2

9 years agoAdd tests forcing disconnection by reseting cynara 02/29502/14
Lukasz Wojciechowski [Mon, 27 Oct 2014 08:11:45 +0000 (09:11 +0100)]
Add tests forcing disconnection by reseting cynara

Test 08 disconnects cynara during normal request-response scenario.
Three subtestcases of 08 test differ only by resetting cynara
daemon in different moments of sending request scenario.

Test 09 disconnects cynara during request-cancel scenario
Subtestcases differ by different moments of cynara reset.

Change-Id: Ia3e9db87b7e3534c2e4b7e770b4d9a5739553ef4

9 years agoTest async check before and after data insertion 57/29357/15
Lukasz Wojciechowski [Fri, 24 Oct 2014 17:24:34 +0000 (19:24 +0200)]
Test async check before and after data insertion

This test:
* checks access in cynara with empty database;
* verifies that after response is received cache holds result;
* sets new policy (that should cause client disconnection);
* verifies that cache was cleared after disconnection;
* runs async checks on filled database.

Change-Id: If5ab19d51f83faaa802e02dae1e7526e6a9d5c61

9 years agoExpand CheckData and PoliciesContainer for easier use 56/29356/15
Lukasz Wojciechowski [Fri, 24 Oct 2014 17:17:24 +0000 (19:17 +0200)]
Expand CheckData and PoliciesContainer for easier use

New CynaraPoliciesContainer::add allows adding policies with {client,
user, privilege} tripple passed as single vector parameter.
CheckData class is expanded with toAdminPolicy() method for converting
ChackData object into such vector.

Change-Id: I3cc34fc7801a81e6a9f4a456013653b1ef0d3323

9 years agoAdd simple request cancellation tests 52/29352/15
Lukasz Wojciechowski [Fri, 24 Oct 2014 16:08:42 +0000 (18:08 +0200)]
Add simple request cancellation tests

tca05_request_and_cancel* - check cancellation of sent requests
tca06_cancel_fail - checks cancellation of not existing request

Change-Id: I495846f8494dc4ef6e329774039869e10b1b9731

9 years agoAdd user defined callback to StatusMonitor 39/30739/2
Lukasz Wojciechowski [Mon, 24 Nov 2014 16:58:29 +0000 (17:58 +0100)]
Add user defined callback to StatusMonitor

User can pass now own function, that will be executed when status changes.

Change-Id: Ic3f514f18c780aff51cf62114fc3cf98dac70067

9 years agoWrap cynara_async_cancel_request() for test purposes 51/29351/14
Lukasz Wojciechowski [Fri, 24 Oct 2014 16:07:08 +0000 (18:07 +0200)]
Wrap cynara_async_cancel_request() for test purposes

Change-Id: Iaf049aa35dac3bb7acd2874d675b49ad6676f5ea

9 years agoAdd test for sending and processing single request 18/29018/16
Lukasz Wojciechowski [Mon, 20 Oct 2014 09:19:45 +0000 (11:19 +0200)]
Add test for sending and processing single request

Change-Id: I90140763f8a18a03faa1fb4d5661a369f3cc15d4

9 years agoWrap cynara_async_process() for test purposes 17/29017/16
Lukasz Wojciechowski [Mon, 20 Oct 2014 09:14:18 +0000 (11:14 +0200)]
Wrap cynara_async_process() for test purposes

Wrap checks connections status, then waits on proper select statement.
After select returns, cynara_async_process() is called and expected
result is checked.

Change-Id: Icc286662b5ba7e0f4f9b51d0dd58e7ab1d17336a

9 years agoCollect test fail reasons in case of nested assertions 92/29792/9
Lukasz Wojciechowski [Tue, 4 Nov 2014 10:36:07 +0000 (11:36 +0100)]
Collect test fail reasons in case of nested assertions

RUNNER_ASSERT_MSG macro (and related) throw DPL::Test::TestRunner::TestFailed
exception. If such an exception is thrown during clean-up caused by another
exception and test interruption, termination of tests program happen leaving
no clues about termination cause.

This patch checks if an exception has been thrown earlier and if so,
it doesn't throw next exception but passes exception message to TestRunner.
All such messages passed with addFailReason() method are gathered inside
TestRunner and used during ResultCollection after finishing test and passing
results to collectors.

This patch introduces simple concatrenation method of joining all fail
reasons into single string, that is passed to Collectors.
When collectors API will be ready to receive multiple reasons of single test
failure, another patch can simply pass whole fail results queue.

Change-Id: I1bf582da6526a4187e7c4a53afaeea976cf4bda1

9 years agoFix potential segfaults if assert won't throw 79/30279/5
Lukasz Wojciechowski [Thu, 13 Nov 2014 14:02:23 +0000 (15:02 +0100)]
Fix potential segfaults if assert won't throw

Prepare code for assertions that won't throw an exception even if
condition check fails. Such situation can happen, when when exception
would have been thrown during stack unwinding after another exception.

Change-Id: Icb44b0e5e51bcb9b7f23fcc270d2e60eab4ecc1e

9 years agoMake StatusMonitor::getStatus() always return value 91/29791/4
Lukasz Wojciechowski [Tue, 4 Nov 2014 10:31:33 +0000 (11:31 +0100)]
Make StatusMonitor::getStatus() always return value

Bug fix. Not all paths returned a value. RUNNER_FAIL_MSG may avoid
throwing e.g. when not in test.

Change-Id: Ief39fcc83ab3828f2e7d71682927e30140c1e191

9 years agoMove string consts to corresponding test commons 10/31110/3
Pawel Wieczorek [Mon, 17 Nov 2014 13:07:20 +0000 (14:07 +0100)]
Move string consts to corresponding test commons

New member has been added:
* SERVICE (in CynaraTestConsts, for D-Bus)

Change-Id: I6963cbbf9b57380447b764ae0f3b09ec2795ff9f

9 years agoMove Summary collector to test framework 96/28696/12
Marcin Niesluchowski [Mon, 13 Oct 2014 16:39:53 +0000 (18:39 +0200)]
Move Summary collector to test framework

Change-Id: Ief5a3b837382651bd030642c262d3c69c408a4bb

9 years agoChange FailStatus from struct to enum class 95/28695/9
Marcin Niesluchowski [Mon, 13 Oct 2014 15:02:17 +0000 (17:02 +0200)]
Change FailStatus from struct to enum class

Change-Id: I9df26486b0b009e5f97b99358d0112556d87a700

9 years agoRemove INTERNAL type from FailStatus enum 94/28694/8
Marcin Niesluchowski [Mon, 13 Oct 2014 14:21:47 +0000 (16:21 +0200)]
Remove INTERNAL type from FailStatus enum

INTERNAL fail status is treated as FAILED fail status. It is collected
in case of:
* DPL::Exception - should not be thrown by test cased body, as it is used
  in test framework only
* std::exception - which implies that test case is not constructed well
  or there is not enough resources, which may be also passed as Failed
  state in RUNNER_* macros.
* other exceptions - same as std::exception

Change-Id: I8776622afcb9d01739f8780183ad4c5f364deb25

9 years agoComment out all tests that were fixed in next version of CKM. 17/31017/3
Bartlomiej Grzelewski [Fri, 28 Nov 2014 14:48:15 +0000 (15:48 +0100)]
Comment out all tests that were fixed in next version of CKM.

Change-Id: I638c51225da2ed8d7026fb133d503fdc671f35b5

9 years agoCreate cynara_db_tests group 09/31109/2
Pawel Wieczorek [Mon, 1 Dec 2014 12:19:55 +0000 (13:19 +0100)]
Create cynara_db_tests group

Create an empty test group for database integrity tests.

Change-Id: I065ea1c0d6ee7318f8e3a2be878867695a5ebfc7

9 years agoMove files_compare() function to test commons 13/30713/3
Pawel Wieczorek [Mon, 8 Sep 2014 14:23:58 +0000 (16:23 +0200)]
Move files_compare() function to test commons

Function files_compare() from tests for libsmack can be used in other
tests as well. It is now accessible outside libsmack tests.

Change-Id: Ic56b4aff4c4170e24b5cfb2754e2ef4aed4cf541