@Test public void assertEnableWithInvalidPath() { cloudJobDisableListener.event(CuratorCacheListener.Type.NODE_DELETED, new ChildData("/other/test_job", null, "".getBytes()), new ChildData("/other/test_job", null, "".getBytes())); verify(producerManager, times(0)).unschedule(ArgumentMatchers.any()); verify(producerManager, times(0)).reschedule(ArgumentMatchers.any()); }
@Override public void event(final Type type, final ChildData oldData, final ChildData data) { String path = Type.NODE_DELETED == type ? oldData.getPath() : data.getPath(); if (Type.NODE_CREATED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.unschedule(jobName); } } else if (Type.NODE_DELETED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.reschedule(jobName); } } }
CloudJobDisableListener implements CuratorCacheListener { @Override public void event(final Type type, final ChildData oldData, final ChildData data) { String path = Type.NODE_DELETED == type ? oldData.getPath() : data.getPath(); if (Type.NODE_CREATED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.unschedule(jobName); } } else if (Type.NODE_DELETED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.reschedule(jobName); } } } }
CloudJobDisableListener implements CuratorCacheListener { @Override public void event(final Type type, final ChildData oldData, final ChildData data) { String path = Type.NODE_DELETED == type ? oldData.getPath() : data.getPath(); if (Type.NODE_CREATED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.unschedule(jobName); } } else if (Type.NODE_DELETED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.reschedule(jobName); } } } CloudJobDisableListener(final CoordinatorRegistryCenter regCenter, final ProducerManager producerManager); }
CloudJobDisableListener implements CuratorCacheListener { @Override public void event(final Type type, final ChildData oldData, final ChildData data) { String path = Type.NODE_DELETED == type ? oldData.getPath() : data.getPath(); if (Type.NODE_CREATED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.unschedule(jobName); } } else if (Type.NODE_DELETED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.reschedule(jobName); } } } CloudJobDisableListener(final CoordinatorRegistryCenter regCenter, final ProducerManager producerManager); @Override void event(final Type type, final ChildData oldData, final ChildData data); void start(); void stop(); }
CloudJobDisableListener implements CuratorCacheListener { @Override public void event(final Type type, final ChildData oldData, final ChildData data) { String path = Type.NODE_DELETED == type ? oldData.getPath() : data.getPath(); if (Type.NODE_CREATED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.unschedule(jobName); } } else if (Type.NODE_DELETED == type && isJobDisableNode(path)) { String jobName = path.substring(DisableJobNode.ROOT.length() + 1); if (Objects.nonNull(jobName)) { producerManager.reschedule(jobName); } } } CloudJobDisableListener(final CoordinatorRegistryCenter regCenter, final ProducerManager producerManager); @Override void event(final Type type, final ChildData oldData, final ChildData data); void start(); void stop();  }