You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2018/08/30 15:54:38 UTC
[geode] branch develop updated: GEODE-5475: rule improvement
This is an automated email from the ASF dual-hosted git repository.
jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 06ba32c GEODE-5475: rule improvement
06ba32c is described below
commit 06ba32c9f9ca0ba721b1a9a9c9dbf902c6a023f1
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Thu Aug 30 08:54:33 2018 -0700
GEODE-5475: rule improvement
---
.../geode/test/junit/rules/ServerStarterRule.java | 29 ++++++++++++++++------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/ServerStarterRule.java b/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/ServerStarterRule.java
index 1b5d99f..a37e89b 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/ServerStarterRule.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/ServerStarterRule.java
@@ -171,20 +171,33 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
return this;
}
+ /**
+ * convenience method to create a region with customized regionFactory
+ *
+ * @param regionFactoryConsumer a lamda that allows you to customize the regionFactory
+ */
public Region createRegion(RegionShortcut type, String name,
Consumer<RegionFactory> regionFactoryConsumer) {
- RegionFactory factory = getCache().createRegionFactory(type);
- regionFactoryConsumer.accept(factory);
- return factory.create(name);
+ RegionFactory regionFactory = getCache().createRegionFactory(type);
+ regionFactoryConsumer.accept(regionFactory);
+ return regionFactory.create(name);
}
- public Region createPRRegion(String name, Consumer<RegionFactory> regionFactoryConsumer,
- Consumer<PartitionAttributesFactory> prAttributesFactory) {
+ /**
+ * convenience method to create a partition region with customized regionFactory and a customized
+ * PartitionAttributeFactory
+ *
+ * @param regionFactoryConsumer a lamda that allows you to customize the regionFactory
+ * @param attributesFactoryConsumer a lamda that allows you to customize the
+ * partitionAttributeFactory
+ */
+ public Region createPartitionRegion(String name, Consumer<RegionFactory> regionFactoryConsumer,
+ Consumer<PartitionAttributesFactory> attributesFactoryConsumer) {
return createRegion(RegionShortcut.PARTITION, name, rf -> {
regionFactoryConsumer.accept(rf);
- PartitionAttributesFactory factory = new PartitionAttributesFactory();
- prAttributesFactory.accept(factory);
- rf.setPartitionAttributes(factory.create());
+ PartitionAttributesFactory attributeFactory = new PartitionAttributesFactory();
+ attributesFactoryConsumer.accept(attributeFactory);
+ rf.setPartitionAttributes(attributeFactory.create());
});
}