DIServerConfig extends SlaveServerConfig { @Override public DelegatingMetaStore getMetaStore() { DelegatingMetaStore metaStore = super.getMetaStore(); try { Repository configuredRepository = super.getRepository(); if ( configuredRepository == null && repositoryInProcess() ) { Repository inProcessRepository = connectInProcessRepository(); if ( inProcessRepository != null ) { metaStore = new DelegatingMetaStore( inProcessRepository.getMetaStore() ); metaStore.setActiveMetaStoreName( inProcessRepository.getMetaStore().getName() ); } } } catch ( Exception e ) { Logger.warn( this, e.getMessage(), e ); metaStore = super.getMetaStore(); } return metaStore; } DIServerConfig( LogChannel logChannel, Node configNode );  DIServerConfig( LogChannel logChannel, Node configNode, PluginRegistry pluginRegistry ); @Override Repository getRepository(); @Override DelegatingMetaStore getMetaStore(); static final String SINGLE_DI_SERVER_INSTANCE; static final String PUR_REPOSITORY_PLUGIN_ID; }
@Test public void testGetMetaStoreWithDefault() throws Exception { DIServerConfig diConfig = new DIServerConfig( logChannel, getConfigNode(), pluginRegistry ); DelegatingMetaStore delegatingMetaStore = diConfig.getMetaStore(); assertEquals( purMetaStore, delegatingMetaStore.getActiveMetaStore() ); verifyConnection(); }
@Test public void testGetMetaStoreWithConfig() throws Exception { Repository repo = mock( Repository.class ); DelegatingMetaStore delegatingMetaStore = mock( DelegatingMetaStore.class ); DIServerConfig diConfig = new DIServerConfig( logChannel, getConfigNode(), pluginRegistry ); diConfig.setRepository( repo ); diConfig.setMetaStore( delegatingMetaStore ); assertEquals( delegatingMetaStore, diConfig.getMetaStore() ); verifyNoMoreInteractions( delegatingMetaStore ); verify( purRepository, never() ).init( any( RepositoryMeta.class ) ); verify( purRepository, never() ).connect( anyString(), anyString() ); }