Search in sources :

Example 1 with ServiceCache

use of org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache in project pdi-dataservice-server-plugin by pentaho.

the class ServiceCacheController method initBindings.

public void initBindings(DataServiceModel model) {
    PushDownOptimizationMeta meta = locateServiceCacheMeta(model);
    ServiceCache serviceCache = (ServiceCache) meta.getType();
    BindingFactory bindingFactory = getBindingFactory();
    XulRadio normalModeRadio = getElementById("regular-type-radio");
    XulTab serviceCacheTab = getElementById("service-cache-tab");
    XulCheckbox serviceCacheCheckBox = getElementById("service-cache-checkbox");
    XulTextbox serviceCacheTextBox = getElementById("service-cache-ttl");
    bindingFactory.setBindingType(Binding.Type.ONE_WAY);
    serviceCacheCheckBox.setChecked(meta.isEnabled());
    serviceCacheTab.setVisible(!model.isStreaming());
    try {
        serviceCacheTextBox.setValue(serviceCache.getConfiguredTimeToLive());
    } catch (Exception e) {
        getLogChannel().logError("Unable to set default TTL", e);
    }
    bindingFactory.createBinding(serviceCacheTextBox, "value", serviceCache, "timeToLive");
    bindingFactory.createBinding(serviceCacheCheckBox, "checked", meta, "enabled");
    bindingFactory.createBinding(serviceCacheCheckBox, "checked", serviceCacheTextBox, "disabled", not());
    bindingFactory.createBinding(normalModeRadio, "selected", serviceCacheTab, "visible");
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) XulRadio(org.pentaho.ui.xul.components.XulRadio) ServiceCache(org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) XulTab(org.pentaho.ui.xul.components.XulTab) BindingFactory(org.pentaho.ui.xul.binding.BindingFactory)

Example 2 with ServiceCache

use of org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceMetaFactoryTest method setup.

@Before
public void setup() {
    factory = spy(new DataServiceMetaFactory(() -> spoon));
    factory.setCacheFactory(cacheFactory);
    when(dataServiceContext.getDataServiceDelegate()).thenReturn(dataServiceDelegate);
    when(dataServiceDelegate.createSyncService()).thenReturn(synchronizationListener);
    when(dataServiceDelegate.getSpoon()).thenReturn(mockSpoon);
    when(transMeta.getName()).thenReturn(transName);
    when(cacheFactory.createPushDown()).thenReturn(new ServiceCache(cacheFactory));
    when(stepMeta.getName()).thenReturn(stepName);
    when(stepMeta.getParentTransMeta()).thenReturn(transMeta);
    when(spoon.getActiveTransformation()).thenReturn(activeTransMeta);
}
Also used : ServiceCache(org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache) Before(org.junit.Before)

Aggregations

ServiceCache (org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache)2 Before (org.junit.Before)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 BindingFactory (org.pentaho.ui.xul.binding.BindingFactory)1 XulCheckbox (org.pentaho.ui.xul.components.XulCheckbox)1 XulRadio (org.pentaho.ui.xul.components.XulRadio)1 XulTab (org.pentaho.ui.xul.components.XulTab)1 XulTextbox (org.pentaho.ui.xul.components.XulTextbox)1