geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-3571) API should move from factory pattern to builder pattern and fluent model
Date Mon, 27 Nov 2017 22:52:00 GMT

    [ https://issues.apache.org/jira/browse/GEODE-3571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16267733#comment-16267733
] 

ASF GitHub Bot commented on GEODE-3571:
---------------------------------------

mhansonp commented on a change in pull request #158: feature/GEODE-3571
URL: https://github.com/apache/geode-native/pull/158#discussion_r153348420
 
 

 ##########
 File path: clicache/integration-test/AttributesFactoryTestsN.cs
 ##########
 @@ -15,94 +15,29 @@
  * limitations under the License.
  */
 
-//using System;
-//using System.Reflection;
-
-//#pragma warning disable 618
-
-//namespace Apache.Geode.Client.UnitTests
-//{
-//  using NUnit.Framework;
-//  using Apache.Geode.DUnitFramework;
-// // using Apache.Geode.Client; 
-//  using Apache.Geode.Client;
-//  //using Region = Apache.Geode.Client.IRegion<Object, Object>;
-
-//  [TestFixture]
-//  [Category("group1")]
-//  [Category("unicast_only")]
-//  [Category("generics")]
-//  public class AttributesFactoryTests : UnitTests
-//  {
-//    protected override ClientBase[] GetClients()
-//    {
-//      return null;
-//    }
-
-//    [Test]
-//    public void InvalidTCRegionAttributes()
-//    {
-//      Properties<string, string> config = new Properties<string, string>();
-//      CacheHelper.InitConfig(config);
-//      IRegion<object, object> region;
-//      RegionAttributes<object, object> attrs;
-//      AttributesFactory<object, object> af = new AttributesFactory<object, object>();
-//      af.SetScope(ScopeType.Local);
-//      af.SetEndpoints("bass:1234");
-//      attrs = af.CreateRegionAttributes();
-//      region = CacheHelper.CreateRegion<object, object>("region1", attrs);
-//      try
-//      {
-//       IRegion<Object, Object> localRegion = region.GetLocalView();
-//        Assert.Fail(
-//          "LOCAL scope is incompatible with a native client region");
-//      }
-//      catch (UnsupportedOperationException)
-//      {
-//        Util.Log("Got expected UnsupportedOperationException for " +
-//          "LOCAL scope for native client region");
-//      }
-
-//      af.SetScope(ScopeType.Local);
-//      af.SetClientNotificationEnabled(true);
-//      attrs = af.CreateRegionAttributes();
-//      try
-//      {
-//        region = CacheHelper.CreateRegion<object, object>("region2", attrs);
-//        Assert.Fail(
-//          "LOCAL scope is incompatible with clientNotificationEnabled");
-//      }
-//      catch (UnsupportedOperationException)
-//      {
-//        Util.Log("Got expected UnsupportedOperationException for " +
-//          "clientNotificationEnabled for non native client region");
-//      }
-
-//      // Checks for HA regions
-
-//      CacheHelper.CloseCache();
-//      af.SetScope(ScopeType.Local);
-//      af.SetEndpoints("bass:3434");
-//      af.SetClientNotificationEnabled(false);
-//      attrs = af.CreateRegionAttributes();
-//      try
-//      {
-//        region = CacheHelper.CreateRegion<object, object>("region2", attrs);
-//        Assert.Fail(
-//          "LOCAL scope is incompatible with a native client HA region");
-//      }
-//      catch (UnsupportedOperationException)
-//      {
-//        Util.Log("Got expected UnsupportedOperationException for " +
-//          "LOCAL scope for native client region");
-//      }
-
-//      af.SetScope(ScopeType.Local);
-//      af.SetEndpoints("none");
-//      af.SetClientNotificationEnabled(false);
-//      attrs = af.CreateRegionAttributes();
-//      region = CacheHelper.CreateRegion<object, object>("region1", attrs);
-//      Util.Log("C++ local region created with HA cache specification.");
-//    }
-//  }
-//}
+using System;
+using System.Reflection;
+
+#pragma warning disable 618
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class AttributesFactoryTests : UnitTests
+  {
+    [Test]
+    public void fluentModeltest()
+    {
+      AttributesFactory<TKey, TValue> af = new AttributesFactory<TKey, TValue>();
+      Apache.Geode.Client.RegionAttributes<TKey, TValue> rattrs = af.SetLruEntriesLimit(0).SetInitialCapacity(5).CreateRegionAttributes();
+      Assert.IsNotNull(rattrs);
 
 Review comment:
   Good point.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> API should move from factory pattern to builder pattern and fluent model
> ------------------------------------------------------------------------
>
>                 Key: GEODE-3571
>                 URL: https://issues.apache.org/jira/browse/GEODE-3571
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Mark Hanson
>
> Discussion here http://markmail.org/thread/femkjloasj4yzvoj
> The basic idea is to move away from the creation of generic objects which are then further
specified to  specifying the object in advance then creating the more specific object.
> This in addition to using a model where with each attribute set on an object, the this
pointer is provided as the return value. This allows call chaining.
> Obvious target changes include 
> CacheFactory
> DistributedSystem
> AttributesFactory



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message