test_policy_cache.c revision 8a4b0b791bf38ef8389a6501a586d8ab554e3711
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * The contents of this file are subject to the terms of the Common Development and
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * Distribution License (the License). You may not use this file except in compliance with the
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * specific language governing permission and limitations under the License.
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * When distributing Covered Software, include this CDDL Header Notice in each file and include
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * Header, with the fields enclosed by brackets [] replaced by your own identifying
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * information: "Portions copyright [year] [name of copyright owner]".
39c4970fb513131af091c2d6404e41437c45fc82Matt Sweeney * Copyright 2014 - 2015 ForgeRock AS.
#include "am.h"
#include "utility.h"
#include "list.h"
#include "thread.h"
#include "cmocka.h"
void am_worker_pool_init_reset();
void am_net_init_ssl_reset();
" <ResourceResult name='http://vb2.local.com:80/testwebsite'>"
" <Attribute name='Attributes,key:0,0'/> <Value>Attributes,value:0,0,0</Value> <Value>Attributes,value:0,0,1</Value>"
" <ActionDecision timeToLive='1234'> <!-- these can have no value elements, which defaults to ? -->"
char* policy_for_url =
return NULL;
return result;
assert_int_equal(sscanf(nvp->v, value_format, &value_policy_seq, &value_attr_seq, &value_value_seq), 3);
int count = 0;
count++;
return count;
assert_non_null(r);
/***************************************************************************************************/
for (i = 0; i < count; i++) {
static void test_cache_with_seed(int seed, int test_size, am_request_t * request, struct am_policy_result * result)
for(i = 0; i < test_size; i++) {
for(i = 0; i < test_size; i++) {
for(i = 0; i < test_size; i++) {
static void test_cache_keys(int test_size, char** keys, am_request_t* request, struct am_policy_result* result)
for(i = 0; i < test_size; i++) {
for(i = 0; i < test_size; i++) {
for(i = 0; i < test_size; i++) {
assert_int_equal(am_get_session_policy_cache_entry(request, keys [i], &r, &session, &ets), AM_SUCCESS);
char* urls[] = {
assert_int_equal(am_add_session_policy_cache_entry(&request, fake_session, policy_result, NULL), AM_SUCCESS);
struct test_cache_params {
int test_size;
char** keys;
int iterations;
for (i = 0; i < p->iterations; i++) {
void test_policy_cache_multithread() {
double dt;
for (i = 0; i < TEST_SIZE; i++) {
for (i = 0; i < NTHREADS; i++) {
for (i = 0; i < NTHREADS; i++) {
for (i = 0; i < TEST_SIZE; i++) {
* This is an internal test of the mechanism for replaying a given number of randomly generated strings
for(i = 0; i < TEST_SIZE_1; i++) {
for(i = 0; i < TEST_SIZE_1; i++) {