Beispiel #1
0
bool
bitmap_Contains(Bitmap *bitmap, Bitmap *other)
{
    if (bitmap->bitSize != other->bitSize) {
        assertFalse(true, "Fatal error. Bitmaps were not the same size.");
    }
    for (int i = 0; i < bitmap->bitSize; i++) {
        if (!bitmap_Get(bitmap, i) && bitmap_Get(other, i)) {
            return false;
        }
    }
    return true;
}
Beispiel #2
0
bool
bitmap_Equals(Bitmap *bitmap, Bitmap *other)
{
    if (bitmap->bitSize != other->bitSize) {
        assertFalse(true, "Fatal error. Bitmaps were not the same size: %d and %d", bitmap->bitSize, other->bitSize);
    }
    for (int i = 0; i < bitmap->bitSize; i++) {
        if (bitmap_Get(bitmap, i) != bitmap_Get(other, i)) {
            return false;
        }
    }
    return true;
}
Beispiel #3
0
LONGBOW_TEST_CASE(Global, metisMessage_HasHopLimit_False)
{
    PARCLogReporter *reporter = parcLogReporterTextStdout_Create();
    MetisLogger *logger = metisLogger_Create(reporter, parcClock_Wallclock());
    parcLogReporter_Release(&reporter);
    MetisMessage *message = metisMessage_CreateFromArray(metisTestDataV0_EncodedInterest_no_hoplimit, sizeof(metisTestDataV0_EncodedInterest_no_hoplimit), 1, 2, logger);
    metisLogger_Release(&logger);

    bool hasHopLimit = metisMessage_HasHopLimit(message);
    assertFalse(hasHopLimit, "Message without a hop limit says it does.");

    metisMessage_Release(&message);
}
void testJSONValidator__isValidRoot::testNotRoots(void){
	#ifdef JSON_VALIDATE
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{]")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[}")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{}aoe")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[]aoe")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("aoe")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff\":{},]")));
	#endif
}
Beispiel #5
0
LONGBOW_TEST_CASE(Global, metisMessage_KeyIdEquals_DifferentValue)
{
    PARCLogReporter *reporter = parcLogReporterTextStdout_Create();
    MetisLogger *logger = metisLogger_Create(reporter, parcClock_Wallclock());
    parcLogReporter_Release(&reporter);
    MetisMessage *a = metisMessage_CreateFromArray(metisTestDataV0_EncodedObject, sizeof(metisTestDataV0_EncodedObject), 1, 2, logger);
    MetisMessage *b = metisMessage_CreateFromArray(metisTestDataV0_SecondInterest, sizeof(metisTestDataV0_SecondInterest), 1, 2, logger);
    metisLogger_Release(&logger);

    assertFalse(metisMessage_KeyIdEquals(a, b), "Messages with differnt keyids did compared equal");
    metisMessage_Release(&a);
    metisMessage_Release(&b);
}
Beispiel #6
0
LONGBOW_TEST_CASE(Global, parcBitVector_Equals)
{
    PARCBitVector *parcBitVector = parcBitVector_Create();
    assertTrue(parcBitVector, "parcBitVector_Create returned a NULL pointer");

    parcBitVector_Set(parcBitVector, 10);
    PARCBitVector *copy = parcBitVector_Copy(parcBitVector);
    assertTrue(parcBitVector_Equals(parcBitVector, copy), "Duplicate vector found unequal");

    parcBitVector_Set(copy, 9);
    assertFalse(parcBitVector_Equals(parcBitVector, copy), "Unequal vector found equal");

    parcBitVector_Clear(copy, 9);
    parcBitVector_Set(copy, 29);
    assertFalse(parcBitVector_Equals(parcBitVector, copy), "Unequal long vector found equal");

    parcBitVector_Clear(copy, 29);
    assertTrue(parcBitVector_Equals(parcBitVector, copy), "Equal long vector found unequal");
    assertTrue(parcBitVector_Equals(copy, parcBitVector), "Equal long vector found unequal");

    parcBitVector_Release(&copy);
    parcBitVector_Release(&parcBitVector);
}
Beispiel #7
0
LONGBOW_TEST_CASE(Global, parcCryptoHash_CreateFromArray)
{
    int fd = open("test_digest_bytes_128.sha256", O_RDONLY);
    assertFalse(fd < 0, "Could not open %s: %s", "test_digest_bytes_128.sha256", strerror(errno));

    uint8_t scratch[bufferLength];
    ssize_t read_length = read(fd, scratch, bufferLength);

    PARCCryptoHash *hash = parcCryptoHash_CreateFromArray(PARC_HASH_SHA256, scratch, read_length);
    assertNotNull(hash, "Expected to be non null");

    parcCryptoHash_Release(&hash);
    close(fd);
}
A_Test void FileSuffixTest_hasAsmFileSuffix(void)
{
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.c"));
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.i"));
    assertTrue(FileSuffix_hasAsmFileSuffix("foo.s"));
    assertTrue(FileSuffix_hasAsmFileSuffix("foo.a51"));
    assertTrue(FileSuffix_hasAsmFileSuffix("foo.A51"));
    assertTrue(FileSuffix_hasAsmFileSuffix("foo.asm"));
    assertTrue(FileSuffix_hasAsmFileSuffix("foo.ASM"));
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.o"));
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.a"));
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.obj"));
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.OBJ"));
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.lib"));
    assertFalse(FileSuffix_hasAsmFileSuffix("foo.LIB"));
}
Beispiel #9
0
LONGBOW_TEST_CASE(Global, metisMessage_ObjectHashEquals_IsNotEqual)
{
    // create messages from different content objects
    PARCLogReporter *reporter = parcLogReporterTextStdout_Create();
    MetisLogger *logger = metisLogger_Create(reporter, parcClock_Wallclock());
    parcLogReporter_Release(&reporter);
    MetisMessage *a = metisMessage_CreateFromArray(metisTestDataV0_EncodedObject, sizeof(metisTestDataV0_EncodedObject), 1, 2, logger);
    MetisMessage *b = metisMessage_CreateFromArray(metisTestDataV0_SecondObject, sizeof(metisTestDataV0_SecondObject), 1, 2, logger);
    metisLogger_Release(&logger);

    assertFalse(metisMessage_ObjectHashEquals(a, b), "Messages with unequal ContentObjectHash compared as equal");
    metisMessage_Release(&a);
    metisMessage_Release(&b);
}
LONGBOW_TEST_CASE(Global, ccnxKeyLocator_IsKeyName)
{
    CCNxName *keyURIName = ccnxName_CreateFromCString("lci://name/test");
    CCNxLink *keyLink = ccnxLink_Create(keyURIName, NULL, NULL);
    CCNxKeyLocator *keyLocator = ccnxKeyLocator_CreateFromKeyLink(keyLink);

    ccnxKeyLocator_AssertValid(keyLocator);
    assertFalse(ccnxKeyLocator_IsKey(keyLocator), "Expected Iskey to be false");
    assertTrue(ccnxKeyLocator_IsKeyLink(keyLocator), "Expected IsKeyLink to be true");

    ccnxKeyLocator_Release(&keyLocator);
    ccnxName_Release(&keyURIName);
    ccnxLink_Release(&keyLink);
}
Beispiel #11
0
static int _testCopyInvalidFileToDirectory(void) {
  CharString tempDir = _fileUtilitiesMakeTempDir();
  CharString testFilename = newCharStringWithCString(TEST_FILENAME);
  CharString invalid = newCharStringWithCString("invalid");

  convertRelativePathToAbsolute(testFilename, invalid);
  assertFalse(copyFileToDirectory(invalid, tempDir));
  removeDirectory(tempDir);

  freeCharString(testFilename);
  freeCharString(tempDir);
  freeCharString(invalid);
  return 0;
}
Beispiel #12
0
static int _testAdvanceClockMulitpleTimes(void)
{
    AudioClock audioClock = getAudioClock();
    int i;

    for (i = 0; i < 100; i++) {
        advanceAudioClock(audioClock, kAudioClockTestBlocksize);
    }

    assert(audioClock->isPlaying);
    assertFalse(audioClock->transportChanged);
    assertUnsignedLongEquals(kAudioClockTestBlocksize * 100, audioClock->currentFrame);
    return 0;
}
void
sendbuffer(int fd, struct fdstate *state)
{
    struct sendlist *entry = parcMemory_AllocateAndClear(sizeof(struct sendlist));
    assertNotNull(entry, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sendlist));
    size_t len, total_len;
    localhdr *hdr = (localhdr *) entry->buffer;
    int i;
    ssize_t res;

    len = random() % (MAXSEND - sizeof(localhdr) - 1) + 1;
    hdr->pid = getpid();
    hdr->fd = fd;
    hdr->length = (int) len;

    total_len = len + sizeof(localhdr);

    entry->length = total_len;
    entry->refcount = 0;

    for (i = 0; i < CONN_COUNT; i++) {
        if (state[i].fd != fd) {
            entry->refcount++;
            state[i].expected[ state[i].tail ] = entry;
            state[i].tail = (state[i].tail + 1) % MAXPENDING;
            state[i].count_expected++;

            assertFalse(state[i].tail == state[i].head,
                        "%s buffer wrap around on fd %d",
                        __func__,
                        state[i].fd);

            if (CHATTY) {
                printf("conn %2d added expected cnt %u length %zu\n",
                       i,
                       state[i].count_expected,
                       entry->length);
            }
        } else {
            state[i].count_send++;

            if (CHATTY) {
                printf("conn %2d sent count %u\n", i, state[i].count_send);
            }
        }
    }

    res = write(fd, entry->buffer, entry->length);
    assertTrue(res == entry->length, "%s write error %s\n", __func__, strerror(errno));
}
LONGBOW_TEST_CASE(EmptyImplementation, booleanApiFunctions)
{
    AthenaContentStore *store = athenaContentStore_Create(&EmptyContentStoreImplementation, NULL);

    CCNxContentObject *contentObject = _createContentObject("lci:/dogs/are/better/than/cats", 10, NULL);
    CCNxName *name = ccnxName_CreateFromURI("lci:/pie/is/always/good");
    CCNxInterest *interest = ccnxInterest_CreateSimple(name);

    //athena_EncodeMessage(interest);

    AthenaContentStore *ref = athenaContentStore_Acquire(store);
    athenaContentStore_Release(&ref);

    assertFalse(athenaContentStore_PutContentObject(store, contentObject), "Expected false from PutContentObject");
    assertFalse(athenaContentStore_GetMatch(store, interest), "Expected false from GetMatch");
    assertFalse(athenaContentStore_SetCapacity(store, 1), "Expected false from SetCapacity");
    assertFalse(athenaContentStore_RemoveMatch(store, name, NULL, NULL), "Expected false from RemoveMatch");

    ccnxName_Release(&name);
    ccnxInterest_Release(&interest);
    ccnxContentObject_Release(&contentObject);
    athenaContentStore_Release(&store);
}
LONGBOW_TEST_CASE(Global, rtaApiConnection_SendToApi)
{
    TestData *data = longBowTestCase_GetClipBoardData(testCase);
    RtaApiConnection *apiConnection = rtaConnection_GetPrivateData(data->connection, API_CONNECTOR);

    TransportMessage *tm = trafficTools_CreateTransportMessageWithDictionaryInterest(data->connection, CCNxTlvDictionary_SchemaVersion_V1);

    RtaComponentStats *stats = rtaConnection_GetStats(data->connection, API_CONNECTOR);
    rtaApiConnection_SendToApi(apiConnection, tm, stats);
    rtaFramework_NonThreadedStepCount(data->framework, 10);

    // Let the dispatcher run
    struct pollfd pfd = { .fd = data->api_fds[PAIR_OTHER], .events = POLLIN, .revents = 0 };
    int millisecondTimeout = 1000;

    int pollvalue = poll(&pfd, 1, millisecondTimeout);
    assertTrue(pollvalue == 1, "Did not get an event from the API's side of the socket");

    CCNxMetaMessage *testMessage;
    ssize_t bytesRead = read(data->api_fds[PAIR_OTHER], &testMessage, sizeof(testMessage));
    assertTrue(bytesRead == sizeof(testMessage), "Wrong read size, got %zd expected %zd: (%d) %s",
               bytesRead, sizeof(testMessage),
               errno, strerror(errno));
    assertNotNull(testMessage, "Message read is NULL");


    assertTrue(testMessage == transportMessage_GetDictionary(tm),
               "Got wrong raw message, got %p expected %p",
               (void *) testMessage, (void *) transportMessage_GetDictionary(tm));

    ccnxMetaMessage_Release(&testMessage);
    transportMessage_Destroy(&tm);
}

LONGBOW_TEST_CASE(Global, rtaApiConnection_BlockDown)
{
    TestData *data = longBowTestCase_GetClipBoardData(testCase);
    RtaApiConnection *apiConnection = rtaApiConnection_Create(data->connection);

    // make sure we're startined unblocked
    short enabled = parcEventQueue_GetEnabled(apiConnection->bev_api);
    assertTrue(enabled & PARCEventType_Read, "PARCEventType_Read is not enabled on a new Api Connector: enabled = %04X", enabled);

    rtaApiConnection_BlockDown(apiConnection);
    enabled = parcEventQueue_GetEnabled(apiConnection->bev_api);
    assertFalse(enabled & PARCEventType_Read, "PARCEventType_Read is still enabled after caling BlockDown: enabled = %04X", enabled);

    rtaApiConnection_Destroy(&apiConnection);
}
Beispiel #16
0
static void
_parcObjectTesting_AssertCopy(const PARCObject *instance)
{
    PARCObject *copy = parcObject_Copy(instance);
    if (copy == instance) {
        parcObject_Release(&copy);
        assertFalse(true, "Copy should not be the same object");
    }
    if (!parcObject_Equals(instance, copy)) {
        parcObject_Release(&copy);
        assertTrue(false, "Object fails Copy Test");
    }

    parcObject_Release(&copy);
}
LONGBOW_TEST_CASE(Global, cpiAck_CreateNack)
{
    CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
    CPIRouteEntry *route = cpiRouteEntry_CreateRouteToSelf(name);
    PARCJSON *request = cpiForwarding_CreateAddRouteRequest(route);

    PARCJSON *actual = cpiAcks_CreateNack(request);

    assertFalse(cpiAcks_IsAck(actual), "Expected cpiAcks_IsAck to return false.");

    parcJSON_Release(&actual);
    parcJSON_Release(&request);
    cpiRouteEntry_Destroy(&route);
    ccnxName_Release(&name);
}
Beispiel #18
0
PARCBuffer *
parcBuffer_SetPosition(PARCBuffer *buffer, size_t newPosition)
{
    parcBuffer_OptionalAssertValid(buffer);

    assertFalse(newPosition > buffer->limit,
                "new position cannot be greater the buffer's limit");

    buffer->position = newPosition;
    if (!_markIsDiscarded(buffer) && newPosition < buffer->mark) {
        _discardMark(buffer);
    }

    _optionalAssertInvariants(buffer);
    return buffer;
}
Beispiel #19
0
void testLiteral()
{
	tryLiteralOk("true ", [](const JSONAtom &atom) { assertTrue(atom.asBool()); });
	tryLiteralOk("false ", [](const JSONAtom &atom) { assertFalse(atom.asBool()); });
	tryLiteralOk("null ", [](const JSONAtom &atom) { assertNull(atom.asNull()); });

	const char *const json = "invalid ";
	memoryStream_t stream(const_cast<char *const>(json), length(json));
	JSONParser parser(stream);
	try
	{
		std::unique_ptr<JSONAtom> atom(literal(parser));
		fail("The parser failed to throw an exception on invalid literal");
	}
	catch (const JSONParserError &err) { }
}
LONGBOW_TEST_CASE(Global, ccnxContentObject_HasExpiryTime)
{
    CCNxName *name = ccnxName_CreateFromCString("lci:/hello/dolly");
    PARCBuffer *payload = parcBuffer_WrapCString("hello");

    // Use a V1 ContentObject, as V0 doesn't support ExpiryTime
    CCNxContentObject *contentObject =
        ccnxContentObject_CreateWithImplAndPayload(&CCNxContentObjectFacadeV1_Implementation,
                                                   name, CCNxPayloadType_DATA, payload);


    assertFalse(ccnxContentObject_HasExpiryTime(contentObject), "Expected no expiration time by default");

    parcBuffer_Release(&payload);
    ccnxName_Release(&name);
    ccnxContentObject_Release(&contentObject);
}
LONGBOW_TEST_CASE(Global, ccnxContentObject_HasFinalChunkNumber)
{
    CCNxName *name = ccnxName_CreateFromCString("lci:/foo/bar");
    PARCBuffer *payload = parcBuffer_Allocate(100);

    CCNxContentObject *contentObject = ccnxContentObject_CreateWithDataPayload(name, payload);
    assertFalse(ccnxContentObject_HasFinalChunkNumber(contentObject), "Expected no final chunk number");

    ccnxContentObject_SetFinalChunkNumber(contentObject, 100);
    ccnxContentObject_AssertValid(contentObject);
    assertTrue(ccnxContentObject_HasFinalChunkNumber(contentObject), "Expected HasFinalChunkNumber to return true");
    assertTrue(ccnxContentObject_GetFinalChunkNumber(contentObject) == 100, "Expected final chunk number to be 100");

    ccnxName_Release(&name);
    parcBuffer_Release(&payload);
    ccnxContentObject_Release(&contentObject);
}
Beispiel #22
0
static int _testCopyFileToInvalidDirectory(void) {
  CharString tempFile = newCharString();
  CharString testFilename = newCharStringWithCString(TEST_FILENAME);
  CharString invalid = newCharStringWithCString("invalid");
  FILE *fp = fopen(TEST_FILENAME, "w");

  assertNotNull(fp);
  fclose(fp);
  convertRelativePathToAbsolute(testFilename, tempFile);
  assertFalse(copyFileToDirectory(tempFile, invalid));

  unlink(TEST_FILENAME);
  freeCharString(tempFile);
  freeCharString(testFilename);
  freeCharString(invalid);
  return 0;
}
void testJSONValidator__isValidRoot::testSuddenEnd(void){
	#ifdef JSON_VALIDATE
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("")));
	
		//--- void testJSONValidator__isValidRoot::testRoots(void){
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[\"stuff")));
	
		//---void testJSONValidator__isValidRoot::testNotRoots(void){
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("{}aoe")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("[]aoe")));
		assertFalse(JSONValidator::isValidRoot(JSON_TEXT("aoe")));
	#endif
}
static void
recursiveDelete(const char *path)
{
    // only allow under tmp
    assertTrue(strncmp(path, "/tmp/", 5) == 0, "Path must begin with /tmp/: %s", path);
    // dont allow ".."
    assertNull(strstr(path, ".."), "Path cannot have .. in it: %s", path);

    // depth first, dont't follow symlinks
    int flags = FTW_DEPTH | FTW_PHYS;

    // maximum 20 fds open at a time
    int max_fd = 20;

    int failure = nftw(path, deleteEntry, max_fd, flags);
    assertFalse(failure, "Error on recursive delete: (%d) %s", errno, strerror(errno));
}
Beispiel #25
0
LONGBOW_TEST_CASE(Global, parcBitVector_Contains)
{
    PARCBitVector *supersetVector = parcBitVector_Create();

    parcBitVector_Set(supersetVector, 10);
    parcBitVector_Set(supersetVector, 11);

    PARCBitVector *testVector = parcBitVector_Create();
    parcBitVector_Set(testVector, 10);
    assertTrue(parcBitVector_Contains(supersetVector, testVector), "Expect superset to contain testVector");

    parcBitVector_Set(testVector, 12);
    assertFalse(parcBitVector_Contains(supersetVector, testVector), "Expect superset to not contain testVector");

    parcBitVector_Release(&supersetVector);
    parcBitVector_Release(&testVector);
}
Beispiel #26
0
static CCNxMetaMessage *
_athenaLRUContentStore_ProcessMessage(AthenaContentStoreImplementation *store, const CCNxMetaMessage *message)
{
    CCNxMetaMessage *result = NULL;
    AthenaLRUContentStore *impl = (AthenaLRUContentStore *) store;

    if (ccnxMetaMessage_IsInterest(message)) {
        CCNxInterest *interest = ccnxMetaMessage_GetInterest(message);
        CCNxName *queryName = ccnxInterest_GetName(interest);

        uint64_t chunkNumber = 0;
        bool hasChunkNumber = false;
        _getChunkNumberFromName(queryName, &chunkNumber, &hasChunkNumber);
        assertFalse(hasChunkNumber, "LRUContentStore queries don't yet support more than 1 chunk.");

        PARCBuffer *responsePayload = NULL;

        // Find the arguments to our query.
        size_t argSegmentIndex = 0;
        if (_getSegmentIndexOfQueryArgs(queryName, AthenaModule_ContentStore, &argSegmentIndex)) {
            CCNxNameSegment *queryTypeSegment = ccnxName_GetSegment(queryName, argSegmentIndex);
            char *queryTypeString = ccnxNameSegment_ToString(queryTypeSegment);  // e.g. "stat"

            char *statString = "stat";
            if (strncasecmp(queryTypeString, statString, strlen(statString)) == 0) {
                responsePayload = _processStatQuery(impl, queryName, argSegmentIndex + 1, chunkNumber);
            }
            parcMemory_Deallocate(&queryTypeString);
        }

        if (responsePayload != NULL) {
            CCNxContentObject *contentObjectResponse = ccnxContentObject_CreateWithNameAndPayload(
                ccnxInterest_GetName(interest), responsePayload);

            result = ccnxMetaMessage_CreateFromContentObject(contentObjectResponse);
            ccnxContentObject_SetExpiryTime(contentObjectResponse,
                                            parcClock_GetTime(impl->wallClock) +
                                            100); // this response is good for 100 millis

            ccnxContentObject_Release(&contentObjectResponse);
            parcBuffer_Release(&responsePayload);
        }
    }

    return result;  // could be NULL
}
LONGBOW_TEST_CASE(Global, cpiAddress_Equals_NotEqual)
{
    struct sockaddr_in addr_in;
    memset(&addr_in, 0, sizeof(struct sockaddr_in));

    addr_in.sin_addr.s_addr = 0x01020304;
    addr_in.sin_family = AF_INET;
    addr_in.sin_port = 0x0A0B;

    CPIAddress *a = cpiAddress_CreateFromInet(&addr_in);
    CPIAddress *b = cpiAddress_CreateFromInterface(1);

    assertFalse(cpiAddress_Equals(a, b), "Equals failed on different addresses: %s and %s", cpiAddress_ToString(a), cpiAddress_ToString(b));

    cpiAddress_Destroy(&a);
    cpiAddress_Destroy(&b);
}
LONGBOW_TEST_CASE(Global, ccnxKeyLocator_IsKey)
{
    char *hexString = "ABCDEF1234";
    PARCBuffer *keyBuffer = parcBuffer_WrapCString(hexString);
    PARCKeyId *keyId = parcKeyId_Create(keyBuffer);

    PARCKey *key = parcKey_CreateFromDerEncodedPublicKey(keyId, PARCSigningAlgorithm_RSA, keyBuffer);
    CCNxKeyLocator *keyLocator = ccnxKeyLocator_CreateFromKey(key);
    parcKeyId_Release(&keyId);
    parcBuffer_Release(&keyBuffer);

    ccnxKeyLocator_AssertValid(keyLocator);
    assertTrue(ccnxKeyLocator_IsKey(keyLocator), "Expected Iskey to be true");
    assertFalse(ccnxKeyLocator_IsKeyLink(keyLocator), "Expected IsKeyLink to be false");

    ccnxKeyLocator_Release(&keyLocator);
    parcKey_Release(&key);
}
LONGBOW_TEST_CASE(Global, athenaTransportLinkModuleUDP_Local)
{
    PARCURI *connectionURI;
    const char *result;
    AthenaTransportLinkAdapter *athenaTransportLinkAdapter = athenaTransportLinkAdapter_Create(_removeLink, NULL);
    assertNotNull(athenaTransportLinkAdapter, "athenaTransportLinkAdapter_Create returned NULL");

    connectionURI = parcURI_Parse("udp://127.0.0.1:40000/Listener/name=UDP_0");
    result = athenaTransportLinkAdapter_Open(athenaTransportLinkAdapter, connectionURI);
    assertTrue(result != NULL, "athenaTransportLinkAdapter_Open failed (%s)", strerror(errno));
    parcURI_Release(&connectionURI);

    connectionURI = parcURI_Parse("udp://127.0.0.1:40000/name=UDP_1/local=boo");
    result = athenaTransportLinkAdapter_Open(athenaTransportLinkAdapter, connectionURI);
    assertTrue(result == NULL, "athenaTransportLinkAdapter_Open failed to detect bad local directive");
    parcURI_Release(&connectionURI);

    connectionURI = parcURI_Parse("udp://127.0.0.1:40000/name=UDP_1/local=true");
    result = athenaTransportLinkAdapter_Open(athenaTransportLinkAdapter, connectionURI);
    assertTrue(result != NULL, "athenaTransportLinkAdapter_Open failed (%s)", strerror(errno));
    parcURI_Release(&connectionURI);

    connectionURI = parcURI_Parse("udp://127.0.0.1:40000/name=UDP_2/local=false");
    result = athenaTransportLinkAdapter_Open(athenaTransportLinkAdapter, connectionURI);
    assertTrue(result != NULL, "athenaTransportLinkAdapter_Open failed (%s)", strerror(errno));
    parcURI_Release(&connectionURI);

    int linkId = athenaTransportLinkAdapter_LinkNameToId(athenaTransportLinkAdapter, "UDP_1");
    assertFalse(athenaTransportLinkAdapter_IsNotLocal(athenaTransportLinkAdapter, linkId), "Local connection not local");

    linkId = athenaTransportLinkAdapter_LinkNameToId(athenaTransportLinkAdapter, "UDP_2");
    assertTrue(athenaTransportLinkAdapter_IsNotLocal(athenaTransportLinkAdapter, linkId), "NonLocal connection is local");

    int closeResult = athenaTransportLinkAdapter_CloseByName(athenaTransportLinkAdapter, "UDP_2");
    assertTrue(closeResult == 0, "athenaTransportLinkAdapter_CloseByName failed (%s)", strerror(errno));

    closeResult = athenaTransportLinkAdapter_CloseByName(athenaTransportLinkAdapter, "UDP_1");
    assertTrue(closeResult == 0, "athenaTransportLinkAdapter_CloseByName failed (%s)", strerror(errno));

    closeResult = athenaTransportLinkAdapter_CloseByName(athenaTransportLinkAdapter, "UDP_0");
    assertTrue(closeResult == 0, "athenaTransportLinkAdapter_CloseByName failed (%s)", strerror(errno));

    athenaTransportLinkAdapter_Destroy(&athenaTransportLinkAdapter);
}
   /*
    * Runs the test case.
    */
   void runTest()
   {
      Document doc;
      NodeList addressList;
      Node testNode;
      NamedNodeMap attributes;
      Attr streetAttr;
      boolean state;
      doc = (Document) baseT::load("staff", true);
      addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
      testNode = addressList.item(2);
      ((Element) /*Node */testNode).removeAttribute(SA::construct_from_utf8("street"));
      attributes = testNode.getAttributes();
      streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
      baseT::skipIfNull(streetAttr);
      state = streetAttr.getSpecified();
      assertFalse(state);

   }