Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update scala #253

Merged
merged 7 commits into from Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,7 +1,7 @@
language: scala

scala:
- 2.12.6
- 2.12.7

python:
- 2.7
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Expand Up @@ -46,7 +46,7 @@ def scalaStyleSettings: Seq[Def.Setting[_]] = scalaStyleCompile ++ scalaStyleTes
// settings that should be inherited by all projects
lazy val sharedSettings = Seq(
organization := "vinyldns",
scalaVersion := "2.12.6",
scalaVersion := "2.12.7",
organizationName := "Comcast Cable Communications Management, LLC",
startYear := Some(2018),
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")),
Expand Down
Expand Up @@ -93,7 +93,7 @@ trait MembershipRoute extends Directives {
}
}
} ~
path("groups" / Segment) { id =>
path("groups" / Segment) { _ =>
put {
monitor("Endpoint.updateGroup") {
entity(as[UpdateGroupInput]) { input =>
Expand Down
Expand Up @@ -104,7 +104,7 @@ trait RecordSetRoute extends Directives {
}
} ~
path("zones" / Segment / "recordsets" / Segment / "changes" / Segment) {
(zoneId, rsId, changeId) =>
(zoneId, _, changeId) =>
get {
monitor("Endpoint.getRecordSetChange") {
execute(recordSetService.getRecordSetChange(zoneId, changeId, authPrincipal)) {
Expand Down
Expand Up @@ -35,19 +35,16 @@ trait VinylDNSDirectives extends Directives {

val vinylDNSAuthenticator: VinylDNSAuthenticator

def authenticate: Directive1[AuthPrincipal] =
extractExecutionContext.flatMap { implicit ec ⇒
extractRequestContext.flatMap { ctx =>
extractStrictEntity(10.seconds).flatMap { strictEntity =>
onSuccess(
vinylDNSAuthenticator.authenticate(ctx, strictEntity.data.utf8String).unsafeToFuture())
.flatMap {
case Right(authPrincipal) ⇒
provide(authPrincipal)
case Left(e) ⇒
complete(handleAuthenticateError(e))
}
}
def authenticate: Directive1[AuthPrincipal] = extractRequestContext.flatMap { ctx =>
extractStrictEntity(10.seconds).flatMap { strictEntity =>
onSuccess(
vinylDNSAuthenticator.authenticate(ctx, strictEntity.data.utf8String).unsafeToFuture())
.flatMap {
case Right(authPrincipal) ⇒
provide(authPrincipal)
case Left(e) ⇒
complete(handleAuthenticateError(e))
}
}
}

Expand Down
Expand Up @@ -76,7 +76,7 @@ trait ZoneRoute extends Directives {
complete(StatusCodes.Accepted, chg)
}
} ~
(put & path("zones" / Segment) & monitor("Endpoint.updateZone")) { id =>
(put & path("zones" / Segment) & monitor("Endpoint.updateZone")) { _ =>
entity(as[Zone]) { zone =>
execute(zoneService.updateZone(encrypt(zone), authPrincipal)) { chg =>
complete(StatusCodes.Accepted, chg)
Expand Down
Expand Up @@ -153,12 +153,7 @@ class BatchChangeServiceSpec
IO.pure(dbZones.filter(zn => zoneNames.contains(zn.name)))

override def getZonesByFilters(zoneNames: Set[String]): IO[Set[Zone]] = {
val zones = for {
zoneInDB <- dbZones
zoneMatch <- zoneNames
if zoneInDB.name.endsWith(zoneMatch)
davidmargolin marked this conversation as resolved.
Show resolved Hide resolved
} yield zoneInDB
IO.pure(zones)
IO.pure(dbZones.filter(z => zoneNames.exists(z.name.endsWith)))
}
}

Expand Down
Expand Up @@ -48,7 +48,7 @@ class JavaCryptoSpec extends WordSpec with Matchers {
}

"be thread safe" in {
(1 to 100).par.foreach { i =>
(1 to 100).par.foreach { _ =>
val e = unencryptedString
val h = javaCrypto.encrypt(e)
val r = javaCrypto.decrypt(h)
Expand Down
Expand Up @@ -75,7 +75,7 @@ class MonitorSpec
"record successful futures" in {
val traitTest = new TestMonitoring

whenReady(traitTest.doSomethingGood().unsafeToFuture()) { result =>
whenReady(traitTest.doSomethingGood().unsafeToFuture()) { _ =>
verify(mockLatency).+=(anyLong)
verifyZeroInteractions(mockErrors)
}
Expand Down
Expand Up @@ -49,7 +49,7 @@ class DynamoDBRecordChangeRepositorySpec

"DynamoDBRecordChangeRepository.save" should {
"group change sets into batch writes with 25 in each" in {
val changes = for (i <- 1 to 52) yield pendingCreateAAAA
val changes = for (_ <- 1 to 52) yield pendingCreateAAAA
val changeSet = ChangeSet(changes)

val batchCaptor = ArgumentCaptor.forClass(classOf[Seq[WriteRequest]])
Expand Down Expand Up @@ -81,7 +81,7 @@ class DynamoDBRecordChangeRepositorySpec
}

"returns a future failure if the first batch fails" in {
val changes = for (i <- 0 to 52) yield pendingCreateAAAA
val changes = for (_ <- 0 to 52) yield pendingCreateAAAA
val changeSet = ChangeSet(changes)

val dynamoResponse = mock[BatchWriteItemResult]
Expand All @@ -100,7 +100,7 @@ class DynamoDBRecordChangeRepositorySpec
}

"returns a future failure if any batch fails" in {
val changes = for (i <- 0 to 52) yield pendingCreateAAAA
val changes = for (_ <- 0 to 52) yield pendingCreateAAAA
val changeSet = ChangeSet(changes)

val dynamoResponse = mock[BatchWriteItemResult]
Expand Down
Expand Up @@ -72,7 +72,7 @@ class DynamoDBRecordSetRepositorySpec
}

"group change sets into batch writes with 25 in each" in {
val changes = for (i <- 1 to 52) yield pendingCreateAAAA
val changes = for (_ <- 1 to 52) yield pendingCreateAAAA
val batchCaptor = ArgumentCaptor.forClass(classOf[Seq[WriteRequest]])
val dynamoResponse = mock[BatchWriteItemResult]
val dynamoRequest = mock[BatchWriteItemRequest]
Expand Down Expand Up @@ -108,7 +108,7 @@ class DynamoDBRecordSetRepositorySpec
}

"returns a future failure if any batch fails" in {
val changes = for (i <- 0 to 52) yield pendingCreateAAAA
val changes = for (_ <- 0 to 52) yield pendingCreateAAAA
val dynamoResponse = mock[BatchWriteItemResult]
val unprocessed = mock[java.util.Map[String, AttributeValue]]
doReturn(null).when(unprocessed).get(anyString())
Expand Down