diff --git a/pom.xml b/pom.xml
index c0cc6ea3..c7ed39c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,6 @@
1.8
2.7.7
1.3.2
- 3.6.2
1.0.0
1.3.0
1.01
@@ -211,7 +210,7 @@
org.assertj
assertj-core
- ${assertj.version}
+ ${assertj}
test
diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/support/RegionDataAccessTracingAspect.java b/src/main/java/org/springframework/data/gemfire/config/annotation/support/RegionDataAccessTracingAspect.java
index 466e7b67..a71d9139 100644
--- a/src/main/java/org/springframework/data/gemfire/config/annotation/support/RegionDataAccessTracingAspect.java
+++ b/src/main/java/org/springframework/data/gemfire/config/annotation/support/RegionDataAccessTracingAspect.java
@@ -18,12 +18,15 @@ package org.springframework.data.gemfire.config.annotation.support;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.util.Optional;
+import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.util.ObjectUtils;
/**
* The RegionDataAccessTracingAspect class...
@@ -58,26 +61,48 @@ public class RegionDataAccessTracingAspect {
}
/* (non-Javadoc) */
- @Pointcut("target(com.gemstone.gemfire.cache.Region)")
+ @Pointcut("target(org.apache.geode.cache.Region)")
private void regionPointcut() {}
/* (non-Javadoc) */
- @Pointcut("execution(* com.gemstone.gemfire.cache.Region.create(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.get(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.getAll(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.put(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.putAll(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.putIfAbsent(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.remove(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.replace(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.selectValue(..))"
- + " || execution(* com.gemstone.gemfire.cache.Region.values(..))"
+ @Pointcut("execution(* org.apache.geode.cache.Region.create(..))"
+ + " || execution(* org.apache.geode.cache.Region.get(..))"
+ + " || execution(* org.apache.geode.cache.Region.getAll(..))"
+ + " || execution(* org.apache.geode.cache.Region.getEntry(..))"
+ + " || execution(* org.apache.geode.cache.Region.invalidate(..))"
+ + " || execution(* org.apache.geode.cache.Region.keySet())"
+ + " || execution(* org.apache.geode.cache.Region.keySetOnServer())"
+ + " || execution(* org.apache.geode.cache.Region.localClear())"
+ + " || execution(* org.apache.geode.cache.Region.localDestroy(..))"
+ + " || execution(* org.apache.geode.cache.Region.localInvalidate(..))"
+ + " || execution(* org.apache.geode.cache.Region.put(..))"
+ + " || execution(* org.apache.geode.cache.Region.putAll(..))"
+ + " || execution(* org.apache.geode.cache.Region.putIfAbsent(..))"
+ + " || execution(* org.apache.geode.cache.Region.query(..))"
+ + " || execution(* org.apache.geode.cache.Region.remove(..))"
+ + " || execution(* org.apache.geode.cache.Region.removeAll(..))"
+ + " || execution(* org.apache.geode.cache.Region.replace(..))"
+ + " || execution(* org.apache.geode.cache.Region.selectValue(..))"
+ + " || execution(* org.apache.geode.cache.Region.size())"
+ + " || execution(* org.apache.geode.cache.Region.sizeOnServer())"
+ + " || execution(* org.apache.geode.cache.Region.values(..))"
+ "")
private void regionDataAccessPointcut() {}
/* (non-Javadoc) */
@Before("regionPointcut() && regionDataAccessPointcut()")
- public void regionDataAccessTracingAdvice() {
- getLogger().trace("Region data access call [{}]", getCurrentThreadStackTrace());
+ public void regionDataAccessTracingAdvice(JoinPoint joinPoint) {
+ getLogger().trace("Region data access call [{}(..)] with stack trace [{}]",
+ toRegionMethodSignature(joinPoint), getCurrentThreadStackTrace());
+ }
+
+ /* (non-Javadoc) */
+ private String toRegionMethodSignature(JoinPoint joinPoint) {
+
+ return Optional.ofNullable(joinPoint)
+ .map(JoinPoint::getSignature)
+ .map(signature ->
+ String.format("%1$s.%2$s", ObjectUtils.nullSafeClassName(joinPoint.getTarget()), signature.getName()))
+ .orElse("");
}
}
diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/RegionDataAccessTracingAspectUnitTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/RegionDataAccessTracingAspectUnitTests.java
new file mode 100644
index 00000000..62439379
--- /dev/null
+++ b/src/test/java/org/springframework/data/gemfire/config/annotation/RegionDataAccessTracingAspectUnitTests.java
@@ -0,0 +1,516 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.data.gemfire.config.annotation;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.annotation.Resource;
+
+import org.apache.geode.cache.GemFireCache;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.ClientRegionShortcut;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
+import org.springframework.data.gemfire.config.annotation.support.RegionDataAccessTracingAspect;
+import org.springframework.data.gemfire.test.logging.slf4j.logback.TestAppender;
+import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.util.ClassUtils;
+
+/**
+ * Unit tests for {@link RegionDataAccessTracingAspect}.
+ *
+ * @author John Blum
+ * @see org.junit.Test
+ * @see org.apache.geode.cache.GemFireCache
+ * @see org.apache.geode.cache.Region
+ * @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
+ * @see org.springframework.data.gemfire.config.annotation.support.RegionDataAccessTracingAspect
+ * @see org.springframework.data.gemfire.test.logging.slf4j.logback.TestAppender
+ * @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
+ * @see org.springframework.test.context.ContextConfiguration
+ * @see org.springframework.test.context.junit4.SpringRunner
+ * @since 2.0.2
+ */
+@RunWith(SpringRunner.class)
+@ContextConfiguration
+public class RegionDataAccessTracingAspectUnitTests {
+
+ private static final String LOGBACK_LOGGER_CLASS_NAME = "ch.qos.logback.classic.Logger";
+
+ @BeforeClass
+ public static void setupBeforeTestSuite() {
+ assumeLogbackIsPresent();
+ }
+
+ private static void assumeLogbackIsPresent() {
+ Assume.assumeTrue(String.format("Ignoring test class [%s]; Logback is not on the classpath",
+ RegionDataAccessTracingAspectUnitTests.class.getName()), ClassUtils.isPresent(LOGBACK_LOGGER_CLASS_NAME,
+ Thread.currentThread().getContextClassLoader()));
+ }
+
+ @Resource(name = "ClientRegion")
+ @SuppressWarnings("all")
+ private Region