Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rolivieri committed Dec 15, 2016
2 parents a6a7697 + c4f0910 commit e59c8f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions Sources/CloudFoundryEnv/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct App {
var limits: Limits?
var port: Int?
var spaceId: String?
var startedAt: Date?
var startedAt: Date? // Not provided on Diego

init() {}

Expand Down Expand Up @@ -92,15 +92,13 @@ public struct App {
let instanceIndex = instanceIndex,
let limits = limits,
let port = port,
let spaceId = spaceId,
let startedAt = startedAt else {
let spaceId = spaceId else {
return nil
}

let startedAtTs = startedAt.timeIntervalSince1970
return App(id: id, name: name, uris: uris, version: version, instanceId: instanceId,
instanceIndex: instanceIndex, limits: limits, port: port, spaceId: spaceId,
startedAtTs: startedAtTs, startedAt: startedAt)
startedAt: startedAt)
}
}

Expand All @@ -125,17 +123,17 @@ public struct App {
public let limits: Limits
public let port: Int
public let spaceId: String
public let startedAtTs: TimeInterval
public let startedAt: Date
public let startedAtTs: TimeInterval?
public let startedAt: Date? // Not provided on Diego

/**
* Constructor.
*/
// swiftlint:disable function_parameter_count
// swiftlint:disable function_parameter_count
private init(id: String, name: String, uris: [String], version: String,
instanceId: String, instanceIndex: Int, limits: Limits, port: Int,
spaceId: String, startedAtTs: TimeInterval, startedAt: Date) {
// swiftlint:enable function_parameter_count
spaceId: String, startedAt: Date?) {
// swiftlint:enable function_parameter_count

self.id = id
self.name = name
Expand All @@ -146,7 +144,7 @@ public struct App {
self.limits = limits
self.port = port
self.spaceId = spaceId
self.startedAtTs = startedAtTs
self.startedAt = startedAt
self.startedAtTs = startedAt?.timeIntervalSince1970
}
}
2 changes: 1 addition & 1 deletion Tests/CloudFoundryEnvTests/MainTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MainTests : XCTestCase {
XCTAssertEqual(uris.count, 1, "There should be only 1 uri in the uris array.")
XCTAssertEqual(uris[0], "swift-test.mybluemix.net", "URI value should match.")
XCTAssertEqual(app.name, "swift-test", "Application name should match.")
let startedAt: Date? = app.startedAt as Date
let startedAt: Date? = app.startedAt
XCTAssertNotNil(startedAt)
let dateUtils = DateUtils()
let startedAtStr = dateUtils.convertNSDateToString(nsDate: startedAt)
Expand Down

0 comments on commit e59c8f0

Please sign in to comment.