DatastoreStorage implements Closeable { boolean enabled(WorkflowId workflowId) throws IOException { return getWorkflowOpt(datastore, datastore::newKeyFactory, workflowId) .filter(w -> w.contains(PROPERTY_WORKFLOW_ENABLED)) .map(workflow -> workflow.getBoolean(PROPERTY_WORKFLOW_ENABLED)) .orElse(DEFAULT_WORKFLOW_ENABLED); } DatastoreStorage(CheckedDatastore datastore); @VisibleForTesting  DatastoreStorage(CheckedDatastore datastore,
                   Function<CheckedDatastoreTransaction, DatastoreStorageTransaction> storageTransactionFactory,
                   ExecutorService executor, Logger log); @Override void close(); void updateNextNaturalTrigger(WorkflowId workflowId, TriggerInstantSpec triggerSpec); Map<WorkflowId, Workflow> workflows(); Map<WorkflowId, Workflow> workflows(Set<WorkflowId> workflowIds); List<Workflow> workflows(String componentId); T runInTransactionWithRetries(TransactionFunction<T, E> f);  }
@Test public void workflowShouldBeDisabledByDefault() throws Exception { boolean enabled = storage.enabled(WORKFLOW_ID1); assertFalse(enabled); }