Skip to content

Commit

Permalink
ISPN-8647 Initialize all loggers statically in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tristantarrant authored and wburns committed Jan 10, 2018
1 parent 5d33fdb commit 120c755
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 18 deletions.
Expand Up @@ -10,6 +10,7 @@
import static org.testng.AssertJUnit.assertNull;

import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -296,7 +297,7 @@ private void expectElementsInQueue(BlockingQueue<?> queue, int numElements) {
useRawData = true, includeCurrentState = true)
private static class ClientEntryListener {

private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

public final BlockingQueue<FilterResult> createEvents = new LinkedBlockingQueue<>();

Expand Down
Expand Up @@ -10,6 +10,7 @@
import static org.testng.AssertJUnit.assertNull;

import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -313,7 +314,7 @@ private void expectElementsInQueue(BlockingQueue<?> queue, int numElements) {
useRawData = true, includeCurrentState = true)
private static class ClientEntryListener {

private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

public final BlockingQueue<FilterResult> createEvents = new LinkedBlockingQueue<>();

Expand Down
4 changes: 3 additions & 1 deletion core/src/test/java/org/infinispan/api/ClearTest.java
Expand Up @@ -3,6 +3,8 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;

import java.lang.invoke.MethodHandles;

import org.infinispan.AdvancedCache;
import org.infinispan.configuration.cache.BiasAcquisition;
import org.infinispan.configuration.cache.CacheMode;
Expand All @@ -27,7 +29,7 @@
@Test(groups = "functional", testName = "api.ClearTest")
public class ClearTest extends MultipleCacheManagersTest {

protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

protected AdvancedCache<Integer, String> c0;
protected AdvancedCache<Integer, String> c1;
Expand Down
Expand Up @@ -4,6 +4,7 @@
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;

import java.lang.invoke.MethodHandles;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.BrokenBarrierException;
Expand Down Expand Up @@ -42,7 +43,7 @@
@Test(groups = "functional", testName = "api.ConditionalOperationsConcurrentTest")
public class ConditionalOperationsConcurrentTest extends MultipleCacheManagersTest {

private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

@Override
public Object[] factory() {
Expand Down
Expand Up @@ -3,6 +3,7 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;

import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit;

import org.infinispan.Cache;
Expand All @@ -29,7 +30,7 @@
@InCacheMode({CacheMode.DIST_SYNC, CacheMode.REPL_SYNC, CacheMode.SCATTERED_SYNC})
public class ClusterExpirationFunctionalTest extends MultipleCacheManagersTest {

protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

protected ControlledTimeService ts0;
protected ControlledTimeService ts1;
Expand Down
Expand Up @@ -15,6 +15,7 @@
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BrokenBarrierException;
Expand Down Expand Up @@ -512,7 +513,7 @@ private boolean isClustered(StateListener listener) {

protected static abstract class StateListener<K, V> {
final List<CacheEntryEvent<K, V>> events = new ArrayList<>();
private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

@CacheEntryCreated
@CacheEntryModified
Expand Down
Expand Up @@ -14,6 +14,7 @@
import static org.testng.Assert.fail;

import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -663,7 +664,7 @@ private boolean isClustered(StateListener listener) {

protected static abstract class StateListener<K, V> {
final List<CacheEntryEvent<K, V>> events = Collections.synchronizedList(new ArrayList<>());
private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

@CacheEntryCreated
@CacheEntryModified
Expand Down
Expand Up @@ -4,6 +4,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -48,7 +49,7 @@

@Test(groups = "functional", testName = "partitionhandling.BasePartitionHandlingTest")
public class BasePartitionHandlingTest extends MultipleCacheManagersTest {
protected Log log = LogFactory.getLog(getClass());
protected static Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

private final AtomicInteger viewId = new AtomicInteger(5);
protected int numMembersInCluster = 4;
Expand Down
Expand Up @@ -3,6 +3,7 @@
import static org.testng.AssertJUnit.assertTrue;
import static org.testng.AssertJUnit.fail;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
Expand Down Expand Up @@ -56,7 +57,7 @@
@TestSelector(interceptors = AbstractInfinispanTest.OrderByInstance.class)
public class AbstractInfinispanTest {

protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

private final ThreadFactory defaultThreadFactory = getTestThreadFactory("ForkThread");
private final ThreadPoolExecutor defaultExecutorService = new ThreadPoolExecutor(0, Integer.MAX_VALUE,
Expand Down
3 changes: 2 additions & 1 deletion core/src/test/java/org/infinispan/tx/DummyTxTest.java
Expand Up @@ -3,6 +3,7 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;

import java.lang.invoke.MethodHandles;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;

Expand All @@ -28,7 +29,7 @@
@Test(groups = "functional", testName = "tx.DummyTxTest")
public class DummyTxTest extends SingleCacheManagerTest {

protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

protected EmbeddedCacheManager createCacheManager() throws Exception {
EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(false); // also try this test with 'true' so you can tell the difference between DummyTransactionManager and JBoss TM
Expand Down
@@ -1,5 +1,6 @@
package org.infinispan.util;

import java.lang.invoke.MethodHandles;
import java.util.Collection;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -28,7 +29,7 @@
*/
public abstract class AbstractControlledRpcManager implements RpcManager {

protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());
protected final RpcManager realOne;

public AbstractControlledRpcManager(RpcManager realOne) {
Expand Down
@@ -1,5 +1,6 @@
package org.infinispan.test.hibernate.cache.commons.functional;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -54,7 +55,7 @@ public abstract class AbstractNonInvalidationTest extends SingleNodeTest {

protected long TIMEOUT;
protected ExecutorService executor;
protected InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(getClass());
protected static InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(MethodHandles.lookup().lookupClass());
protected AdvancedCache entityCache;
protected long itemId;
protected Region region;
Expand Down
Expand Up @@ -6,6 +6,7 @@
import static org.junit.Assert.assertNull;

import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -154,7 +155,7 @@ private void expectElementsInQueue(BlockingQueue<?> queue, int numElements) {
useRawData = true, includeCurrentState = true)
public static class ClientEntryListener {

private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

public final BlockingQueue<FilterResult> createEvents = new LinkedBlockingQueue<>();

Expand Down
@@ -1,5 +1,6 @@
package org.infinispan.spring.provider.sample;

import java.lang.invoke.MethodHandles;
import java.util.Random;

import org.infinispan.commons.api.BasicCache;
Expand All @@ -25,7 +26,7 @@
@Test(groups = "functional")
public abstract class AbstractTestTemplate extends AbstractTransactionalTestNGSpringContextTests {

protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

@AfterMethod
public void clearBookCache() {
Expand Down
@@ -1,5 +1,6 @@
package org.infinispan.spring.provider.sample.dao;

import java.lang.invoke.MethodHandles;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
Expand Down Expand Up @@ -33,7 +34,7 @@
@Repository(value = "jdbcBookDao")
public class JdbcBookDao implements BaseBookDao {

private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

private NamedParameterJdbcTemplate jdbcTemplate;

Expand Down
@@ -1,5 +1,6 @@
package org.infinispan.spring.provider.sample;

import java.lang.invoke.MethodHandles;
import java.util.Random;

import org.infinispan.commons.api.BasicCache;
Expand Down Expand Up @@ -28,7 +29,7 @@
@Test(groups = "functional")
public abstract class AbstractTestTemplate extends AbstractTransactionalTestNGSpringContextTests {

protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

@BeforeTest(alwaysRun = true)
public void beforeTest() {
Expand Down
@@ -1,5 +1,6 @@
package org.infinispan.spring.provider.sample.dao;

import java.lang.invoke.MethodHandles;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
Expand Down Expand Up @@ -33,7 +34,7 @@
@Repository(value = "jdbcBookDao")
public class JdbcBookDao implements BaseBookDao {

private final Log log = LogFactory.getLog(getClass());
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

private NamedParameterJdbcTemplate jdbcTemplate;

Expand Down
Expand Up @@ -5,6 +5,7 @@
import static org.testng.AssertJUnit.assertTrue;
import static org.testng.AssertJUnit.fail;

import java.lang.invoke.MethodHandles;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.Callable;
Expand Down Expand Up @@ -42,7 +43,7 @@
*/
@Test(groups = "functional", testName = "api.tree.BaseNodeMoveAPITest")
public abstract class BaseNodeMoveAPITest extends SingleCacheManagerTest {
protected final Log log = LogFactory.getLog(getClass());
protected static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

protected static final Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn.fromString("/d"), E = Fqn.fromString("/e");
static final Fqn A_B = Fqn.fromRelativeFqn(A, B);
Expand Down

0 comments on commit 120c755

Please sign in to comment.