Skip to content

Commit

Permalink
Rename Host to ServiceAddress
Browse files Browse the repository at this point in the history
Issue #203
  • Loading branch information
eofster committed Apr 19, 2016
1 parent d6a0e16 commit 298edd9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
16 changes: 8 additions & 8 deletions Telephone.xcodeproj/project.pbxproj
Expand Up @@ -51,8 +51,8 @@
8A7874F61C5A29EE002494ED /* ConditionalRingtonePlaybackInteractorTestDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7874F51C5A29EE002494ED /* ConditionalRingtonePlaybackInteractorTestDelegate.swift */; };
8A7874F81C5A2F4D002494ED /* AppController+ConditionalRingtonePlaybackInteractorDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7874F71C5A2F4D002494ED /* AppController+ConditionalRingtonePlaybackInteractorDelegate.swift */; };
8A7E212D1CC23F6B000D02C3 /* UserAgentAudioDeviceUpdateInteractorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB32A0C1BEB8A760016C8E6 /* UserAgentAudioDeviceUpdateInteractorTests.swift */; };
8A7E21521CC3F6A5000D02C3 /* HostTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7E21511CC3F6A5000D02C3 /* HostTests.swift */; };
8A7E21541CC411F3000D02C3 /* Host.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7E21531CC411F3000D02C3 /* Host.swift */; };
8A7E21521CC3F6A5000D02C3 /* ServiceAddressTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7E21511CC3F6A5000D02C3 /* ServiceAddressTests.swift */; };
8A7E21541CC411F3000D02C3 /* ServiceAddress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7E21531CC411F3000D02C3 /* ServiceAddress.swift */; };
8A91758F1CA1CBD600354E26 /* UserAgentAudioDeviceNameToDeviceMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A91758E1CA1CBD600354E26 /* UserAgentAudioDeviceNameToDeviceMap.swift */; };
8A9175911CA2BBF900354E26 /* UserAgentAudioDevice+SystemAudioDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A9175901CA2BBF900354E26 /* UserAgentAudioDevice+SystemAudioDevice.swift */; };
8A9175931CA2C2DC00354E26 /* UserAgentAudioDevice+SystemAudioDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A9175921CA2C2DC00354E26 /* UserAgentAudioDevice+SystemAudioDevice.swift */; };
Expand Down Expand Up @@ -420,8 +420,8 @@
8A7874F31C5A2774002494ED /* RingtonePlaybackInteractorSpy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RingtonePlaybackInteractorSpy.swift; sourceTree = "<group>"; };
8A7874F51C5A29EE002494ED /* ConditionalRingtonePlaybackInteractorTestDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConditionalRingtonePlaybackInteractorTestDelegate.swift; sourceTree = "<group>"; };
8A7874F71C5A2F4D002494ED /* AppController+ConditionalRingtonePlaybackInteractorDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AppController+ConditionalRingtonePlaybackInteractorDelegate.swift"; sourceTree = "<group>"; };
8A7E21511CC3F6A5000D02C3 /* HostTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = HostTests.swift; path = UseCasesTests/HostTests.swift; sourceTree = SOURCE_ROOT; };
8A7E21531CC411F3000D02C3 /* Host.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Host.swift; sourceTree = "<group>"; };
8A7E21511CC3F6A5000D02C3 /* ServiceAddressTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ServiceAddressTests.swift; path = UseCasesTests/ServiceAddressTests.swift; sourceTree = SOURCE_ROOT; };
8A7E21531CC411F3000D02C3 /* ServiceAddress.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceAddress.swift; sourceTree = "<group>"; };
8A91758E1CA1CBD600354E26 /* UserAgentAudioDeviceNameToDeviceMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserAgentAudioDeviceNameToDeviceMap.swift; sourceTree = "<group>"; };
8A9175901CA2BBF900354E26 /* UserAgentAudioDevice+SystemAudioDevice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserAgentAudioDevice+SystemAudioDevice.swift"; sourceTree = "<group>"; };
8A9175921CA2C2DC00354E26 /* UserAgentAudioDevice+SystemAudioDevice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserAgentAudioDevice+SystemAudioDevice.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -947,11 +947,11 @@
AA3B6E851C47ACFA0030D410 /* Timer */,
AA3905601C0077B7005A8AA3 /* User Agent */,
8ADD6B6C1C528F720029C3D8 /* Error.swift */,
8A7E21531CC411F3000D02C3 /* Host.swift */,
8A7E21511CC3F6A5000D02C3 /* HostTests.swift */,
AA404AC61BFC8E5D00D00A3E /* Interactor.swift */,
AAB32A111BEBA4BA0016C8E6 /* InteractorFactory.swift */,
8ADD31C91CC112A2008C083C /* NullThrowingInteractor.swift */,
8A7E21531CC411F3000D02C3 /* ServiceAddress.swift */,
8A7E21511CC3F6A5000D02C3 /* ServiceAddressTests.swift */,
AA404AC91BFC8E8900D00A3E /* ThrowingInteractor.swift */,
AA32F7FD1BC6908300FAC228 /* UserDefaults.swift */,
AA7F6D3B1C034B700064DA3A /* UserDefaultsKeys.h */,
Expand Down Expand Up @@ -1861,7 +1861,7 @@
8A7874F21C5A2612002494ED /* ConditionalRingtonePlaybackInteractor.swift in Sources */,
AA3B6E801C46B40C0030D410 /* Sound.swift in Sources */,
8ADA26F41C986C9E0066B224 /* SoundConfigurationLoadInteractor.swift in Sources */,
8A7E21541CC411F3000D02C3 /* Host.swift in Sources */,
8A7E21541CC411F3000D02C3 /* ServiceAddress.swift in Sources */,
8ADD31CD1CC165C3008C083C /* DelayingUserAgentSoundIOSelectionInteractor.swift in Sources */,
8A61363C1CC23AB900A087A4 /* SystemAudioDevicesChangeEventTargetComposite.swift in Sources */,
AA1019771C48071700869D01 /* RingtoneFactory.swift in Sources */,
Expand Down Expand Up @@ -1922,7 +1922,7 @@
AA3B6E8B1C47BFDF0030D410 /* RepeatingSoundTests.swift in Sources */,
8A9175911CA2BBF900354E26 /* UserAgentAudioDevice+SystemAudioDevice.swift in Sources */,
8AC1A4431C67C35D007778A2 /* DefaultSoundPlaybackInteractorTests.swift in Sources */,
8A7E21521CC3F6A5000D02C3 /* HostTests.swift in Sources */,
8A7E21521CC3F6A5000D02C3 /* ServiceAddressTests.swift in Sources */,
8A7E212D1CC23F6B000D02C3 /* UserAgentAudioDeviceUpdateInteractorTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
4 changes: 2 additions & 2 deletions Telephone/AccountController.m
Expand Up @@ -89,9 +89,9 @@ - (void)setEnabled:(BOOL)flag {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];

if (flag) {
Host *host = [[Host alloc] initWithString:self.account.registrar];
ServiceAddress *address = [[ServiceAddress alloc] initWithString:self.account.registrar];
AKNetworkReachability *reachability
= [AKNetworkReachability networkReachabilityWithHost:host.address];
= [AKNetworkReachability networkReachabilityWithHost:address.host];
[self setRegistrarReachability:reachability];

if (reachability != nil) {
Expand Down
10 changes: 5 additions & 5 deletions UseCases/Host.swift → UseCases/ServiceAddress.swift
@@ -1,5 +1,5 @@
//
// Host.swift
// ServiceAddress.swift
// Telephone
//
// Copyright (c) 2008-2016 Alexey Kuznetsov
Expand All @@ -16,16 +16,16 @@
// GNU General Public License for more details.
//

public class Host: NSObject {
public let address: String
public class ServiceAddress: NSObject {
public let host: String
public let port: String

public init(string: String) {
if let range = string.rangeOfString(":", options: .BackwardsSearch) {
address = string.substringToIndex(range.startIndex)
host = string.substringToIndex(range.startIndex)
port = string.substringFromIndex(range.endIndex)
} else {
address = string
host = string
port = ""
}
}
Expand Down
@@ -1,5 +1,5 @@
//
// HostTests.swift
// ServiceAddressTests.swift
// Telephone
//
// Copyright (c) 2008-2016 Alexey Kuznetsov
Expand All @@ -19,33 +19,33 @@
import UseCases
import XCTest

class HostTests: XCTestCase {
class ServiceAddressTests: XCTestCase {
func testCanCreate() {
let sut = Host(string: "any")
let sut = ServiceAddress(string: "any")

XCTAssertNotNil(sut)
}

func testAddressIsFullSourceStringWhenNoPortIsSpecified() {
let sut = Host(string: "any")
func testHostIsFullSourceStringWhenNoPortIsSpecified() {
let sut = ServiceAddress(string: "any")

XCTAssertEqual(sut.address, "any")
XCTAssertEqual(sut.host, "any")
}

func testAddressIsSubstringBeforeColon() {
let sut = Host(string: "any:123")
func testHostIsSubstringBeforeColon() {
let sut = ServiceAddress(string: "any:123")

XCTAssertEqual(sut.address, "any")
XCTAssertEqual(sut.host, "any")
}

func testPortIsSubstringAfterColon() {
let sut = Host(string: "any:123")
let sut = ServiceAddress(string: "any:123")

XCTAssertEqual(sut.port, "123")
}

func testPortIsEmptyStringWhenSourceStringEndsWithColon() {
let sut = Host(string: "any:")
let sut = ServiceAddress(string: "any:")

XCTAssertEqual(sut.port, "")
}
Expand Down

0 comments on commit 298edd9

Please sign in to comment.