public static Function.FunctionMetaData incrMetadataVersion(Function.FunctionMetaData existingMetaData,
                                                                Function.FunctionMetaData updatedMetaData) {
        long version = 0;
        if (existingMetaData != null) {
            version = existingMetaData.getVersion() + 1;
        }
        return updatedMetaData.toBuilder()
                .setVersion(version)
                .build();
    }
@Test
    public void testUpdate() {
        long version = 5;
        Function.FunctionMetaData existingMetaData = Function.FunctionMetaData.newBuilder().setFunctionDetails(
                Function.FunctionDetails.newBuilder().setName("func-1").setParallelism(2)).setVersion(version).build();
        Function.FunctionMetaData updatedMetaData = Function.FunctionMetaData.newBuilder().setFunctionDetails(
                Function.FunctionDetails.newBuilder().setName("func-1").setParallelism(3)).setVersion(version).build();
        Function.FunctionMetaData newMetaData = FunctionMetaDataUtils.incrMetadataVersion(existingMetaData, updatedMetaData);
        Assert.assertEquals(newMetaData.getVersion(), version + 1);
        Assert.assertEquals(newMetaData.getFunctionDetails().getParallelism(), 3);

        newMetaData = FunctionMetaDataUtils.incrMetadataVersion(null, newMetaData);
        Assert.assertEquals(newMetaData.getVersion(), 0);
    }