Binglin Chang commented on YARN-2051:

I thought about this, most of the pb serde validation involves the following 
1. set property to record using value(v0)
2. get proto obj from record
3. create new record from proto obj
4. get property from new record value(v1), validate v0 == v1
This can be automated for all set/get pairs, we just need to use reflection to 
find all get/set pairs of the record class, and test each pair. By doing this, 
we save lots of testing code. In the future when we add new properties to a 
record, no need to add/change the testing code:) 

Note: those record looks like java beans but many of those does not follow 
strict java bean laws, I try to leverage commons-beanutil but it seems it is 
not flexible enough, we make a patch soon.

> Add more unit tests for PBImpl that didn't get covered
> ------------------------------------------------------
>                 Key: YARN-2051
>                 URL: https://issues.apache.org/jira/browse/YARN-2051
>             Project: Hadoop YARN
>          Issue Type: Test
>            Reporter: Junping Du
>            Assignee: Binglin Chang
>            Priority: Critical
> From YARN-2016, we can see some bug could exist in PB implementation of 
> protocol. The bad news is most of these PBImpl don't have any unit test to 
> verify the info is not lost or changed after serialization/deserialization. 
> We should add more tests for it.

This message was sent by Atlassian JIRA

Reply via email to