GEODE-2887: exclude build-* output directories from rat
Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/25d02710 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/25d02710 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/25d02710 Branch: refs/heads/feature/GEODE-2858 Commit: 25d02710ad9a03b516c59d4efad8834a1873786d Parents: d3520ea Author: Kirk Lund <[email protected]> Authored: Fri May 5 15:33:27 2017 -0700 Committer: Kirk Lund <[email protected]> Committed: Mon May 8 10:08:55 2017 -0700 ---------------------------------------------------------------------- .../cache/query/LocalQueryServiceJUnitTest.java | 102 ++++++++----------- gradle/rat.gradle | 1 + 2 files changed, 45 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/25d02710/geode-core/src/test/java/org/apache/geode/cache/query/LocalQueryServiceJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/LocalQueryServiceJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/LocalQueryServiceJUnitTest.java index d3df451..a474547 100644 --- a/geode-core/src/test/java/org/apache/geode/cache/query/LocalQueryServiceJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/cache/query/LocalQueryServiceJUnitTest.java @@ -14,88 +14,74 @@ */ package org.apache.geode.cache.query; -import org.apache.geode.internal.net.SocketCreatorFactory; -import org.apache.geode.distributed.internal.DistributionConfigImpl; +import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException; +import static org.junit.Assert.assertEquals; + import org.apache.geode.cache.CacheTransactionManager; import org.apache.geode.cache.Region; import org.apache.geode.cache.client.ClientCache; import org.apache.geode.cache.client.ClientCacheFactory; import org.apache.geode.cache.client.ClientRegionFactory; import org.apache.geode.cache.client.ClientRegionShortcut; -import org.apache.geode.test.junit.categories.UnitTest; +import org.apache.geode.test.dunit.IgnoredException; +import org.apache.geode.test.junit.categories.IntegrationTest; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import java.io.IOException; -import java.util.Properties; - -import static org.junit.Assert.assertEquals; -@Category(UnitTest.class) +@Category(IntegrationTest.class) public class LocalQueryServiceJUnitTest { - @Test - public void testLocalQueryService() throws Exception { - ClientCache c = null; - try { - c = new ClientCacheFactory().create(); - addExpectedException(c, IOException.class.getName()); - Region r = createRegion(c); - int numEntries = 10; - loadRegion(r, numEntries); - SelectResults sR = executeLocalQuery(c, "SELECT * from /localRegion"); - assertEquals(numEntries, sR.size()); - } finally { - if (c != null) { - c.close(); - } + private IgnoredException ignoredException; + private ClientCache clientCache; + private int numEntries; + + @Before + public void before() throws Exception { + this.ignoredException = addIgnoredException(IOException.class.getName()); + + this.clientCache = new ClientCacheFactory().create(); + ClientRegionFactory factory = + this.clientCache.createClientRegionFactory(ClientRegionShortcut.LOCAL); + Region region = factory.create("localRegion"); + this.numEntries = 10; + for (int i = 0; i < this.numEntries; i++) { + region.put(i, i); } } - @Test - public void testLocalQueryServiceWithTransaction() throws Exception { - ClientCache c = null; - try { - SocketCreatorFactory.setDistributionConfig(new DistributionConfigImpl(new Properties())); - c = new ClientCacheFactory().create(); - addExpectedException(c, IOException.class.getName()); - Region r = createRegion(c); - int numEntries = 10; - loadRegion(r, numEntries); - CacheTransactionManager cacheTransactionManager = c.getCacheTransactionManager(); - cacheTransactionManager.begin(); - SelectResults sR = executeLocalQuery(c, "SELECT * from /localRegion"); - assertEquals(numEntries, sR.size()); - cacheTransactionManager.commit(); - } finally { - if (c != null) { - c.close(); - } + @After + public void after() throws Exception { + if (this.clientCache != null) { + this.clientCache.close(); } + this.ignoredException.remove(); } - private Region createRegion(ClientCache c) { - ClientRegionFactory factory = c.createClientRegionFactory(ClientRegionShortcut.LOCAL); - return factory.create("localRegion"); - } + @Test + public void testLocalQueryService() throws Exception { + SelectResults sR = executeLocalQuery(this.clientCache, "SELECT * from /localRegion"); - private void loadRegion(Region r, int numEntries) { - for (int i = 0; i < numEntries; i++) { - r.put(i, i); - } + assertEquals(this.numEntries, sR.size()); } - private SelectResults executeLocalQuery(ClientCache c, String qS) throws QueryException { - QueryService qs = c.getLocalQueryService(); - Query q = qs.newQuery("SELECT * from /localRegion"); - return (SelectResults) q.execute(); - } + @Test + public void testLocalQueryServiceWithTransaction() throws Exception { + CacheTransactionManager cacheTransactionManager = clientCache.getCacheTransactionManager(); + cacheTransactionManager.begin(); + SelectResults selectResults = executeLocalQuery(this.clientCache, "SELECT * from /localRegion"); + + assertEquals(this.numEntries, selectResults.size()); - private void addExpectedException(ClientCache c, String exception) { - c.getLogger().info("<ExpectedException action=add>" + exception + "</ExpectedException>"); + cacheTransactionManager.commit(); } - private void removeExpectedException(ClientCache c, String exception) { - c.getLogger().info("<ExpectedException action=remove>" + exception + "</ExpectedException>"); + private SelectResults executeLocalQuery(ClientCache c, String query) throws QueryException { + QueryService qs = c.getLocalQueryService(); + Query q = qs.newQuery(query); + return (SelectResults) q.execute(); } } http://git-wip-us.apache.org/repos/asf/geode/blob/25d02710/gradle/rat.gradle ---------------------------------------------------------------------- diff --git a/gradle/rat.gradle b/gradle/rat.gradle index 440a7b7..f8018b6 100644 --- a/gradle/rat.gradle +++ b/gradle/rat.gradle @@ -37,6 +37,7 @@ rat { 'native/**', 'wrapper/**', '**/build/**', + '**/build-*/**', '.buildinfo', // SBT
