Re: Testing RichAsyncFunction with TestHarness

Posted by KristoffSC on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Testing-RichAsyncFunction-with-TestHarness-tp33947p33954.html

I think I got this to work, although with "nasty" workaround.

I've debugged that configuration for this testHarnes operator was missing
two entries:
"edgesInOrder"
"typeSerializer_in_1"

I added conditional break points to InstantiationUtils.readObjectFromConfig
method for those two keys and I ran my "real" FlinkJob from IntelliJ.

I saw that for "edgesInOrder" an empty array of StreamEdge object was added
and for  "typeSerializer_in_1" the instance of PojoSerializer class.

I took the byte[] for those two and simply added those to arrays to my
TestHarnes setup under appropriate keys, like this:

    Configuration configuration = new Configuration();
    configuration.setBytes("edgesInOrder", emptyEdgesListBytes);
    configuration.setBytes("typeSerializer_in_1", pojoSerializerBytes);
   
    MockEnvironment environment = MockEnvironment.builder().build();
    environment.getTaskConfiguration().addAll(configuration);

Then I used this mock environment to initialize
OneInputStreamOperatorTestHarness for AsyncWaitOperator.

That seems work, but its a workaround though.






--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/