refactoring and test of CommonPluginManager