SGF-864 - Fix unreliable tests.

This commit is contained in:
John Blum
2019-07-17 02:22:07 -07:00
parent 0fe205acb8
commit 1245548566
9 changed files with 140 additions and 99 deletions

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*
*/
package org.springframework.data.gemfire.search.lucene;
import static java.util.stream.StreamSupport.stream;
@@ -40,6 +39,7 @@ import org.apache.geode.cache.lucene.LuceneSerializer;
import org.apache.geode.cache.lucene.LuceneService;
import org.apache.geode.cache.lucene.LuceneServiceProvider;
import org.apache.lucene.analysis.Analyzer;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
@@ -423,8 +423,12 @@ public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<LuceneInd
*/
@Override
public void setBeanName(String name) {
super.setBeanName(name);
setIndexName(name);
if (!StringUtils.hasText(this.indexName)) {
setIndexName(name);
}
}
/**

View File

@@ -147,6 +147,8 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
List<String> arguments = new ArrayList<String>();
arguments.add("-Dgemfire.name=" + locatorName);
arguments.add("-Dlog4j.geode.log.level=info");
arguments.add("-Dlogback.log.level=info");
arguments.add("-Dspring.data.gemfire.enable-cluster-configuration=true");
arguments.add("-Dspring.data.gemfire.load-cluster-configuration=true");
arguments.add(String.format("-Dgemfire.log-level=%s", LOG_LEVEL));
@@ -266,6 +268,7 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
public void localConfigurationTest() {
try {
newApplicationContext(getLocation("cacheUsingLocalConfigurationIntegrationTest.xml"));
fail("Loading the 'cacheUsingLocalOnlyConfigurationIntegrationTest.xml' Spring ApplicationContext"

View File

@@ -14,7 +14,6 @@
* limitations under the License.
*
*/
package org.springframework.data.gemfire.search.lucene;
import static org.assertj.core.api.Assertions.assertThat;
@@ -29,20 +28,22 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.geode.cache.GemFireCache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.lucene.LuceneService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.data.annotation.Id;
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
import org.springframework.data.gemfire.util.SpringUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
@@ -71,62 +72,33 @@ public class LuceneOperationsIntegrationTests {
private static final AtomicLong IDENTIFIER = new AtomicLong(0L);
protected static final String LOG_LEVEL = "none";
protected static final String GEMFIRE_LOG_LEVEL = "none";
private Person jonDoe;
private Person janeDoe;
private Person cookieDoe;
private Person froDoe;
private Person hoDoe;
private Person pieDoe;
private Person sourDoe;
private static Person jonDoe = Person.newPerson(LocalDate.of(1969, Month.JULY, 4), "Jon", "Doe").with("Master of Science");
private static Person janeDoe = Person.newPerson(LocalDate.of(1969, Month.AUGUST, 16), "Jane", "Doe").with("Doctor of Astrophysics");
private static Person cookieDoe = Person.newPerson(LocalDate.of(1991, Month.APRIL, 2), "Cookie", "Doe").with("Bachelor of Physics");
private static Person froDoe = Person.newPerson(LocalDate.of(1988, Month.MAY, 25), "Fro", "Doe").with("Doctor of Computer Science");
private static Person hoDoe = Person.newPerson(LocalDate.of(1984, Month.NOVEMBER, 11), "Ho", "Doe").with("Doctor of Math");
private static Person pieDoe = Person.newPerson(LocalDate.of(1996, Month.JUNE, 4), "Pie", "Doe").with("Master of Astronomy");
private static Person sourDoe = Person.newPerson(LocalDate.of(1999, Month.DECEMBER, 1), "Sour", "Doe").with("Bachelor of Art");
@Autowired
private LuceneService luceneService;
private static List<String> asNames(List<? extends Nameable> nameables) {
return nameables.stream()
.map(Nameable::getName)
.collect(Collectors.toList());
}
private static List<User> asUsers(Person... people) {
return Arrays.stream(people)
.map(User::from)
.collect(Collectors.toList());
}
@Autowired
private ProjectingLuceneOperations template;
@Resource(name = "People")
private Region<Long, Person> people;
@Before
public void setup() {
jonDoe = save(Person.newPerson(LocalDate.of(1969, Month.JULY, 4), "Jon", "Doe").with("Master of Science"));
janeDoe = save(Person.newPerson(LocalDate.of(1969, Month.AUGUST, 16), "Jane", "Doe").with("Doctor of Astrophysics"));
cookieDoe = save(Person.newPerson(LocalDate.of(1991, Month.APRIL, 2), "Cookie", "Doe").with("Bachelor of Physics"));
froDoe = save(Person.newPerson(LocalDate.of(1988, Month.MAY, 25), "Fro", "Doe").with("Doctor of Computer Science"));
hoDoe = save(Person.newPerson(LocalDate.of(1984, Month.NOVEMBER, 11), "Ho", "Doe").with("Doctor of Math"));
pieDoe = save(Person.newPerson(LocalDate.of(1996, Month.JUNE, 4), "Pie", "Doe").with("Master of Astronomy"));
sourDoe = save(Person.newPerson(LocalDate.of(1999, Month.DECEMBER, 1), "Sour", "Doe").with("Bachelor of Art"));
flushLuceneIndex();
}
private Person save(Person person) {
person.setId(IDENTIFIER.incrementAndGet());
people.put(person.getId(), person);
return person;
}
private void flushLuceneIndex() {
try {
this.luceneService.waitUntilFlushed("PersonTitleIndex", "/People",
15L, TimeUnit.SECONDS);
}
catch (Throwable ignore) {
}
}
private List<String> asNames(List<? extends Nameable> nameables) {
return nameables.stream().map(Nameable::getName).collect(Collectors.toList());
}
private List<User> asUsers(Person... people) {
return Arrays.stream(people).map(User::from).collect(Collectors.toList());
}
@Test
public void findsDoctorDoesAsTypePersonSuccessfully() {
@@ -150,7 +122,7 @@ public class LuceneOperationsIntegrationTests {
}
@SuppressWarnings("unused")
@PeerCacheApplication(name = "LuceneOperationsIntegrationTests", logLevel = LOG_LEVEL)
@PeerCacheApplication(name = "LuceneOperationsIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL)
static class TestConfiguration {
@Bean(name = "People")
@@ -192,7 +164,26 @@ public class LuceneOperationsIntegrationTests {
@Bean
@DependsOn("personTitleIndex")
ProjectingLuceneOperations luceneTemplate() {
return new ProjectingLuceneTemplate("personTitleIndex", "/People");
return new ProjectingLuceneTemplate("PersonTitleIndex", "/People");
}
@EventListener(ContextRefreshedEvent.class)
@SuppressWarnings("unchecked")
public void loadPeople(ContextRefreshedEvent event) {
Region<Long, Person> people = event.getApplicationContext().getBean("People", Region.class);
Arrays.asList(jonDoe, janeDoe, cookieDoe, froDoe, hoDoe, pieDoe, sourDoe)
.forEach(person -> {
person.setId(IDENTIFIER.incrementAndGet());
people.put(person.getId(), person);
});
LuceneService luceneService =
event.getApplicationContext().getBean("luceneService", LuceneService.class);
SpringUtils.safeRunOperation(() ->
luceneService.waitUntilFlushed("PersonTitleIndex", "/People", 15L, TimeUnit.SECONDS));
}
}

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.snapshot;
import static java.util.Arrays.stream;
@@ -31,12 +30,14 @@ import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.Resource;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.snapshot.SnapshotFilter;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.snapshot.SnapshotFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.gemfire.repository.sample.Person;
@@ -143,8 +144,9 @@ public class SnapshotApplicationEventTriggeredImportsExportsIntegrationTest {
protected void wait(int seconds, int expectedDoeSize, int expectedEveryoneSize, int expectedHandySize) {
ThreadUtils.timedWait(TimeUnit.SECONDS.toMillis(seconds), 500,
() -> (doe.size() < expectedDoeSize && everyoneElse.size() <
expectedEveryoneSize && handy.size() < expectedHandySize));
() -> doe.size() < expectedDoeSize
|| everyoneElse.size() < expectedEveryoneSize
|| handy.size() < expectedHandySize);
}
@Test
@@ -178,7 +180,7 @@ public class SnapshotApplicationEventTriggeredImportsExportsIntegrationTest {
eventPublisher.publishEvent(event);
wait(10, 5, 4, 3);
wait(5, 5, 4, 3);
assertPeople(doe, jonDoe, janeDoe, cookieDoe, pieDoe, sourDoe);
assertPeople(everyoneElse, jackBlack, joeDirt, jackHill, jillHill);
@@ -239,7 +241,7 @@ public class SnapshotApplicationEventTriggeredImportsExportsIntegrationTest {
@Autowired
private ApplicationEventPublisher eventPublisher;
private static final Map<File, Long> snapshotFileLastModifiedMap = new ConcurrentHashMap<File, Long>(2);
private static final Map<File, Long> snapshotFileLastModifiedMap = new ConcurrentHashMap<>(2);
@Scheduled(fixedDelay = 1000)
@SuppressWarnings("unchecked")

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.snapshot;
import static org.apache.geode.cache.snapshot.SnapshotOptions.SnapshotFormat;
@@ -49,25 +48,28 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.snapshot.CacheSnapshotService;
import org.apache.geode.cache.snapshot.RegionSnapshotService;
import org.apache.geode.cache.snapshot.SnapshotFilter;
import org.apache.geode.cache.snapshot.SnapshotOptions;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentMatchers;
import org.slf4j.Logger;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.snapshot.CacheSnapshotService;
import org.apache.geode.cache.snapshot.RegionSnapshotService;
import org.apache.geode.cache.snapshot.SnapshotFilter;
import org.apache.geode.cache.snapshot.SnapshotOptions;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.gemfire.snapshot.event.ExportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.ImportSnapshotApplicationEvent;
import org.springframework.data.gemfire.snapshot.event.SnapshotApplicationEvent;
import org.springframework.data.gemfire.test.support.FileSystemUtils;
import org.slf4j.Logger;
/**
* The SnapshotServiceFactoryBeanTest class is a test suite of test cases testing the contract and functionality
* of the SnapshotServiceFactoryBean class.
@@ -177,12 +179,14 @@ public class SnapshotServiceFactoryBeanTest {
@Test
public void nullSafeIsFileWithFile() {
assertThat(SnapshotServiceFactoryBean.nullSafeIsFile(FileSystemUtils.JAVA_EXE),
is(FileSystemUtils.JAVA_EXE.isFile()));
}
@Test
public void nullSafeIsFileWithNonFiles() {
assertThat(SnapshotServiceFactoryBean.nullSafeIsFile(new File("/path/to/non-existing/file.ext")), is(false));
assertThat(SnapshotServiceFactoryBean.nullSafeIsFile(new File(System.getProperty("user.dir"))), is(false));
}
@@ -211,6 +215,7 @@ public class SnapshotServiceFactoryBeanTest {
public void setAndGetCacheSuccessfully() {
Cache mockCache = mock(Cache.class, "MockCache");
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean();
factoryBean.setCache(mockCache);
@@ -312,7 +317,9 @@ public class SnapshotServiceFactoryBeanTest {
"MockSnapshotServiceAdapter");
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean() {
@Override protected SnapshotServiceAdapter create() {
@Override
protected SnapshotServiceAdapter create() {
return mockSnapshotService;
}
};
@@ -332,7 +339,9 @@ public class SnapshotServiceFactoryBeanTest {
"MockSnapshotServiceAdapter");
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean() {
@Override protected SnapshotServiceAdapter create() {
@Override
protected SnapshotServiceAdapter create() {
return mockSnapshotService;
}
};
@@ -349,6 +358,7 @@ public class SnapshotServiceFactoryBeanTest {
public void createCacheSnapshotService() {
Cache mockCache = mock(Cache.class, "MockCache");
CacheSnapshotService mockCacheSnapshotService = mock(CacheSnapshotService.class, "MockCacheSnapshotService");
when(mockCache.getSnapshotService()).thenReturn(mockCacheSnapshotService);
@@ -368,6 +378,7 @@ public class SnapshotServiceFactoryBeanTest {
public void createRegionSnapshotService() {
Region mockRegion = mock(Region.class, "MockRegion");
RegionSnapshotService mockRegionSnapshotService = mock(RegionSnapshotService.class, "MockRegionSnapshotService");
when(mockRegion.getSnapshotService()).thenReturn(mockRegionSnapshotService);
@@ -412,7 +423,9 @@ public class SnapshotServiceFactoryBeanTest {
"MockSnapshotServiceAdapter");
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean() {
@Override public SnapshotServiceAdapter getObject() {
@Override
public SnapshotServiceAdapter getObject() {
return mockSnapshotService;
}
};
@@ -443,7 +456,9 @@ public class SnapshotServiceFactoryBeanTest {
when(mockSnapshotEvent.getSnapshotMetadata()).thenReturn(toArray(eventSnapshotMetadata));
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean() {
@Override public SnapshotServiceAdapter getObject() {
@Override
public SnapshotServiceAdapter getObject() {
return mockSnapshotService;
}
};
@@ -478,7 +493,9 @@ public class SnapshotServiceFactoryBeanTest {
when(mockSnapshotEvent.getSnapshotMetadata()).thenReturn(null);
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean() {
@Override public SnapshotServiceAdapter getObject() {
@Override
public SnapshotServiceAdapter getObject() {
return mockSnapshotService;
}
};
@@ -510,7 +527,9 @@ public class SnapshotServiceFactoryBeanTest {
mock(SnapshotServiceAdapter.class, "MockSnapshotServiceAdapter");
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean() {
@Override public SnapshotServiceAdapter getObject() {
@Override
public SnapshotServiceAdapter getObject() {
return mockSnapshotService;
}
};
@@ -544,7 +563,9 @@ public class SnapshotServiceFactoryBeanTest {
when(mockSnapshotEvent.getSnapshotMetadata()).thenReturn(null);
SnapshotServiceFactoryBean factoryBean = new SnapshotServiceFactoryBean() {
@Override public SnapshotServiceAdapter getObject() {
@Override
public SnapshotServiceAdapter getObject() {
return mockSnapshotService;
}
};
@@ -948,7 +969,9 @@ public class SnapshotServiceFactoryBeanTest {
when(mockSnapshotOptions.setParallelMode(anyBoolean())).thenReturn(mockSnapshotOptions);
TestSnapshotServiceAdapter snapshotService = new TestSnapshotServiceAdapter() {
@Override public SnapshotOptions<Object, Object> createOptions() {
@Override
public SnapshotOptions<Object, Object> createOptions() {
return mockSnapshotOptions;
}
};
@@ -997,7 +1020,9 @@ public class SnapshotServiceFactoryBeanTest {
when(mockLog.isDebugEnabled()).thenReturn(true);
TestSnapshotServiceAdapter snapshotService = new TestSnapshotServiceAdapter() {
@Override Logger createLog() {
@Override
Logger createLog() {
return mockLog;
}
};
@@ -1018,7 +1043,9 @@ public class SnapshotServiceFactoryBeanTest {
when(mockLog.isDebugEnabled()).thenReturn(false);
TestSnapshotServiceAdapter snapshotService = new TestSnapshotServiceAdapter() {
@Override Logger createLog() {
@Override
Logger createLog() {
return mockLog;
}
};
@@ -1060,11 +1087,13 @@ public class SnapshotServiceFactoryBeanTest {
adapter.load(FileSystemUtils.WORKING_DIRECTORY, SnapshotFormat.GEMFIRE);
}
catch (ImportSnapshotException expected) {
assertThat(expected.getMessage(), is(equalTo(String.format(
"Failed to load snapshots from directory [%1$s] in format [GEMFIRE]",
FileSystemUtils.WORKING_DIRECTORY))));
assertThat(expected.getCause(), is(instanceOf(IOException.class)));
assertThat(expected.getCause().getMessage(), is(equalTo("TEST")));
throw expected;
}
finally {
@@ -1092,11 +1121,13 @@ public class SnapshotServiceFactoryBeanTest {
adapter.load(SnapshotFormat.GEMFIRE, mockSnapshotOptions, snapshotDat);
}
catch (ImportSnapshotException expected) {
assertThat(expected.getMessage(), is(equalTo(String.format(
"Failed to load snapshots [%1$s] in format [GEMFIRE] using options [%2$s]",
Arrays.toString(new File[] { snapshotDat }), mockSnapshotOptions))));
assertThat(expected.getCause(), is(instanceOf(ClassCastException.class)));
assertThat(expected.getCause().getMessage(), is(equalTo("TEST")));
throw expected;
}
finally {
@@ -1121,11 +1152,13 @@ public class SnapshotServiceFactoryBeanTest {
adapter.save(FileSystemUtils.WORKING_DIRECTORY, SnapshotFormat.GEMFIRE);
}
catch (ExportSnapshotException expected) {
assertThat(expected.getMessage(), is(equalTo(String.format(
"Failed to save snapshots to directory [%1$s] in format [GEMFIRE]",
FileSystemUtils.WORKING_DIRECTORY))));
assertThat(expected.getCause(), is(instanceOf(IOException.class)));
assertThat(expected.getCause().getMessage(), is(equalTo("TEST")));
throw expected;
}
finally {
@@ -1153,11 +1186,13 @@ public class SnapshotServiceFactoryBeanTest {
adapter.save(FileSystemUtils.USER_HOME, SnapshotFormat.GEMFIRE, mockSnapshotOptions);
}
catch (ExportSnapshotException expected) {
assertThat(expected.getMessage(), is(equalTo(String.format(
"Failed to save snapshots to directory [%1$s] in format [GEMFIRE] using options [%2$s]",
FileSystemUtils.USER_HOME, mockSnapshotOptions))));
assertThat(expected.getCause(), is(instanceOf(ClassCastException.class)));
assertThat(expected.getCause().getMessage(), is(equalTo("TEST")));
throw expected;
}
finally {
@@ -1183,10 +1218,12 @@ public class SnapshotServiceFactoryBeanTest {
adapter.load(snapshotDat, SnapshotFormat.GEMFIRE);
}
catch (ImportSnapshotException expected) {
assertThat(expected.getMessage(), is(equalTo(String.format(
"Failed to load snapshot from file [%1$s] in format [GEMFIRE]", snapshotDat))));
assertThat(expected.getCause(), is(instanceOf(IOException.class)));
assertThat(expected.getCause().getMessage(), is(equalTo("TEST")));
throw expected;
}
finally {
@@ -1213,11 +1250,13 @@ public class SnapshotServiceFactoryBeanTest {
adapter.load(SnapshotFormat.GEMFIRE, mockSnapshotOptions, snapshotDat);
}
catch (ImportSnapshotException expected) {
assertThat(expected.getMessage(), is(equalTo(String.format(
"Failed to load snapshots [%1$s] in format [GEMFIRE] using options [%2$s]",
Arrays.toString(new File[] { snapshotDat }), mockSnapshotOptions))));
assertThat(expected.getCause(), is(instanceOf(ClassCastException.class)));
assertThat(expected.getCause().getMessage(), is(equalTo("TEST")));
throw expected;
}
finally {
@@ -1243,10 +1282,12 @@ public class SnapshotServiceFactoryBeanTest {
adapter.save(snapshotDat, SnapshotFormat.GEMFIRE);
}
catch (ExportSnapshotException expected) {
assertThat(expected.getMessage(), is(equalTo(String.format(
"Failed to save snapshot to file [%1$s] in format [GEMFIRE]", snapshotDat))));
assertThat(expected.getCause(), is(instanceOf(IOException.class)));
assertThat(expected.getCause().getMessage(), is(equalTo("TEST")));
throw expected;
}
finally {

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.test.support;
/**
@@ -49,6 +48,7 @@ public abstract class StackTraceUtils extends ThreadUtils {
}
public static StackTraceElement getTestCaller(final Thread thread) {
for (StackTraceElement stackTraceElement : thread.getStackTrace()) {
if (isTestSuiteClass(stackTraceElement) && isTestCaseMethod(stackTraceElement)) {
return stackTraceElement;
@@ -59,6 +59,7 @@ public abstract class StackTraceUtils extends ThreadUtils {
}
private static boolean isTestCaseMethod(final StackTraceElement element) {
boolean result = element.getMethodName().toLowerCase().startsWith("test");
try {
@@ -71,9 +72,11 @@ public abstract class StackTraceUtils extends ThreadUtils {
}
private static boolean isTestSuiteClass(final StackTraceElement element) {
boolean result = element.getClass().getSimpleName().toLowerCase().endsWith("test");
result |= element.getClass().isAssignableFrom(junit.framework.TestCase.class);
return result;
}
}

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.test.support;
import java.util.concurrent.TimeUnit;
@@ -29,6 +28,7 @@ import java.util.concurrent.TimeUnit;
public abstract class ThreadUtils {
public static boolean sleep(long milliseconds) {
try {
Thread.sleep(milliseconds);
return true;
@@ -44,11 +44,7 @@ public abstract class ThreadUtils {
}
public static boolean timedWait(long duration, long interval) {
return timedWait(duration, interval, new WaitCondition() {
@Override public boolean waiting() {
return true;
}
});
return timedWait(duration, interval, () -> true);
}
@SuppressWarnings("all")

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.test.support;
import java.io.PrintWriter;
@@ -31,10 +30,12 @@ import java.io.StringWriter;
@SuppressWarnings("unused")
public abstract class ThrowableUtils {
public static String toString(final Throwable t) {
public static String toString(Throwable cause) {
StringWriter writer = new StringWriter();
t.printStackTrace(new PrintWriter(writer));
cause.printStackTrace(new PrintWriter(writer));
return writer.toString();
}
}

View File

@@ -9,11 +9,11 @@
<Null name="nop"/>
</Appenders>
<Loggers>
<Logger name="org.apache.geode" level="error"/>
<Logger name="org.springframework" level="error"/>
<Logger name="org.apache.geode" level="${sys:log4j.geode.log.level:-error}"/>
<Logger name="org.springframework" level="${sys:log4j.spring.log.level:-error}"/>
<Logger name="org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter" level="off" additivity="false"/>
<Logger name="org.springframework.data.gemfire.support.SpringContextBootstrappingInitializer" level="off" additivity="false"/>
<Root level="error">
<Root level="${sys:log4j.log.level:-error}">
<AppenderRef ref="Console"/>
<!--AppenderRef ref="File" /-->
</Root>