@NonNull private Observable<RxBleScanResult> createScanOperation(@Nullable final UUID[] filterServiceUUIDs) { return discoveredDevicesSubject .filter(new Predicate<RxBleDeviceMock>() { @Override public boolean test(RxBleDeviceMock rxBleDevice) { return RxBleClientMock.this.filterDevice(rxBleDevice, filterServiceUUIDs); } }) .map(new Function<RxBleDeviceMock, RxBleScanResult>() { @Override public RxBleScanResult apply(RxBleDeviceMock rxBleDeviceMock) { return RxBleClientMock.this.createRxBleScanResult(rxBleDeviceMock); } }); }
@Override public RxBleDevice getBleDevice(@NonNull final String macAddress) { RxBleDevice rxBleDevice = discoveredDevicesSubject .filter(new Predicate<RxBleDeviceMock>() { @Override public boolean test(RxBleDeviceMock device) { return device.getMacAddress().equals(macAddress); } }) .firstOrError() .blockingGet(); if (rxBleDevice == null) { throw new IllegalStateException("Mock is not configured for a given mac address. Use Builder#addDevice method."); } return rxBleDevice; }
/** * Run queued on triggers (i.e. @OnCreatePreSecurity, @OnUpdatePreSecurity, etc.) */ public void runQueuedPreSecurityTriggers() { this.queuedLifecycleEvents .filter(CRUDEvent::isCreateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnCreatePreSecurity.class, false)) .throwOnError(); }
/** * Run queued on triggers (i.e. @OnCreatePreSecurity, @OnUpdatePreSecurity, etc.) */ public void runQueuedPreSecurityTriggers() { this.queuedLifecycleEvents .filter(CRUDEvent::isCreateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnCreatePreSecurity.class, false)) .throwOnError(); }
/** * Run queued pre triggers (i.e. @OnCreatePreCommit, @OnUpdatePreCommit, etc.) */ public void runQueuedPreCommitTriggers() { this.queuedLifecycleEvents .filter(CRUDEvent::isCreateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnCreatePreCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isUpdateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnUpdatePreCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isDeleteEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnDeletePreCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isReadEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnReadPreCommit.class, false)) .throwOnError(); }
/** * Run queued post triggers (i.e. @OnCreatePostCommit, @OnUpdatePostCommit, etc.) */ public void runQueuedPostCommitTriggers() { this.queuedLifecycleEvents .filter(CRUDEvent::isCreateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnCreatePostCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isUpdateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnUpdatePostCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isDeleteEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnDeletePostCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isReadEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnReadPostCommit.class, false)) .throwOnError(); }
/** * Run queued post triggers (i.e. @OnCreatePostCommit, @OnUpdatePostCommit, etc.) */ public void runQueuedPostCommitTriggers() { this.queuedLifecycleEvents .filter(CRUDEvent::isCreateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnCreatePostCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isUpdateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnUpdatePostCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isDeleteEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnDeletePostCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isReadEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnReadPostCommit.class, false)) .throwOnError(); }
/** * Run queued pre triggers (i.e. @OnCreatePreCommit, @OnUpdatePreCommit, etc.) */ public void runQueuedPreCommitTriggers() { this.queuedLifecycleEvents .filter(CRUDEvent::isCreateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnCreatePreCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isUpdateEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnUpdatePreCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isDeleteEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnDeletePreCommit.class, false)) .throwOnError(); this.queuedLifecycleEvents .filter(CRUDEvent::isReadEvent) .subscribeWith(new LifecycleHookInvoker(dictionary, OnReadPreCommit.class, false)) .throwOnError(); }