[
https://issues.apache.org/jira/browse/SPARK-22045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16169302#comment-16169302
]
bluejoe commented on SPARK-22045:
-
when testing spark streaming like:
{code:java}
val lines = spark.readStream
.format("socket")
.option("host", "localhost")
.option("port", )
.load()
{code}
we have to start netcat in command line first:
{code:java}
$ nc -lk
{code}
also our test program can not get what users imput in the nc shell
so I wrote this MockNetCat class
developers can start a mock NetCat server and send data to the server
(simulating user input text in the nc shell)
> creating and starting a NetCat in test case programmatically
>
>
> Key: SPARK-22045
> URL: https://issues.apache.org/jira/browse/SPARK-22045
> Project: Spark
> Issue Type: New Feature
> Components: Tests
>Affects Versions: 2.2.0
>Reporter: bluejoe
> Labels: netcat
>
> hi, all
> I have written a MockNetCat class, which help developers start a netcat
> programmatically, instead of manually launching
> {code:java}
> nc -lk
> {code}
> command for test
> also I completed a MockNetCatTest class, a JUnit 4 test case which test
> MockNetCat
> use of MockNetCat is very simple, like:
> {code:java}
> var nc: MockNetCat = MockNetCat.start();
> {code}
> this starts a NetCat server, and data can be generated using following code:
> {code:java}
> nc.writeData("hello\r\nworld\r\nbye\r\nworld\r\n");
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
-
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org