@Test public void localResources() throws Exception { this.resourceFactory.setUseGlobalResources(false); this.resourceFactory.afterPropertiesSet(); ConnectionProvider connectionProvider = this.resourceFactory.getConnectionProvider(); LoopResources loopResources = this.resourceFactory.getLoopResources(); assertNotSame(HttpResources.get(), connectionProvider); assertNotSame(HttpResources.get(), loopResources); // The below does not work since ConnectionPoolProvider simply checks if pool is empty. // assertFalse(connectionProvider.isDisposed()); assertFalse(loopResources.isDisposed()); this.resourceFactory.destroy(); assertTrue(connectionProvider.isDisposed()); assertTrue(loopResources.isDisposed()); }
@Override public boolean isDisposed() { return defaultLoops.isDisposed() && defaultProvider.isDisposed(); }
@Override public boolean isDisposed() { return defaultLoops.isDisposed() && defaultProvider.isDisposed(); }
@Test public void testIssue416() { TestResources resources = TestResources.get(); TestResources.set(ConnectionProvider.fixed("test")); assertThat(resources.provider.isDisposed()).isTrue(); assertThat(resources.loops.isDisposed()).isFalse(); TestResources.set(LoopResources.create("test")); assertThat(resources.loops.isDisposed()).isTrue(); assertThat(resources.isDisposed()).isTrue(); }