LONGBOW_TEST_CASE(Global, tlvCodec_ConnectionConfig) { TestData *data = longBowTestCase_GetClipBoardData(testCase); testRtaConfiguration_ConnectionJsonKey(tlvCodec_ConnectionConfig(data->connConfig), tlvCodec_GetName()); PARCJSON *json = ccnxConnectionConfig_GetJson(data->connConfig); assertNotNull(json, "Expected a non-NULL connectionConfig."); }
static TestData * _commonSetup(void) { TestData *data = parcMemory_AllocateAndClear(sizeof(TestData)); assertNotNull(data, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(TestData)); int error = socketpair(AF_UNIX, SOCK_STREAM, 0, data->api_fds); assertFalse(error, "Error creating socket pair: (%d) %s", errno, strerror(errno)); data->commandRingBuffer = parcRingBuffer1x1_Create(128, NULL); data->commandNotifier = parcNotifier_Create(); data->framework = rtaFramework_Create(data->commandRingBuffer, data->commandNotifier); assertNotNull(data->framework, "rtaFramework_Create returned null"); CCNxStackConfig *stackConfig = ccnxStackConfig_Create(); apiConnector_ProtocolStackConfig(stackConfig); testingLower_ProtocolStackConfig(stackConfig); protocolStack_ComponentsConfigArgs(stackConfig, apiConnector_GetName(), testingLower_GetName(), NULL); rtaFramework_NonThreadedStepCount(data->framework, 10); int stackId = 1; RtaCommandCreateProtocolStack *createStack = rtaCommandCreateProtocolStack_Create(stackId, stackConfig); _rtaFramework_ExecuteCreateStack(data->framework, createStack); rtaCommandCreateProtocolStack_Release(&createStack); rtaFramework_NonThreadedStepCount(data->framework, 10); data->stack = (rtaFramework_GetProtocolStackByStackId(data->framework, stackId))->stack; CCNxConnectionConfig *connConfig = ccnxConnectionConfig_Create(); apiConnector_ConnectionConfig(connConfig); tlvCodec_ConnectionConfig(connConfig); testingLower_ConnectionConfig(connConfig); RtaCommandOpenConnection *openConnection = rtaCommandOpenConnection_Create(stackId, data->api_fds[PAIR_OTHER], data->api_fds[PAIR_TRANSPORT], ccnxConnectionConfig_GetJson(connConfig)); rtaFramework_NonThreadedStepCount(data->framework, 10); _rtaFramework_ExecuteOpenConnection(data->framework, openConnection); rtaCommandOpenConnection_Release(&openConnection); rtaFramework_NonThreadedStepCount(data->framework, 10); data->connection = rtaConnectionTable_GetByApiFd(data->framework->connectionTable, data->api_fds[PAIR_OTHER]); ccnxConnectionConfig_Destroy(&connConfig); ccnxStackConfig_Release(&stackConfig); return data; }