Add some unit tests

Refactor v1 api and archiver
Change-Id: I193023dd8eca4f8cc665a29a6b86698bb38edc83