CDK-572. Add tests. Support overwrite and append.