Permalink
Browse files

update

  • Loading branch information...
sassembla committed Sep 27, 2013
1 parent 2013a45 commit 62e42be1b23c2e8c947c7defd2a327b2d2629dfa
Showing with 12 additions and 49 deletions.
  1. +4 −3 EnteringOrbit/AppDelegate.m
  2. +8 −46 EnteringOrbitTests/EnteringOrbitTests.m
@@ -180,6 +180,7 @@ - (void) drainViaTail {
long line = 0;
while(fgets(buffer, BUFSIZ, fp)) {
NSString * message = [NSString stringWithCString:buffer encoding:NSUTF8StringEncoding];
[self formatOutput:[NSString stringWithFormat:@"debug: message: %@", message]];
@@ -211,7 +212,7 @@ - (void) drainViaTail {
if (limitLineNum != 0 && limitLineNum < line) break;
if (m_state == STATE_MONOCAST_FAILED) break;
if (m_state == STATE_SOURCE_FAILED) break;
}
// output message
@@ -228,6 +229,8 @@ - (void) drainViaTail {
[m_ssh terminate];
[m_ssh waitUntilExit];
// dead
[self close];
}
@@ -304,8 +307,6 @@ - (NSString * ) formatOutput:(NSString * )message {
}
- (void) close {
[m_ssh terminate];
[m_client close];
[messenger closeConnection];
}
@@ -116,50 +116,12 @@ - (void) testWebSocnetClientConnectFailedThenKill {
}
- (void) testPeerConnectFailedThenKill {
NSDictionary * paramDict = @{
KEY_SOURCETARGET:TEST_DUMMY_SOURCE_TARGET,
KEY_TAILTARGET:TEST_TAIL_TARGET,
KEY_LIMIT:TEST_LIMIT_5};
delegate = [[AppDelegate alloc] initAppDelegateWithParam:paramDict];
[delegate run];
// wait for line-tailed
while ([delegate status] != STATE_SOURCE_FAILED) {
[[NSRunLoop mainRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
}
XCTAssert([delegate status] == STATE_SOURCE_FAILED, @"not match, %d", [delegate status]);
}
- (void) testPeerConnectWithWebSocketPublishFailedThenKill {
NSDictionary * paramDict = @{
KEY_SOURCETARGET:TEST_DUMMY_SOURCE_TARGET,
KEY_TAILTARGET:TEST_TAIL_TARGET,
KEY_PUBLISHTARGET:TEST_PUBLISH_TARGET,
KEY_LIMIT:TEST_LIMIT_5};
delegate = [[AppDelegate alloc] initAppDelegateWithParam:paramDict];
[delegate run];
// wait for line-tailed
while ([delegate status] != STATE_SOURCE_FAILED) {
[[NSRunLoop mainRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
}
XCTAssert([delegate status] == STATE_SOURCE_FAILED, @"not match, %d", [delegate status]);
}
// with before-filter
- (void) testBeforeFilterWork {
NSDictionary * paramDict = @{
KEY_INPUTFILE:TEST_INPUTFILEPATH,
KEY_DEBUG:@"",
KEY_SOURCETARGET:TEST_DUMMY_SOURCE_TARGET,
KEY_SOURCETARGET:TEST_SOURCE_TARGET,
KEY_TAILTARGET:TEST_TAIL_TARGET,
KEY_PUBLISHTARGET:TEST_PUBLISH_TARGET,
KEY_LIMIT:TEST_LIMIT_5};
@@ -168,38 +130,38 @@ - (void) testBeforeFilterWork {
[delegate run];
// wait for line-tailed
while ([delegate status] != STATE_SOURCE_FAILED) {
while ([delegate status] != STATE_TAILING) {
[[NSRunLoop mainRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
}
XCTAssert([delegate status] == STATE_SOURCE_FAILED, @"not match, %d", [delegate status]);
XCTAssert([delegate status] == STATE_TAILING, @"not match, %d", [delegate status]);
}
- (void) testBeforeFilterWorkWithWebSocket {
NSDictionary * paramDict = @{
KEY_INPUTFILE:TEST_INPUTFILEPATH,
KEY_DEBUG:@"",
KEY_SOURCETARGET:TEST_DUMMY_SOURCE_TARGET,
KEY_SOURCETARGET:TEST_SOURCE_TARGET,
KEY_TAILTARGET:TEST_TAIL_TARGET,
KEY_PUBLISHTARGET:TEST_PUBLISH_TARGET,
KEY_PUBLISHTARGET:TEST_DUMMY_PUBLISH_TARGET,
KEY_LIMIT:TEST_LIMIT_5};
delegate = [[AppDelegate alloc] initAppDelegateWithParam:paramDict];
[delegate run];
// wait for line-tailed
while ([delegate status] != STATE_SOURCE_FAILED) {
while ([delegate status] != STATE_MONOCAST_FAILED) {
[[NSRunLoop mainRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
}
XCTAssert([delegate status] == STATE_SOURCE_FAILED, @"not match, %d", [delegate status]);
XCTAssert([delegate status] == STATE_MONOCAST_FAILED, @"not match, %d", [delegate status]);
}
- (void) testBeforeFilterFailedToLoad {
NSDictionary * paramDict = @{
KEY_INPUTFILE:TEST_DUMMY_INPUTFILEPATH,
KEY_DEBUG:@"",
KEY_SOURCETARGET:TEST_DUMMY_SOURCE_TARGET,
KEY_SOURCETARGET:TEST_SOURCE_TARGET,
KEY_TAILTARGET:TEST_TAIL_TARGET,
KEY_PUBLISHTARGET:TEST_PUBLISH_TARGET,
KEY_LIMIT:TEST_LIMIT_5};

0 comments on commit 62e42be

Please sign in to comment.