#include <ndb_global.h>#include "Properties.hpp"#include <NdbOut.hpp>#include "uucode.h"Include dependency graph for testProperties.cpp:

Go to the source code of this file.
Functions | |
| bool | writeToFile (const Properties &p, const char *fname, bool uu=true) |
| bool | readFromFile (Properties &p, const char *fname, bool uu=true) |
| void | putALot (Properties &tmp) |
| int | main (void) |
| int main | ( | void | ) |
Definition at line 111 of file testProperties.cpp.
References p, Properties::print(), Properties::put(), Properties::put64(), putALot(), readFromFile(), and writeToFile().
00111 { 00112 Properties p; 00113 00114 p.put("Kalle", 1); 00115 p.put("Ank1", "anka"); 00116 p.put("Ank2", "anka"); 00117 p.put("Ank3", "anka"); 00118 p.put("Ank4", "anka"); 00119 putALot(p); 00120 00121 Properties tmp; 00122 tmp.put("Type", "TCP"); 00123 tmp.put("OwnNodeId", 1); 00124 tmp.put("RemoteNodeId", 2); 00125 tmp.put("OwnHostName", "local"); 00126 tmp.put("RemoteHostName", "remote"); 00127 00128 tmp.put("SendSignalId", 1); 00129 tmp.put("Compression", (Uint32)false); 00130 tmp.put("Checksum", 1); 00131 00132 tmp.put64("SendBufferSize", 2000); 00133 tmp.put64("MaxReceiveSize", 1000); 00134 00135 tmp.put("PortNumber", 1233); 00136 putALot(tmp); 00137 00138 p.put("Connection", 1, &tmp); 00139 00140 p.put("NoOfConnections", 2); 00141 p.put("NoOfConnection2", 2); 00142 00143 p.put("kalle", 3); 00144 p.put("anka", "kalle"); 00145 00146 Properties p2; 00147 p2.put("kalle", "anka"); 00148 00149 p.put("prop", &p2); 00150 00151 p.put("Connection", 2, &tmp); 00152 00153 p.put("Connection", 3, &tmp); 00154 00155 p.put("Connection", 4, &tmp); 00156 /* 00157 */ 00158 00159 Uint32 a = 99; 00160 const char * b; 00161 const Properties * p3; 00162 Properties * p4; 00163 00164 bool bb = p.get("kalle", &a); 00165 bool cc = p.get("anka", &b); 00166 bool dd = p.get("prop", &p3); 00167 if(p.getCopy("prop", &p4)) 00168 delete p4; 00169 00170 p2.put("p2", &p2); 00171 00172 p.put("prop2", &p2); 00173 /* */ 00174 00175 p.print(stdout, "testing 1: "); 00176 00177 writeToFile(p, "A_1"); 00178 writeToFile(p, "B_1", false); 00179 00180 Properties r1; 00181 readFromFile(r1, "A_1"); 00182 writeToFile(r1, "A_3"); 00183 00184 //r1.print(stdout, "testing 2: "); 00185 Properties r2; 00186 readFromFile(r2, "A_1"); 00187 writeToFile(r2, "A_4"); 00188 00189 Properties r3; 00190 readFromFile(r3, "B_1", false); 00191 writeToFile(r3, "A_5"); 00192 r3.print(stdout, "testing 3: "); 00193 00194 return 0; 00195 }
Here is the call graph for this function:

| void putALot | ( | Properties & | tmp | ) |
Definition at line 66 of file testProperties.cpp.
References Properties::put().
Referenced by main().
00066 { 00067 int i = 123; 00068 tmp.put("LockPagesInMainMemory", i++); 00069 tmp.put("SleepWhenIdle", i++); 00070 tmp.put("NoOfSignalsToExecuteBetweenCommunicationInterfacePoll", i++); 00071 tmp.put("TimeBetweenWatchDogCheck", i++); 00072 tmp.put("StopOnError", i++); 00073 00074 tmp.put("MaxNoOfConcurrentOperations", i++); 00075 tmp.put("MaxNoOfConcurrentTransactions", i++); 00076 tmp.put("MemorySpaceIndexes", i++); 00077 tmp.put("MemorySpaceTuples", i++); 00078 tmp.put("MemoryDiskPages", i++); 00079 tmp.put("NoOfFreeDiskClusters", i++); 00080 tmp.put("NoOfDiskClusters", i++); 00081 00082 tmp.put("TimeToWaitAlive", i++); 00083 tmp.put("HeartbeatIntervalDbDb", i++); 00084 tmp.put("HeartbeatIntervalDbApi", i++); 00085 tmp.put("TimeBetweenInactiveTransactionAbortCheck", i++); 00086 00087 tmp.put("TimeBetweenLocalCheckpoints", i++); 00088 tmp.put("TimeBetweenGlobalCheckpoints", i++); 00089 tmp.put("NoOfFragmentLogFiles", i++); 00090 tmp.put("NoOfConcurrentCheckpointsDuringRestart", i++); 00091 tmp.put("TransactionInactiveTimeBeforeAbort", i++); 00092 tmp.put("NoOfConcurrentProcessesHandleTakeover", i++); 00093 00094 tmp.put("NoOfConcurrentCheckpointsAfterRestart", i++); 00095 00096 tmp.put("NoOfDiskPagesToDiskDuringRestartTUP", i++); 00097 tmp.put("NoOfDiskPagesToDiskAfterRestartTUP", i++); 00098 tmp.put("NoOfDiskPagesToDiskDuringRestartACC", i++); 00099 tmp.put("NoOfDiskPagesToDiskAfterRestartACC", i++); 00100 00101 tmp.put("NoOfDiskClustersPerDiskFile", i++); 00102 tmp.put("NoOfDiskFiles", i++); 00103 00104 // Always found 00105 tmp.put("NoOfReplicas", 33); 00106 tmp.put("MaxNoOfAttributes", 34); 00107 tmp.put("MaxNoOfTables", 35); 00108 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool readFromFile | ( | Properties & | p, | |
| const char * | fname, | |||
| bool | uu = true | |||
| ) |
Definition at line 47 of file testProperties.cpp.
References buffer, f, free, malloc, ndbout(), p, and uudecode().
Referenced by main(), and NDB_COMMAND().
00047 { 00048 Uint32 sz = 30000; 00049 char * buffer = (char*)malloc(sz); 00050 FILE * f = fopen(fname, "rb"); 00051 if(uu) 00052 uudecode(f, buffer, sz); 00053 else 00054 fread(buffer, 1, sz, f); 00055 fclose(f); 00056 bool res = p.unpack((Uint32*)buffer, sz); 00057 if(res != true){ 00058 ndbout << "Error unpacking" << endl; 00059 ndbout << "p.getPropertiesErrno() = " << p.getPropertiesErrno() << endl; 00060 ndbout << "p.getOSErrno() = " << p.getOSErrno() << endl; 00061 } 00062 free(buffer); 00063 return res; 00064 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool writeToFile | ( | const Properties & | p, | |
| const char * | fname, | |||
| bool | uu = true | |||
| ) |
Definition at line 24 of file testProperties.cpp.
References buffer, f, free, malloc, ndbout(), p, and uuencode().
Referenced by main().
00024 { 00025 Uint32 sz = p.getPackedSize(); 00026 char * buffer = (char*)malloc(sz); 00027 00028 FILE * f = fopen(fname, "wb"); 00029 bool res = p.pack((Uint32*)buffer); 00030 if(res != true){ 00031 ndbout << "Error packing" << endl; 00032 ndbout << "p.getPropertiesErrno() = " << p.getPropertiesErrno() << endl; 00033 ndbout << "p.getOSErrno() = " << p.getOSErrno() << endl; 00034 } 00035 if(uu) 00036 uuencode(buffer, sz, f); 00037 else { 00038 fwrite(buffer, 1, sz, f); 00039 } 00040 00041 fclose(f); 00042 free(buffer); 00043 return res; 00044 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

