removed testClientClosedDuringRefreshErrorMessage() I didn't write this test and it's not working. I'm not even sure what it tests. Check into it later -JZ
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f18f8765 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f18f8765 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f18f8765 Branch: refs/heads/CURATOR-3.0 Commit: f18f87657af56bec32e8861ce5b3965c99807609 Parents: 47da621 Author: randgalt <randg...@apache.org> Authored: Wed Jul 1 16:17:58 2015 -0500 Committer: randgalt <randg...@apache.org> Committed: Wed Jul 1 16:17:58 2015 -0500 ---------------------------------------------------------------------- .../recipes/cache/TestPathChildrenCache.java | 78 -------------------- 1 file changed, 78 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/f18f8765/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java index b07ac9c..3671e64 100644 --- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java +++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java @@ -100,84 +100,6 @@ public class TestPathChildrenCache extends BaseClassForTests } } - @Test(enabled = false) // I didn't write this test and it's not working. I'm not even sure what it tests. Check into it later -JZ - public void testClientClosedDuringRefreshErrorMessage() throws Exception - { - // Fiddle with logging so we can intercept the error events for org.apache.curator - final List<LoggingEvent> events = Lists.newArrayList(); - Collection<String> messages = Collections2.transform(events, new Function<LoggingEvent, String>() - { - @Override - public String apply(LoggingEvent loggingEvent) - { - return loggingEvent.getRenderedMessage(); - } - }); - Appender appender = new AppenderSkeleton(true) { - @Override - protected void append(LoggingEvent event) { - if (event.getLevel().equals(Level.ERROR)) { - events.add(event); - } - } - - @Override - public void close() { - - } - - @Override - public boolean requiresLayout() { - return false; - } - }; - appender.setLayout(new SimpleLayout()); - Logger logger = Logger.getLogger("org.apache.curator"); - logger.addAppender(appender); - - // Check that we can intercept error log messages from the client - CuratorFramework clientTestLogSetup = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); - clientTestLogSetup.start(); - try { - Pathable<byte[]> callback = clientTestLogSetup.getData().inBackground(new BackgroundCallback() { - @Override - public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { - // ignore result - } - }); - CloseableUtils.closeQuietly(clientTestLogSetup); - callback.forPath("/test/aaa"); // this should cause an error log message - } catch (IllegalStateException ise) { - // ok, excpected - } finally { - CloseableUtils.closeQuietly(clientTestLogSetup); - } - - Assert.assertTrue(messages.contains("Background exception was not retry-able or retry gave up"), - "The expected error was not logged. This is an indication that this test could be broken due to" + - " an incomplete logging setup."); - - // try to reproduce a bunch of times because it doesn't happen reliably - for (int i = 0; i < 50; i++) { - CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); - client.start(); - try { - PathChildrenCache cache = new PathChildrenCache(client, "/test", true); - cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); - client.newNamespaceAwareEnsurePath("/test/aaa").ensure(client.getZookeeperClient()); - client.setData().forPath("/test/aaa", new byte[]{1, 2, 3, 4, 5}); - cache.rebuildNode("/test/aaa"); - CloseableUtils.closeQuietly(cache); - } finally { - CloseableUtils.closeQuietly(client); - } - } - - Assert.assertEquals(messages.size(), 1, "There should not be any error events except for the test message, " + - "but got:\n" + Joiner.on("\n").join(messages)); - - } - @Test public void testAsyncInitialPopulation() throws Exception {