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");
}
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);
}
Aggregations