Search in sources :

Example 6 with DelegatingMetaStore

use of org.pentaho.metastore.stores.delegate.DelegatingMetaStore in project pentaho-platform by pentaho.

the class DIServerConfigTest method testGetMetaStoreWithConfig.

@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());
}
Also used : RepositoryMeta(org.pentaho.di.repository.RepositoryMeta) Repository(org.pentaho.di.repository.Repository) DelegatingMetaStore(org.pentaho.metastore.stores.delegate.DelegatingMetaStore) Test(org.junit.Test)

Example 7 with DelegatingMetaStore

use of org.pentaho.metastore.stores.delegate.DelegatingMetaStore in project pentaho-platform by pentaho.

the class DIServerConfig method getMetaStore.

@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) {
        // Something failed, give up and use default
        Logger.warn(this, e.getMessage(), e);
        metaStore = super.getMetaStore();
    }
    return metaStore;
}
Also used : Repository(org.pentaho.di.repository.Repository) DelegatingMetaStore(org.pentaho.metastore.stores.delegate.DelegatingMetaStore) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Aggregations

DelegatingMetaStore (org.pentaho.metastore.stores.delegate.DelegatingMetaStore)7 Test (org.junit.Test)3 Repository (org.pentaho.di.repository.Repository)3 Matchers.anyString (org.mockito.Matchers.anyString)2 KettleException (org.pentaho.di.core.exception.KettleException)2 RepositoryMeta (org.pentaho.di.repository.RepositoryMeta)2 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Callable (java.util.concurrent.Callable)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1 Future (java.util.concurrent.Future)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 KettlePluginException (org.pentaho.di.core.exception.KettlePluginException)1 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)1 FileLoggingEventListener (org.pentaho.di.core.logging.FileLoggingEventListener)1 LogChannel (org.pentaho.di.core.logging.LogChannel)1 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)1