flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nikste <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2613] Print usage information for Scala...
Date Thu, 08 Oct 2015 15:05:32 GMT
Github user nikste commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1106#discussion_r41525031
  
    --- Diff: flink-staging/flink-scala-shell/src/test/scala/org/apache/flink/api/scala/ScalaShellITSuite.scala
---
    @@ -225,8 +223,50 @@ class ScalaShellITSuite extends FunSuite with Matchers with BeforeAndAfterAll
{
         out.toString + stdout
       }
     
    -  var cluster: Option[ForkableFlinkMiniCluster] = None
    -  val parallelism = 4
    +  /**
    +   * tests flink shell startup with remote cluster (starts cluster internally)
    +   */
    +  test("start flink scala shell with remote cluster") {
    +
    +    val input: String = "val els = env.fromElements(\"a\",\"b\");\n" +
    +      "els.print\nError\n:q\n"
    +
    +    val in: BufferedReader = new BufferedReader(
    +      new StringReader(
    +        input + "\n"))
    +    val out: StringWriter = new StringWriter
    +
    +    val baos: ByteArrayOutputStream = new ByteArrayOutputStream
    +    val oldOut: PrintStream = System.out
    +    System.setOut(new PrintStream(baos))
    +
    +    val (c, args) = cluster match{
    +      case Some(cl) =>
    +        val arg = Array("remote",
    +          cl.hostname,
    +          Integer.toString(cl.getLeaderRPCPort))
    +        (cl, arg)
    +      case None =>
    +        fail("Cluster creation failed!")
    +    }
    +
    +    //start scala shell with initialized
    +    // buffered reader for testing
    +    FlinkShell.bufferedReader = Some(in)
    +    FlinkShell.main(args)
    +    baos.flush
    --- End diff --
    
    Actually the official reasoning is if it has some "side-effects" it should have some parenthesis
(which it does in this case)
    http://docs.scala-lang.org/style/method-invocation.html


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message