Skip to content

Commit

Permalink
Merge pull request #199 from DyKnow/feature-2.0.0.beta1
Browse files Browse the repository at this point in the history
Feature 2.0.0.beta1
  • Loading branch information
joeldart committed Jul 28, 2015
2 parents 320884e + 704ea8b commit bfe7739
Show file tree
Hide file tree
Showing 43 changed files with 440 additions and 757 deletions.
9 changes: 7 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ workspace 'SignalR.Client.ObjC'

target :"SignalR.Client.iOS", :exclusive => true do
platform :ios, '6.0'
pod 'AFNetworking', '2.0.2'
pod 'AFNetworking', '2.1.0'
pod 'SocketRocket', '0.3.1-beta2'
end

target :"SignalR.Client.OSX", :exclusive => true do
platform :osx, '10.8'
pod 'AFNetworking', '2.0.2'
pod 'AFNetworking', '2.1.0'
pod 'SocketRocket', '0.3.1-beta2'
end

target :"SignalR.Client.Tests.OSX", :exclusive => true do
platform :osx, '10.8'
pod 'OCMock'
end
27 changes: 14 additions & 13 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
PODS:
- AFNetworking (2.0.2):
- AFNetworking (2.1.0):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/UIKit
- AFNetworking/NSURLConnection (2.0.2):
- AFNetworking/NSURLConnection (2.1.0):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/NSURLSession (2.0.2):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (2.0.2)
- AFNetworking/Security (2.0.2)
- AFNetworking/Serialization (2.0.2)
- AFNetworking/UIKit (2.0.2):
- AFNetworking/NSURLSession (2.1.0):
- AFNetworking/NSURLConnection
- AFNetworking/Reachability (2.1.0)
- AFNetworking/Security (2.1.0)
- AFNetworking/Serialization (2.1.0)
- AFNetworking/UIKit (2.1.0):
- AFNetworking/NSURLConnection
- OCMock (2.2.2)
- SocketRocket (0.3.1-beta2)

DEPENDENCIES:
- AFNetworking (= 2.0.2)
- AFNetworking (= 2.1.0)
- OCMock
- SocketRocket (= 0.3.1-beta2)

SPEC CHECKSUMS:
AFNetworking: 22de50ae71ab1c4859773f61068d6fcd1d8f9a4d
AFNetworking: c7d7901a83f631414c7eda1737261f696101a5cd
OCMock: ffba68873fd32cfd35d885bddad23bfa816da4a3
SocketRocket: 7ac946bcce46287a791dfff3c1f8daa692821dae

COCOAPODS: 0.26.2
COCOAPODS: 0.29.0
149 changes: 86 additions & 63 deletions SignalR.Client.ObjC/SignalR.Client.ObjC.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions SignalR.Client.ObjC/SignalR.Client.Tests/SRChunkBufferTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// Copyright (c) 2012 DyKnow LLC. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <XCTest/XCTest.h>
#import "SRChunkBuffer.h"

@interface SRChunkBufferTests : SenTestCase
@interface SRChunkBufferTests : XCTestCase

@end

Expand All @@ -35,7 +35,7 @@ - (void)testReturnsNullIfNoNewLineIfBuffer
[buffer add:data];

// Assert
STAssertNil([buffer readLine], @"Expected nil received object");
XCTAssertNil([buffer readLine], @"Expected nil received object");
}

- (void)testReturnsTextUpToNewLine
Expand All @@ -48,7 +48,7 @@ - (void)testReturnsTextUpToNewLine
[buffer add:data];

// Assert
STAssertTrue([[buffer readLine] isEqualToString:@"hello world"], @"Expected to read first line only");
XCTAssertTrue([[buffer readLine] isEqualToString:@"hello world"], @"Expected to read first line only");
}

- (void)testCanReadMultipleLines
Expand All @@ -61,9 +61,9 @@ - (void)testCanReadMultipleLines
[buffer add:data];

// Assert
STAssertTrue([[buffer readLine] isEqualToString:@"hel"], @"Expected to read first line");
STAssertTrue([[buffer readLine] isEqualToString:@"lo world"], @"Expected to read second line");
STAssertNil([buffer readLine], @"Expected nil received object");
XCTAssertTrue([[buffer readLine] isEqualToString:@"hel"], @"Expected to read first line");
XCTAssertTrue([[buffer readLine] isEqualToString:@"lo world"], @"Expected to read second line");
XCTAssertNil([buffer readLine], @"Expected nil received object");
}

- (void)testWillCompleteNewLin
Expand All @@ -72,16 +72,16 @@ - (void)testWillCompleteNewLin
SRChunkBuffer *buffer = [[SRChunkBuffer alloc] init];
NSData *data = [[NSString stringWithFormat:@"hello"] dataUsingEncoding:NSUTF8StringEncoding];
[buffer add:data];
STAssertNil([buffer readLine], @"Expected nil received object");
XCTAssertNil([buffer readLine], @"Expected nil received object");
data = [[NSString stringWithFormat:@"\n"] dataUsingEncoding:NSUTF8StringEncoding];
[buffer add:data];
STAssertTrue([[buffer readLine] isEqualToString:@"hello"], @"Expected to read first line only");
XCTAssertTrue([[buffer readLine] isEqualToString:@"hello"], @"Expected to read first line only");
data = [[NSString stringWithFormat:@"Another line"] dataUsingEncoding:NSUTF8StringEncoding];
[buffer add:data];
STAssertNil([buffer readLine], @"Expected nil received object");
XCTAssertNil([buffer readLine], @"Expected nil received object");
data = [[NSString stringWithFormat:@"\nnext"] dataUsingEncoding:NSUTF8StringEncoding];
[buffer add:data];
STAssertTrue([[buffer readLine] isEqualToString:@"Another line"], @"Expected to read first line only");
XCTAssertTrue([[buffer readLine] isEqualToString:@"Another line"], @"Expected to read first line only");
}

@end
4 changes: 2 additions & 2 deletions SignalR.Client.ObjC/SignalR.Client.Tests/SRConnectionTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// Copyright (c) 2012 DyKnow LLC. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <XCTest/XCTest.h>

#import "SRConnection.h"
#import "SRVersion.h"

@interface SRConnectionTests : SenTestCase
@interface SRConnectionTests : XCTestCase

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// Copyright (c) 2012 DyKnow LLC. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <XCTest/XCTest.h>
#import "SignalR.h"

@interface SRHubConnectionTests : SenTestCase
@interface SRHubConnectionTests : XCTestCase

@end

Expand Down
33 changes: 31 additions & 2 deletions SignalR.Client.ObjC/SignalR.Client.Tests/SRHubProxyTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
// Copyright (c) 2012 DyKnow LLC. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "SignalR.h"
//#import "NSDictionary+QueryString.h"

@interface SRHubProxyTests : SenTestCase
@interface SRHubProxyTests : XCTestCase

@end

Expand All @@ -26,6 +27,34 @@ - (void)tearDown
[super tearDown];
}

#pragma mark -
#pragma mark Subscriptions

- (void)testSubscribingToNothingThrows {

id mockConnection = [OCMockObject mockForProtocol:@protocol(SRConnectionInterface)];
id hub = [[SRHubProxy alloc] initWithConnection:mockConnection hubName:@"myHub"];
@try {
[hub on:nil perform:nil selector:nil];
XCTFail(@"Event Name must not be nil");
}
@catch (NSException *exception) {

}
}

- (void)testSubscribingToEmptyStringThrows {
id mockConnection = [OCMockObject mockForProtocol:@protocol(SRConnectionInterface)];
id hub = [[SRHubProxy alloc] initWithConnection:mockConnection hubName:@"myHub"];
@try {
[hub on:@"" perform:nil selector:nil];
XCTFail(@"Event Name must not be empty");
}
@catch (NSException *exception) {

}
}

/**
* Test for adding support for custom query strings on hubs
* SRHubConnection should allow for custom query strings
Expand Down
12 changes: 6 additions & 6 deletions SignalR.Client.ObjC/SignalR.Client.Tests/SRJSONTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2012 DyKnow LLC. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <XCTest/XCTest.h>
#import "NSObject+SRJSON.h"
#import "SRSerializable.h"

Expand All @@ -33,7 +33,7 @@ - (id)proxyForJson



@interface SRJSONTests : SenTestCase
@interface SRJSONTests : XCTestCase

@end

Expand All @@ -57,7 +57,7 @@ - (void)tearDown
- (void)testThrowWhenEnsureFoundationObjectShouldReturnNil
{
InvalidModel *model = [[InvalidModel alloc] init];
STAssertThrowsSpecificNamed([model SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
XCTAssertThrowsSpecificNamed([model SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
}

/**
Expand All @@ -68,7 +68,7 @@ - (void)testThrowWhenEnsureFoundationObjectShouldReturnNil
- (void)testThrowWhenEnsureFoundationObjectShouldReturnNil_NSArray
{
NSArray *nonConformingArray = @[[[InvalidModel alloc] init]];
STAssertThrowsSpecificNamed([nonConformingArray SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
XCTAssertThrowsSpecificNamed([nonConformingArray SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
}

/**
Expand All @@ -79,7 +79,7 @@ - (void)testThrowWhenEnsureFoundationObjectShouldReturnNil_NSArray
- (void)testThrowWhenEnsureFoundationObjectShouldReturnNil_NSDictionary
{
NSDictionary *nonConformingDictionary = @{@"somekey": [[InvalidModel alloc] init]};
STAssertThrowsSpecificNamed([nonConformingDictionary SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
XCTAssertThrowsSpecificNamed([nonConformingDictionary SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
}

/**
Expand All @@ -90,7 +90,7 @@ - (void)testThrowWhenEnsureFoundationObjectShouldReturnNil_NSDictionary
- (void)testThrowWhenEnsureFoundationObjectShouldReturnNil_ConformingObjectReturnsNil
{
InvalidConformingModel *model = [[InvalidConformingModel alloc] init];
STAssertThrowsSpecificNamed([model SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
XCTAssertThrowsSpecificNamed([model SRJSONRepresentation], NSException, NSInternalInconsistencyException, @"SRJSONRepresentation succeeded when it was expected to throw an exception") ;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
- (IBAction)connectClicked:(id)sender
{
NSString *server = [Router sharedRouter].server_url;
connection = [SRHubConnection connectionWithURL:server];
connection = [SRHubConnection connectionWithURLString:server];
hub = [connection createHubProxy:@"Chat"];

[hub setMember:@"focus" object:@YES];
[hub setMember:@"unread" object:@0];
[[hub state] setValue:@YES forKey:@"focus"];
[[hub state] setValue:0 forKey:@"unread"];

[hub on:@"refreshRoom" perform:self selector:@selector(refreshRoom:)];
[hub on:@"showRooms" perform:self selector:@selector(showRooms:)];
Expand Down Expand Up @@ -177,13 +177,15 @@ -(void)refreshRoom:(id)inRoom
[self clearMessages];
[self clearUsers];

[hub invoke:@"GetUsers" withArgs:@[] completionHandler:^(id users) {
for(id user in users)
{
if([user isKindOfClass:[NSDictionary class]]){
[self addUser:user exists:TRUE];
[hub invoke:@"GetUsers" withArgs:@[] completionHandler:^(id users, NSError *error) {
if (!error) {
for(id user in users)
{
if([user isKindOfClass:[NSDictionary class]]){
[self addUser:user exists:TRUE];
}
[self refreshUsers];
}
[self refreshUsers];
}
}];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ - (void)viewDidLoad
}

__weak __typeof(&*self)weakSelf = self;
_connection = [SRHubConnection connectionWithURL:[Router sharedRouter].server_url];
_connection = [SRHubConnection connectionWithURLString:[Router sharedRouter].server_url];
_hub = [_connection createHubProxy:@"statushub"];
[_hub on:@"joined" perform:self selector:@selector(joined:when:)];
[_hub on:@"rejoined" perform:self selector:@selector(rejoined:when:)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ - (void)viewDidLoad
}

__weak __typeof(&*self)weakSelf = self;
_connection = [SRHubConnection connectionWithURL:[Router sharedRouter].server_url];
_connection = [SRHubConnection connectionWithURLString:[Router sharedRouter].server_url];
_hub = [_connection createHubProxy:@"MouseTracking"];
[_hub on:@"move" perform:self selector:@selector(moveMouse:x:y:)];
_connection.started = ^{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ - (IBAction)connectClicked:(id)sender
{
NSString *server = [Router sharedRouter].server_url;
server = [server stringByAppendingFormat:@"raw-connection"];
connection = [SRConnection connectionWithURL:server];
connection = [SRConnection connectionWithURLString:server];
[connection setDelegate:self];
[connection start];

Expand All @@ -116,7 +116,7 @@ - (IBAction)sendClicked:(id)sender
message[@"type"] = @0;
message[@"value"] = meField.text;

[connection send:message];
[connection send:message completionHandler:nil];
}

- (IBAction)broadcastClicked:(id)sender
Expand All @@ -125,7 +125,7 @@ - (IBAction)broadcastClicked:(id)sender
message[@"type"] = @1;
message[@"value"] = messageField.text;

[connection send:message];
[connection send:message completionHandler:nil];
}

- (IBAction)enternameClicked:(id)sender
Expand All @@ -134,7 +134,7 @@ - (IBAction)enternameClicked:(id)sender
message[@"type"] = @2;
message[@"value"] = messageField.text;

[connection send:message];
[connection send:message completionHandler:nil];
}

- (IBAction)sendToUserClicked:(id)sender
Expand All @@ -143,7 +143,7 @@ - (IBAction)sendToUserClicked:(id)sender
message[@"type"] = @3;
message[@"value"] = [NSString stringWithFormat:@"%@|%@",privateMessageToField.text,privateMessageField.text];

[connection send:message];
[connection send:message completionHandler:nil];
}

- (IBAction)joingroupClicked:(id)sender
Expand All @@ -152,7 +152,7 @@ - (IBAction)joingroupClicked:(id)sender
message[@"type"] = @4;
message[@"value"] = messageField.text;

[connection send:message];
[connection send:message completionHandler:nil];
}

- (IBAction)leavegroupClicked:(id)sender
Expand All @@ -161,7 +161,7 @@ - (IBAction)leavegroupClicked:(id)sender
message[@"type"] = @5;
message[@"value"] = messageField.text;

[connection send:message];
[connection send:message completionHandler:nil];
}

- (IBAction)sendToGroupClicked:(id)sender
Expand All @@ -170,7 +170,7 @@ - (IBAction)sendToGroupClicked:(id)sender
message[@"type"] = @6;
message[@"value"] = [NSString stringWithFormat:@"%@|%@",privateMessageToField.text,privateMessageField.text];

[connection send:message];
[connection send:message completionHandler:nil];
}

- (IBAction)stopClicked:(id)sender
Expand Down
Loading

0 comments on commit bfe7739

Please sign in to comment.