Commit b8bddde5 authored by James Hughes's avatar James Hughes
Browse files

Testing... Multicast. etc.

parent c210fcd2
Loading
Loading
Loading
Loading
+95 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
		3EFB7F2B1B7B963800988886 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EFB7F2A1B7B963800988886 /* Channel.swift */; };
		3EFB7F2D1B7BAF8D00988886 /* NetworkChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EFB7F2C1B7BAF8D00988886 /* NetworkChannel.swift */; };
		3EFB7F2F1B7BB4E700988886 /* Authentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EFB7F2E1B7BB4E700988886 /* Authentication.swift */; };
		7ACC0F461B97D218005BD8BE /* Kinetic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EDAAB3D1B66D32D00F30808 /* Kinetic.framework */; };
		7ACC0F4D1B97D264005BD8BE /* KineticTestMulticast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ACC0F4C1B97D264005BD8BE /* KineticTestMulticast.swift */; };
		921636AE408C3549DE7A1141 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 382D1C00FC0EC4F1BF676411 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
/* End PBXBuildFile section */

@@ -37,6 +39,13 @@
			remoteGlobalIDString = 3EDAAB3C1B66D32D00F30808;
			remoteInfo = Kinetic;
		};
		7ACC0F471B97D218005BD8BE /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 3EDAAB341B66D32D00F30808 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 3EDAAB3C1B66D32D00F30808;
			remoteInfo = Kinetic;
		};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
@@ -67,6 +76,8 @@
		3EFB7F2A1B7B963800988886 /* Channel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
		3EFB7F2C1B7BAF8D00988886 /* NetworkChannel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkChannel.swift; sourceTree = "<group>"; };
		3EFB7F2E1B7BB4E700988886 /* Authentication.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Authentication.swift; sourceTree = "<group>"; };
		7ACC0F411B97D218005BD8BE /* KineticTestsMulticast.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KineticTestsMulticast.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
		7ACC0F4C1B97D264005BD8BE /* KineticTestMulticast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KineticTestMulticast.swift; sourceTree = "<group>"; };
		80777030020DBD5A301CA196 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
		FB4A7FCA365ECAF75E20A4A9 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -88,6 +99,14 @@
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		7ACC0F3E1B97D218005BD8BE /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				7ACC0F461B97D218005BD8BE /* Kinetic.framework in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
@@ -116,6 +135,7 @@
			children = (
				3EDAAB3D1B66D32D00F30808 /* Kinetic.framework */,
				3EDAAB471B66D32D00F30808 /* KineticTests.xctest */,
				7ACC0F411B97D218005BD8BE /* KineticTestsMulticast.xctest */,
			);
			name = Products;
			sourceTree = "<group>";
@@ -143,6 +163,7 @@
			isa = PBXGroup;
			children = (
				3EDAAB4C1B66D32D00F30808 /* KineticTests.swift */,
				7ACC0F4C1B97D264005BD8BE /* KineticTestMulticast.swift */,
				3EDAAB4E1B66D32D00F30808 /* Info.plist */,
			);
			path = KineticTests;
@@ -234,6 +255,24 @@
			productReference = 3EDAAB471B66D32D00F30808 /* KineticTests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
		7ACC0F401B97D218005BD8BE /* KineticTestsMulticast */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 7ACC0F4B1B97D218005BD8BE /* Build configuration list for PBXNativeTarget "KineticTestsMulticast" */;
			buildPhases = (
				7ACC0F3D1B97D218005BD8BE /* Sources */,
				7ACC0F3E1B97D218005BD8BE /* Frameworks */,
				7ACC0F3F1B97D218005BD8BE /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
				7ACC0F481B97D218005BD8BE /* PBXTargetDependency */,
			);
			name = KineticTestsMulticast;
			productName = KineticTestsMulticast;
			productReference = 7ACC0F411B97D218005BD8BE /* KineticTestsMulticast.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
@@ -250,6 +289,9 @@
					3EDAAB461B66D32D00F30808 = {
						CreatedOnToolsVersion = 7.0;
					};
					7ACC0F401B97D218005BD8BE = {
						CreatedOnToolsVersion = 7.0;
					};
				};
			};
			buildConfigurationList = 3EDAAB371B66D32D00F30808 /* Build configuration list for PBXProject "Kinetic" */;
@@ -266,6 +308,7 @@
			targets = (
				3EDAAB3C1B66D32D00F30808 /* Kinetic */,
				3EDAAB461B66D32D00F30808 /* KineticTests */,
				7ACC0F401B97D218005BD8BE /* KineticTestsMulticast */,
			);
		};
/* End PBXProject section */
@@ -285,6 +328,13 @@
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		7ACC0F3F1B97D218005BD8BE /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
@@ -348,10 +398,18 @@
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				7ACC0F4D1B97D264005BD8BE /* KineticTestMulticast.swift in Sources */,
				3EDAAB4D1B66D32D00F30808 /* KineticTests.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		7ACC0F3D1B97D218005BD8BE /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
@@ -360,6 +418,11 @@
			target = 3EDAAB3C1B66D32D00F30808 /* Kinetic */;
			targetProxy = 3EDAAB491B66D32D00F30808 /* PBXContainerItemProxy */;
		};
		7ACC0F481B97D218005BD8BE /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 3EDAAB3C1B66D32D00F30808 /* Kinetic */;
			targetProxy = 7ACC0F471B97D218005BD8BE /* PBXContainerItemProxy */;
		};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
@@ -516,6 +579,30 @@
			};
			name = Release;
		};
		7ACC0F491B97D218005BD8BE /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				COMBINE_HIDPI_IMAGES = YES;
				INFOPLIST_FILE = KineticTestsMulticast/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				MACOSX_DEPLOYMENT_TARGET = 10.11;
				PRODUCT_BUNDLE_IDENTIFIER = com.DeeHughes.KineticTestsMulticast;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		7ACC0F4A1B97D218005BD8BE /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				COMBINE_HIDPI_IMAGES = YES;
				INFOPLIST_FILE = KineticTestsMulticast/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				MACOSX_DEPLOYMENT_TARGET = 10.11;
				PRODUCT_BUNDLE_IDENTIFIER = com.DeeHughes.KineticTestsMulticast;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
@@ -546,6 +633,14 @@
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		7ACC0F4B1B97D218005BD8BE /* Build configuration list for PBXNativeTarget "KineticTestsMulticast" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				7ACC0F491B97D218005BD8BE /* Debug */,
				7ACC0F4A1B97D218005BD8BE /* Release */,
			);
			defaultConfigurationIsVisible = 0;
		};
/* End XCConfigurationList section */
	};
	rootObject = 3EDAAB341B66D32D00F30808 /* Project object */;
+45 −0
Original line number Diff line number Diff line
//
//  KineticTestMulticast.swift
//  Kinetic
//
//  Created by James Hughes on 9/2/15.
//  Copyright © 2015 Seagate. All rights reserved.
//

import XCTest
import Socket

class KineticTestMulticast: XCTestCase {

    
    override func setUp() {
        super.setUp()
    }
    
    override func tearDown() {
        super.tearDown()
    }
    
    func testMulticast () {
        do {
            let mAddr = "239.1.2.3"
            let mPort = "8123"
            let s = try Datagram(multicast: mAddr, port: mPort)
            
            // recieve it on the multicast socket
            var (_, _, bytes) = try s.recv(65535, timeout:31)
            XCTAssertGreaterThan(bytes.count, 0) // this will fail if the simulator is not up
    
            let data = NSData(bytesNoCopy: &bytes, length: bytes.count, freeWhenDone:false)

            let json = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments)
            print (json)
            
            //            s.sockClose()
            s.sockClose()
        } catch let x {
            XCTFail(String(x))
        }
    }

}
+8 −9
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@

import XCTest
@testable import Kinetic
import BrightFutures


class KineticTests: XCTestCase {
    
@@ -17,11 +19,16 @@ class KineticTests: XCTestCase {
        super.setUp()
        do {
            c = try Kinetic.connect("127.0.0.1")
            print("Open Successful, \(c!.connectionId!)")
        } catch let x {
            XCTFail(String(x))
            fatalError(String(x)) // don't continue on failure. None of the tests will work.
        }
    }
    
    func delay(x: Double) {
        NSThread.sleepForTimeInterval(x)
    }
    
    override func tearDown() {
        c!.close()
        XCTAssertFalse(c!.connected)
@@ -45,12 +52,4 @@ class KineticTests: XCTestCase {
            XCTFail(String(x))
        }
    }
    
    func testPerformanceExample() {
        // This is an example of a performance test case.
        self.measureBlock {
            // Put the code you want to measure the time of here.
        }
    }
    
}
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ CHECKOUT OPTIONS:
    :commit: ad4db3095a9ccc034c1eb65934a89c670012e6a0
    :git: https://github.com/krzyzanowskim/CryptoSwift
  Socket:
    :commit: aa3a929fb2bdb8517e7a446c1376d1dedbdaceb3
    :commit: f1fd41d73bddd744fddba0110a10862e4fe70346
    :git: https://github.com/jphughes/socket-swift

SPEC CHECKSUMS:
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ CHECKOUT OPTIONS:
    :commit: ad4db3095a9ccc034c1eb65934a89c670012e6a0
    :git: https://github.com/krzyzanowskim/CryptoSwift
  Socket:
    :commit: aa3a929fb2bdb8517e7a446c1376d1dedbdaceb3
    :commit: f1fd41d73bddd744fddba0110a10862e4fe70346
    :git: https://github.com/jphughes/socket-swift

SPEC CHECKSUMS:
Loading