This is an automated email from the ASF dual-hosted git repository. chetanm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push: new 6fdc7ce Use `linesIterator` instead of String.lines (#4495) 6fdc7ce is described below commit 6fdc7ce93d7d54a9489ba45f0267e98f45a9c07e Author: Chetan Mehrotra <chet...@apache.org> AuthorDate: Tue May 28 20:05:12 2019 +0530 Use `linesIterator` instead of String.lines (#4495) `lines` method is now defined as part of java.lang.String in JDK 11. So need to use `linesIterator` for right method to be picked --- .../openwhisk/core/containerpool/docker/DockerClient.scala | 2 +- tests/src/test/scala/common/StreamLogging.scala | 2 +- tests/src/test/scala/common/WskCliOperations.scala | 2 +- .../org/apache/openwhisk/core/admin/WskAdminTests.scala | 12 ++++++------ .../openwhisk/core/controller/test/WebActionsApiTests.scala | 2 +- .../openwhisk/core/database/test/ReplicatorTests.scala | 4 ++-- tests/src/test/scala/system/basic/WskRuleTests.scala | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/DockerClient.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/DockerClient.scala index db42d93..d204258 100644 --- a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/DockerClient.scala +++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/DockerClient.scala @@ -176,7 +176,7 @@ class DockerClient(dockerHost: Option[String] = None, val filterArgs = filters.flatMap { case (attr, value) => Seq("--filter", s"$attr=$value") } val allArg = if (all) Seq("--all") else Seq.empty[String] val cmd = Seq("ps", "--quiet", "--no-trunc") ++ allArg ++ filterArgs - runCmd(cmd, config.timeouts.ps).map(_.lines.toSeq.map(ContainerId.apply)) + runCmd(cmd, config.timeouts.ps).map(_.linesIterator.toSeq.map(ContainerId.apply)) } /** diff --git a/tests/src/test/scala/common/StreamLogging.scala b/tests/src/test/scala/common/StreamLogging.scala index 4e30e46..aff12a1 100644 --- a/tests/src/test/scala/common/StreamLogging.scala +++ b/tests/src/test/scala/common/StreamLogging.scala @@ -35,5 +35,5 @@ trait StreamLogging { lazy val printstream = new PrintStream(stream) implicit lazy val logging: Logging = new PrintStreamLogging(printstream) - def logLines = new String(stream.toByteArray, StandardCharsets.UTF_8).lines.toList + def logLines = new String(stream.toByteArray, StandardCharsets.UTF_8).linesIterator.toList } diff --git a/tests/src/test/scala/common/WskCliOperations.scala b/tests/src/test/scala/common/WskCliOperations.scala index 137cf9e..3dea0cd 100644 --- a/tests/src/test/scala/common/WskCliOperations.scala +++ b/tests/src/test/scala/common/WskCliOperations.scala @@ -709,7 +709,7 @@ class CliNamespaceOperations(override val wsk: RunCliCmd) */ override def whois()(implicit wskprops: WskProps): String = { // the invariant that list() returns a conforming result is enforced in WskRestBasicTests - val ns = list().stdout.lines.toSeq.last.trim + val ns = list().stdout.linesIterator.toSeq.last.trim assert(ns != "_") // this is not permitted ns } diff --git a/tests/src/test/scala/org/apache/openwhisk/core/admin/WskAdminTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/admin/WskAdminTests.scala index d499d43..0ef03b2 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/admin/WskAdminTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/admin/WskAdminTests.scala @@ -133,7 +133,7 @@ class WskAdminTests extends TestHelpers with WskActorSystem with Matchers with B // reverse lookup by namespace val out = wskadmin.cli(Seq("user", "list", "-p", "2", "-k", commonNamespace)).stdout.trim out should include(auth.compact) - out.lines should have size 2 + out.linesIterator should have size 2 }, 10, Some(1.second)) // block the user @@ -141,7 +141,7 @@ class WskAdminTests extends TestHelpers with WskActorSystem with Matchers with B // wait until the user can no longer be found org.apache.openwhisk.utils.retry({ - wskadmin.cli(Seq("user", "list", "-p", "2", "-k", commonNamespace)).stdout.trim.lines should have size 1 + wskadmin.cli(Seq("user", "list", "-p", "2", "-k", commonNamespace)).stdout.trim.linesIterator should have size 1 }, 10, Some(1.second)) // unblock the user @@ -151,7 +151,7 @@ class WskAdminTests extends TestHelpers with WskActorSystem with Matchers with B org.apache.openwhisk.utils.retry({ val out = wskadmin.cli(Seq("user", "list", "-p", "2", "-k", commonNamespace)).stdout.trim out should include(auth.compact) - out.lines should have size 2 + out.linesIterator should have size 2 }, 10, Some(1.second)) } finally { wskadmin.cli(Seq("user", "delete", subject1)).stdout should include("Subject deleted") @@ -220,7 +220,7 @@ class WskAdminTests extends TestHelpers with WskActorSystem with Matchers with B "--concurrentInvocations", "3")) // check correctly set - val lines = wskadmin.cli(Seq("limits", "get", subject)).stdout.lines.toSeq + val lines = wskadmin.cli(Seq("limits", "get", subject)).stdout.linesIterator.toSeq lines should have size 3 lines(0) shouldBe "invocationsPerMinute = 1" lines(1) shouldBe "firesPerMinute = 2" @@ -236,7 +236,7 @@ class WskAdminTests extends TestHelpers with WskActorSystem with Matchers with B // set limit wskadmin.cli(Seq("limits", "set", subject, "--storeActivations", "false")) // check correctly set - val lines = wskadmin.cli(Seq("limits", "get", subject)).stdout.lines.toSeq + val lines = wskadmin.cli(Seq("limits", "get", subject)).stdout.linesIterator.toSeq lines should have size 1 lines(0) shouldBe "storeActivations = False" } finally { @@ -250,7 +250,7 @@ class WskAdminTests extends TestHelpers with WskActorSystem with Matchers with B // set some limits wskadmin.cli(Seq("limits", "set", subject, "--allowedKinds", "nodejs:6", "blackbox")) // check correctly set - val lines = wskadmin.cli(Seq("limits", "get", subject)).stdout.lines.toSeq + val lines = wskadmin.cli(Seq("limits", "get", subject)).stdout.linesIterator.toSeq lines should have size 1 lines(0) shouldBe "allowedKinds = [u'nodejs:6', u'blackbox']" } finally { diff --git a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala index 54bae23..591ebd4 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala @@ -887,7 +887,7 @@ trait WebActionsApiBaseTests extends ControllerTestCommon with BeforeAndAfterEac status should be(NotFound) confirmErrorWithTid(responseAs[JsObject], Some(Messages.propertyNotFound)) // ensure that error message is pretty printed as { error, code } - responseAs[String].lines should have size 4 + responseAs[String].linesIterator should have size 4 } } } diff --git a/tests/src/test/scala/org/apache/openwhisk/core/database/test/ReplicatorTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/database/test/ReplicatorTests.scala index 5f1bdad..37ba7ca 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/database/test/ReplicatorTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/database/test/ReplicatorTests.scala @@ -100,7 +100,7 @@ class ReplicatorTests val Seq(created, deletedDoc, deleted) = Seq("create backup: ", "deleting backup document: ", "deleting backup: ").map { prefix => - rr.stdout.lines.collect { + rr.stdout.linesIterator.collect { case line if line.startsWith(prefix) => line.replace(prefix, "") }.toList } @@ -129,7 +129,7 @@ class ReplicatorTests dbPrefix) val line = """([\w-]+) -> ([\w-]+) \(([\w-]+)\)""".r.unanchored - val replays = rr.stdout.lines.collect { + val replays = rr.stdout.linesIterator.collect { case line(backup, target, id) => (backup, target, id) }.toList diff --git a/tests/src/test/scala/system/basic/WskRuleTests.scala b/tests/src/test/scala/system/basic/WskRuleTests.scala index e332aaa..77179f7 100644 --- a/tests/src/test/scala/system/basic/WskRuleTests.scala +++ b/tests/src/test/scala/system/basic/WskRuleTests.scala @@ -385,7 +385,7 @@ abstract class WskRuleTests extends TestHelpers with WskTestHelpers { def verifyRuleList(ruleListResult: RunResult, ruleNameEnable: String, ruleName: String) = { val ruleList = ruleListResult.stdout - val listOutput = ruleList.lines + val listOutput = ruleList.linesIterator listOutput.find(_.contains(ruleNameEnable)).get should (include(ruleNameEnable) and include("active")) listOutput.find(_.contains(ruleName)).get should (include(ruleName) and include("inactive")) ruleList should not include "Unknown"