Commit an overly-large chunk of work.
[gssweb.git] / json_gssapi / test / NameCacheTest.cpp
1 /*
2  * Copyright (c) 2014 <copyright holder> <email>
3  *
4  * For license details, see the LICENSE file in the root of this project.
5  *
6  */
7
8 #include <string>
9 #include <iostream>
10
11 #include "NameCacheTest.h"
12 #include "cache/GSSNameCache.h"
13 #include "datamodel/GSSName.h"
14 #include <GSSImportName.h>
15
16 CPPUNIT_TEST_SUITE_REGISTRATION( NameCacheTest );
17
18 void NameCacheTest::setUp()
19 {
20
21 }
22
23 void NameCacheTest::tearDown()
24 {
25
26 }
27
28 void NameCacheTest::testStore()
29 {
30   /* Variables      */
31   std::string  key;
32   GSSName      source( (gss_name_t)rand(), true), target;
33   
34   /* Error checking */
35   /* Setup          */
36
37   
38   /* Main           */
39   
40   // Store the data
41   key = GSSNameCache::instance()->store(source);
42   
43   // verify that the data can be retrieved.
44   target = GSSNameCache::instance()->retrieve(key);
45   
46   CPPUNIT_ASSERT_EQUAL_MESSAGE(
47     "The name cache did not store and retrieve the same data",
48     source.toGss(),
49     target.toGss()
50   );
51
52   /* Cleanup        */
53   /* Return         */
54   
55 }
56
57
58
59   /* Variables      */
60   /* Error checking */
61   /* Setup          */
62   /* Main           */
63   /* Cleanup        */
64   /* Return         */