This is an automated email from the ASF dual-hosted git repository.

bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4ad68a1  GEODE-4346:  .NET function execution example (#409)
4ad68a1 is described below

commit 4ad68a1967d8b52339a9a3e8186756778ec99657
Author: Michael Martell <[email protected]>
AuthorDate: Mon Dec 17 10:26:35 2018 -0800

    GEODE-4346:  .NET function execution example (#409)
    
    Co-authored-by: Ernest Burghardt <[email protected]>
    
    * Add FunctionExecution example.
    * Added new tests in the new framework for function execution.
    * Update the README.md
---
 clicache/integration-test2/CMakeLists.txt          |   1 +
 .../integration-test2/FunctionExecutionTest.cs     | 151 +++++++++++++++++++++
 examples/dotnet/CMakeLists.txt                     |   3 +
 examples/dotnet/CMakeLists.txt.in                  |   1 +
 examples/dotnet/ContinuousQueryCs/MyCqListener.cs  |  76 +++++------
 examples/dotnet/ContinuousQueryCs/Order.cs         |  78 +++++------
 examples/dotnet/ContinuousQueryCs/Program.cs       | 135 +++++++++---------
 examples/dotnet/DataSerializableCs/Program.cs      |  48 +++----
 examples/dotnet/FunctionExecutionCs/Program.cs     |  82 +++++++++++
 examples/dotnet/FunctionExecutionCs/README.md      |  25 ++++
 .../dotnet/FunctionExecutionCs/startserver.ps1     |  39 ++++++
 .../stopserver.ps1}                                |  36 +++--
 examples/dotnet/PdxAutoSerializer/Order.cs         |  34 ++---
 examples/dotnet/PdxAutoSerializer/Program.cs       |  48 +++----
 examples/dotnet/PdxSerializableCs/Order.cs         |  78 +++++------
 examples/dotnet/PdxSerializableCs/Program.cs       |  48 +++----
 examples/dotnet/PutGetRemove/Program.cs            |  70 +++++-----
 17 files changed, 635 insertions(+), 318 deletions(-)

diff --git a/clicache/integration-test2/CMakeLists.txt 
b/clicache/integration-test2/CMakeLists.txt
index e122168..e1b242f 100644
--- a/clicache/integration-test2/CMakeLists.txt
+++ b/clicache/integration-test2/CMakeLists.txt
@@ -38,6 +38,7 @@ add_library( ${PROJECT_NAME} SHARED
     CacheXml.cs
     CacheXmlTests.cs
     CqOperationTest.cs
+    FunctionExecutionTest.cs
     QueryTest.cs
     RegionTest.cs
     RegionSSLTest.cs
diff --git a/clicache/integration-test2/FunctionExecutionTest.cs 
b/clicache/integration-test2/FunctionExecutionTest.cs
new file mode 100644
index 0000000..69f59bd
--- /dev/null
+++ b/clicache/integration-test2/FunctionExecutionTest.cs
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using Xunit;
+
+namespace Apache.Geode.Client.IntegrationTests
+{
+  [Trait("Category", "Integration")]
+    public class FunctionExecutionTest : TestBase
+    {
+        [Fact]
+        public void MultiGetFunctionExecutionWithFilter()
+        {
+            int expectedFilteredCount = 34;
+            using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 
1))
+            {
+                Assert.Equal(cluster.Start(), true);
+                Assert.Equal(cluster.Gfsh.deploy()
+                    .withJar(Config.JavaobjectJarPath)
+                    .execute(), 0);
+                Assert.Equal(cluster.Gfsh
+                    .create()
+                    .region()
+                    .withName("testRegion1")
+                    .withType("PARTITION")
+                    .execute(), 0);
+
+                var cacheFactory = new CacheFactory();
+                var cacheOne = cacheFactory.Create();
+                cacheOne.GetPoolFactory()
+                    .AddLocator(cluster.Gfsh.LocatorBindAddress, 
cluster.Gfsh.LocatorPort)
+                    .Create("pool");
+                var regionFactory = 
cacheOne.CreateRegionFactory(RegionShortcut.PROXY)
+                    .SetPoolName("pool");
+                var region = regionFactory.Create<object, 
object>("testRegion1");
+
+                for (int i = 0; i < 230; i++)
+                {
+                  region["KEY--" + i] = "VALUE--" + i;
+                }
+
+                object args = true;
+              
+
+                Object[] oddKeyFilter = new Object[17];
+                int j = 0;
+                for (int i = 0; i < 34; i++)
+                {
+                  if (i % 2 == 0) continue;
+                  oddKeyFilter[j] = "KEY--" + i;
+                  j++;
+                }
+                Apache.Geode.Client.Execution<object> exc = 
Client.FunctionService<object>.OnRegion<object, object>(region);
+                Client.IResultCollector<object> rc = 
exc.WithArgs<object>(args).WithFilter<object>(oddKeyFilter).Execute("MultiGetFunction");
+                ICollection<object> executeFunctionResult = rc.GetResult();
+                List<object> resultList = new List<object>();
+
+                foreach (List<object> item in executeFunctionResult)
+                {
+                  foreach (object item2 in item)
+                  {
+                    resultList.Add(item2);
+                  }
+                }
+                Assert.True(resultList.Count == expectedFilteredCount, "result 
count check failed");
+
+            }
+        }
+
+    [Fact]
+    public void MultiGetIFunctionExecutionWithArgs()
+    {
+      int expectedResultCount = 17;
+      using (var cluster = new Cluster(CreateTestCaseDirectoryName(), 1, 1))
+      {
+        Assert.Equal(cluster.Start(), true);
+        Assert.Equal(cluster.Gfsh.deploy()
+            .withJar(Config.JavaobjectJarPath)
+            .execute(), 0);
+        Assert.Equal(cluster.Gfsh
+            .create()
+            .region()
+            .withName("partition_region")
+            .withType("PARTITION")
+            .execute(), 0);
+
+        var cacheFactory = new CacheFactory();
+        var cacheOne = cacheFactory.Create();
+        cacheOne.GetPoolFactory()
+            .AddLocator(cluster.Gfsh.LocatorBindAddress, 
cluster.Gfsh.LocatorPort)
+            .Create("pool");
+        var regionFactory = cacheOne.CreateRegionFactory(RegionShortcut.PROXY)
+            .SetPoolName("pool");
+        var region = regionFactory.Create<object, object>("partition_region");
+
+        for (int i = 0; i < 230; i++)
+        {
+          region["KEY--" + i] = "VALUE--" + i;
+        }
+
+        object args = true;
+        Object[] oddKeyFilter = new Object[17];
+        int j = 0;
+        for (int i = 0; i < 34; i++)
+        {
+          if (i % 2 == 0) continue;
+          oddKeyFilter[j] = "KEY--" + i;
+          j++;
+        }
+
+        ArrayList oddKeyArgs = new ArrayList();
+        for (int i = 0; i < oddKeyFilter.Length; i++)
+        {
+          oddKeyArgs.Add(oddKeyFilter[i]);
+        }
+        Apache.Geode.Client.Execution<object> exc = 
Client.FunctionService<object>.OnRegion<object, object>(region);
+        Client.IResultCollector<object> rc = 
exc.WithArgs<ArrayList>(oddKeyArgs).Execute("MultiGetFunctionI");
+        ICollection<object> executeFunctionResult = rc.GetResult();
+        List<object> resultList = new List<object>();
+
+        foreach (List<object> item in executeFunctionResult)
+        {
+          foreach (object item2 in item)
+          {
+            resultList.Add(item2);
+          }
+        }
+        Assert.True(resultList.Count == expectedResultCount, "result count 
check failed");
+
+      }
+    }
+  }
+}
diff --git a/examples/dotnet/CMakeLists.txt b/examples/dotnet/CMakeLists.txt
index edc94e5..aeedcb7 100644
--- a/examples/dotnet/CMakeLists.txt
+++ b/examples/dotnet/CMakeLists.txt
@@ -55,6 +55,9 @@ add_example(NAME ContinuousQueryCs
 add_example(NAME DataSerializableCs
        SOURCE Order.cs Program.cs)
 
+add_example(NAME FunctionExecutionCs
+       SOURCE Program.cs)
+
 add_example(NAME PdxAutoSerializer
        SOURCE Order.cs Program.cs)
 
diff --git a/examples/dotnet/CMakeLists.txt.in 
b/examples/dotnet/CMakeLists.txt.in
index 5035bec..2257e75 100644
--- a/examples/dotnet/CMakeLists.txt.in
+++ b/examples/dotnet/CMakeLists.txt.in
@@ -20,6 +20,7 @@ project(@[email protected] LANGUAGES NONE)
 add_subdirectory(AuthInitialize)
 add_subdirectory(ContinuousQueryCs)
 add_subdirectory(DataSerializableCs)
+add_subdirectory(FunctionExecutionCs)
 add_subdirectory(PdxAutoSerializer)
 add_subdirectory(PdxSerializableCs)
 add_subdirectory(PutGetRemove)
diff --git a/examples/dotnet/ContinuousQueryCs/MyCqListener.cs 
b/examples/dotnet/ContinuousQueryCs/MyCqListener.cs
index 9037ca0..9d186b4 100644
--- a/examples/dotnet/ContinuousQueryCs/MyCqListener.cs
+++ b/examples/dotnet/ContinuousQueryCs/MyCqListener.cs
@@ -21,48 +21,48 @@ using Apache.Geode.Client;
 
 namespace Apache.Geode.Examples.ContinuousQuery
 {
-    public class MyCqListener<TKey, TResult> : ICqListener<TKey, TResult>
+  public class MyCqListener<TKey, TResult> : ICqListener<TKey, TResult>
+  {
+    public virtual void OnEvent(CqEvent<TKey, TResult> ev)
     {
-        public virtual void OnEvent(CqEvent<TKey, TResult> ev)
-        {
-            Order val = ev.getNewValue() as Order;
-            TKey key = ev.getKey();
-            string operationType = "UNKNOWN";
+      Order val = ev.getNewValue() as Order;
+      TKey key = ev.getKey();
+      string operationType = "UNKNOWN";
 
-            switch (ev.getQueryOperation())
-            {
-                case CqOperation.OP_TYPE_CREATE:
-                    operationType = "CREATE";
-                    break;
-                case CqOperation.OP_TYPE_UPDATE:
-                    operationType = "UPDATE";
-                    break;
-                case CqOperation.OP_TYPE_DESTROY:
-                    operationType = "DESTROY";
-                    break;
-                default:
-                    Console.WriteLine("Unexpected operation encountered {0}", 
ev.getQueryOperation());
-                    break;
-            }
+      switch (ev.getQueryOperation())
+      {
+        case CqOperation.OP_TYPE_CREATE:
+          operationType = "CREATE";
+          break;
+        case CqOperation.OP_TYPE_UPDATE:
+          operationType = "UPDATE";
+          break;
+        case CqOperation.OP_TYPE_DESTROY:
+          operationType = "DESTROY";
+          break;
+        default:
+          Console.WriteLine("Unexpected operation encountered {0}", 
ev.getQueryOperation());
+          break;
+      }
 
-            if (val != null)
-            {
-                Console.WriteLine("MyCqListener::OnEvent({0}) called with key 
{1}, value {2}", operationType, key, val.ToString());
-            }
-            else
-            {
-                Console.WriteLine("MyCqListener::OnEvent({0}) called with key 
{1}, value null", operationType, key);
-            }
-        }
+      if (val != null)
+      {
+        Console.WriteLine("MyCqListener::OnEvent({0}) called with key {1}, 
value {2}", operationType, key, val.ToString());
+      }
+      else
+      {
+        Console.WriteLine("MyCqListener::OnEvent({0}) called with key {1}, 
value null", operationType, key);
+      }
+    }
 
-        public virtual void OnError(CqEvent<TKey, TResult> ev)
-        {
-            Console.WriteLine("MyCqListener::OnError called");
-        }
+    public virtual void OnError(CqEvent<TKey, TResult> ev)
+    {
+      Console.WriteLine("MyCqListener::OnError called");
+    }
 
-        public virtual void Close()
-        {
-            Console.WriteLine("MyCqListener::close called");
-        }
+    public virtual void Close()
+    {
+      Console.WriteLine("MyCqListener::close called");
     }
+  }
 }
diff --git a/examples/dotnet/ContinuousQueryCs/Order.cs 
b/examples/dotnet/ContinuousQueryCs/Order.cs
index 62a354a..011f94c 100644
--- a/examples/dotnet/ContinuousQueryCs/Order.cs
+++ b/examples/dotnet/ContinuousQueryCs/Order.cs
@@ -19,53 +19,53 @@ using System;
 
 namespace Apache.Geode.Examples.ContinuousQuery
 {
-    public class Order : IPdxSerializable
-    {
-        private const string ORDER_ID_KEY_ = "order_id";
-        private const string NAME_KEY_ = "name";
-        private const string QUANTITY_KEY_ = "quantity";
+  public class Order : IPdxSerializable
+  {
+    private const string ORDER_ID_KEY_ = "order_id";
+    private const string NAME_KEY_ = "name";
+    private const string QUANTITY_KEY_ = "quantity";
 
-        public long OrderId { get; set; }
-        public string Name { get; set; }
-        public short Quantity { get; set; }
+    public long OrderId { get; set; }
+    public string Name { get; set; }
+    public short Quantity { get; set; }
 
-        // A default constructor is required for deserialization
-        public Order() { }
+    // A default constructor is required for deserialization
+    public Order() { }
 
-        public Order(int orderId, string name, short quantity)
-        {
-            OrderId = orderId;
-            Name = name;
-            Quantity = quantity;
-        }
+    public Order(int orderId, string name, short quantity)
+    {
+      OrderId = orderId;
+      Name = name;
+      Quantity = quantity;
+    }
 
-        public override string ToString()
-        {
-            return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, 
Quantity);
-        }
+    public override string ToString()
+    {
+      return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
+    }
 
-        public void ToData(IPdxWriter output)
-        {
-            output.WriteLong(ORDER_ID_KEY_, OrderId);
-            output.MarkIdentityField(ORDER_ID_KEY_);
+    public void ToData(IPdxWriter output)
+    {
+      output.WriteLong(ORDER_ID_KEY_, OrderId);
+      output.MarkIdentityField(ORDER_ID_KEY_);
 
-            output.WriteString(NAME_KEY_, Name);
-            output.MarkIdentityField(NAME_KEY_);
+      output.WriteString(NAME_KEY_, Name);
+      output.MarkIdentityField(NAME_KEY_);
 
-            output.WriteInt(QUANTITY_KEY_, Quantity);
-            output.MarkIdentityField(QUANTITY_KEY_);
-        }
+      output.WriteInt(QUANTITY_KEY_, Quantity);
+      output.MarkIdentityField(QUANTITY_KEY_);
+    }
 
-        public void FromData(IPdxReader input)
-        {
-            OrderId = input.ReadLong(ORDER_ID_KEY_);
-            Name = input.ReadString(NAME_KEY_);
-            Quantity = (short)input.ReadInt(QUANTITY_KEY_);
-        }
+    public void FromData(IPdxReader input)
+    {
+      OrderId = input.ReadLong(ORDER_ID_KEY_);
+      Name = input.ReadString(NAME_KEY_);
+      Quantity = (short)input.ReadInt(QUANTITY_KEY_);
+    }
 
-        public static IPdxSerializable CreateDeserializable()
-        {
-            return new Order();
-        }
+    public static IPdxSerializable CreateDeserializable()
+    {
+      return new Order();
     }
+  }
 }
diff --git a/examples/dotnet/ContinuousQueryCs/Program.cs 
b/examples/dotnet/ContinuousQueryCs/Program.cs
index a9db35c..7d826de 100644
--- a/examples/dotnet/ContinuousQueryCs/Program.cs
+++ b/examples/dotnet/ContinuousQueryCs/Program.cs
@@ -20,72 +20,75 @@ using Apache.Geode.Client;
 
 namespace Apache.Geode.Examples.ContinuousQuery
 {
-    public class Program
+  public class Program
+  {
+    public static void Main(string[] args)
     {
-        public static void Main(string[] args)
-        {
-            var cacheFactory = new CacheFactory()
-                .Set("log-level", "none");
-            var cache = cacheFactory.Create();
-
-            Console.WriteLine("Registering for data serialization");
-
-            cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
-
-            var poolFactory = cache.GetPoolFactory()
-                .AddLocator("localhost", 10334);
-            var pool = poolFactory
-              .SetSubscriptionEnabled(true)
-              .Create("pool");
-
-            var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
-                .SetPoolName("pool");
-            var orderRegion = regionFactory.Create<string, 
Order>("example_orderobject");
-
-            var queryService = pool.GetQueryService();
-
-            var cqAttributesFactory = new CqAttributesFactory<string, Order>();
-
-            var cqListener = new MyCqListener<string, Order>();
-
-            cqAttributesFactory.AddCqListener(cqListener);
-
-            var cqAttributes = cqAttributesFactory.Create();
-            try {
-              var query = queryService.NewCq("MyCq", "SELECT * FROM 
/example_orderobject WHERE quantity > 30", cqAttributes, false);
-
-              Console.WriteLine("Executing continuous query");
-              query.Execute();
-            
-              Console.WriteLine("Create orders");
-              var order1 = new Order(1, "product x", 23);
-              var order2 = new Order(2, "product y", 37);
-              var order3 = new Order(3, "product z", 1);
-              var order4 = new Order(4, "product z", 102);
-              var order5 = new Order(5, "product x", 17);
-              var order6 = new Order(6, "product z", 42);
-            
-              Console.WriteLine("Putting and changing Order objects in the 
region");
-              orderRegion.Put("Order1", order1);
-              orderRegion.Put("Order2", order2);
-              orderRegion.Put("Order3", order3);
-              orderRegion.Put("Order4", order4);
-              orderRegion.Put("Order5", order5);
-              orderRegion.Put("Order6", order6);
-            
-              orderRegion.Put("Order2", new Order(2, "product y", 45));
-              orderRegion.Put("Order2", new Order(2, "product y", 29));
-              orderRegion.Remove("Order6");
-
-              System.Threading.Thread.Sleep(2000);
-
-              query.Stop();
-              query.Close();
-            } catch (IllegalStateException ex) {
-              Console.WriteLine(ex.Message);
-            }
-         
-            cache.Close();
-        }
+      var cacheFactory = new CacheFactory()
+          .Set("log-level", "none");
+      var cache = cacheFactory.Create();
+
+      Console.WriteLine("Registering for data serialization");
+
+      cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
+
+      var poolFactory = cache.GetPoolFactory()
+          .AddLocator("localhost", 10334);
+      var pool = poolFactory
+        .SetSubscriptionEnabled(true)
+        .Create("pool");
+
+      var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+          .SetPoolName("pool");
+      var orderRegion = regionFactory.Create<string, 
Order>("example_orderobject");
+
+      var queryService = pool.GetQueryService();
+
+      var cqAttributesFactory = new CqAttributesFactory<string, Order>();
+
+      var cqListener = new MyCqListener<string, Order>();
+
+      cqAttributesFactory.AddCqListener(cqListener);
+
+      var cqAttributes = cqAttributesFactory.Create();
+      try
+      {
+        var query = queryService.NewCq("MyCq", "SELECT * FROM 
/example_orderobject WHERE quantity > 30", cqAttributes, false);
+
+        Console.WriteLine("Executing continuous query");
+        query.Execute();
+
+        Console.WriteLine("Create orders");
+        var order1 = new Order(1, "product x", 23);
+        var order2 = new Order(2, "product y", 37);
+        var order3 = new Order(3, "product z", 1);
+        var order4 = new Order(4, "product z", 102);
+        var order5 = new Order(5, "product x", 17);
+        var order6 = new Order(6, "product z", 42);
+
+        Console.WriteLine("Putting and changing Order objects in the region");
+        orderRegion.Put("Order1", order1);
+        orderRegion.Put("Order2", order2);
+        orderRegion.Put("Order3", order3);
+        orderRegion.Put("Order4", order4);
+        orderRegion.Put("Order5", order5);
+        orderRegion.Put("Order6", order6);
+
+        orderRegion.Put("Order2", new Order(2, "product y", 45));
+        orderRegion.Put("Order2", new Order(2, "product y", 29));
+        orderRegion.Remove("Order6");
+
+        System.Threading.Thread.Sleep(2000);
+
+        query.Stop();
+        query.Close();
+      }
+      catch (IllegalStateException ex)
+      {
+        Console.WriteLine(ex.Message);
+      }
+
+      cache.Close();
     }
+  }
 }
diff --git a/examples/dotnet/DataSerializableCs/Program.cs 
b/examples/dotnet/DataSerializableCs/Program.cs
index 3daef73..b37010f 100644
--- a/examples/dotnet/DataSerializableCs/Program.cs
+++ b/examples/dotnet/DataSerializableCs/Program.cs
@@ -20,43 +20,43 @@ using Apache.Geode.Client;
 
 namespace Apache.Geode.Examples.Serializer
 {
-    public class Program
+  public class Program
+  {
+    public static void Main(string[] args)
     {
-        public static void Main(string[] args)
-        {
-            var cacheFactory = new CacheFactory()
-                .Set("log-level", "none");
-            var cache = cacheFactory.Create();
+      var cacheFactory = new CacheFactory()
+          .Set("log-level", "none");
+      var cache = cacheFactory.Create();
 
-            Console.WriteLine("Registering for data serialization");
+      Console.WriteLine("Registering for data serialization");
 
-            cache.TypeRegistry.RegisterType(Order.CreateDeserializable, 7);
+      cache.TypeRegistry.RegisterType(Order.CreateDeserializable, 7);
 
-            var poolFactory = cache.GetPoolFactory()
-                .AddLocator("localhost", 10334);
-            poolFactory.Create("pool");
+      var poolFactory = cache.GetPoolFactory()
+          .AddLocator("localhost", 10334);
+      poolFactory.Create("pool");
 
-            var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
-                .SetPoolName("pool");
-            var orderRegion = regionFactory.Create<int, 
Order>("example_orderobject");
+      var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+          .SetPoolName("pool");
+      var orderRegion = regionFactory.Create<int, 
Order>("example_orderobject");
 
-            Console.WriteLine("Storing order object in the region");
+      Console.WriteLine("Storing order object in the region");
 
-            const int orderKey = 65;
+      const int orderKey = 65;
 
-            var order = new Order(orderKey, "Donuts", 12);
+      var order = new Order(orderKey, "Donuts", 12);
 
-            Console.WriteLine("order to put is " + order);
-            orderRegion.Put(orderKey, order, null);
+      Console.WriteLine("order to put is " + order);
+      orderRegion.Put(orderKey, order, null);
 
-            Console.WriteLine("Successfully put order, getting now...");
-            var orderRetrieved = orderRegion.Get(orderKey, null);
+      Console.WriteLine("Successfully put order, getting now...");
+      var orderRetrieved = orderRegion.Get(orderKey, null);
 
-            Console.WriteLine("Order key: " + orderKey + " = " + 
orderRetrieved);
+      Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
 
-            cache.Close();
-        }
+      cache.Close();
     }
+  }
 }
 
 
diff --git a/examples/dotnet/FunctionExecutionCs/Program.cs 
b/examples/dotnet/FunctionExecutionCs/Program.cs
new file mode 100644
index 0000000..3ad385d
--- /dev/null
+++ b/examples/dotnet/FunctionExecutionCs/Program.cs
@@ -0,0 +1,82 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You 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.
+*/
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using Apache.Geode.Client;
+
+namespace Apache.Geode.Examples.FunctionExecution
+{
+  class Program
+  {
+    static void Main(string[] args)
+    {
+      var cacheFactory = new CacheFactory()
+          .Set("log-level", "none");
+      var cache = cacheFactory.Create();
+
+      var poolFactory = cache.GetPoolFactory()
+          .AddLocator("localhost", 10334);
+      var pool = poolFactory.Create("pool");
+
+      var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+          .SetPoolName("pool");
+      var region = regionFactory.Create<object, object>("partition_region");
+
+      Console.WriteLine("Storing id and username in the region");
+
+      string rtimmonsKey = "rtimmons";
+      string rtimmonsValue = "Robert Timmons";
+      string scharlesKey = "scharles";
+      string scharlesValue = "Sylvia Charles";
+
+      region.Put(rtimmonsKey, rtimmonsValue, null);
+      region.Put(scharlesKey, scharlesValue, null);
+
+      Console.WriteLine("Getting the user info from the region");
+      var user1 = region.Get(rtimmonsKey, null);
+      var user2 = region.Get(scharlesKey, null);
+
+      Console.WriteLine(rtimmonsKey + " = " + user1);
+      Console.WriteLine(scharlesKey + " = " + user2);
+
+      ArrayList keyArgs = new ArrayList();
+      keyArgs.Add(rtimmonsKey);
+      keyArgs.Add(scharlesKey);
+
+      var exc = Client.FunctionService<object>.OnRegion<object, 
object>(region);
+
+      Client.IResultCollector<object> rc = 
exc.WithArgs<object>(keyArgs).Execute("ExampleMultiGetFunction");
+
+      ICollection<object> res = rc.GetResult();
+
+      Console.WriteLine("Function Execution Results:");
+      Console.WriteLine("   Count = {0}", res.Count);
+
+      foreach (List<object> item in res)
+      {
+        foreach (object item2 in item)
+        {
+          Console.WriteLine("   value = {0}", item2.ToString());
+        }
+      }
+
+      cache.Close();
+    }
+  }
+}
diff --git a/examples/dotnet/FunctionExecutionCs/README.md 
b/examples/dotnet/FunctionExecutionCs/README.md
new file mode 100644
index 0000000..63045e6
--- /dev/null
+++ b/examples/dotnet/FunctionExecutionCs/README.md
@@ -0,0 +1,25 @@
+# FunctionExecution Example
+This example illustrates how to execute server side java functions.
+
+## Prerequisites
+* Install [Apache Geode](https://geode.apache.org)
+* Build and install [Apache Geode 
Native](https://github.com/apache/geode-native)
+
+## Running
+* Run the following Powershell script which starts the Geode Locator, deploys 
the jar file containing your function, starts the Geode Server, and creates the 
region.
+  ```
+  PS> startserver.ps1
+  ```
+* Execute `Apache.Geode.Examples.FunctionExecutionCs.exe`.
+  
+  output:
+  ```
+  Storing id and username in the region
+  Getting the user info from the region
+  rtimmons = Robert Timmons
+  scharles = Sylvia Charles
+  Function Execution Results:
+     Count = 1
+     value = Robert Timmons
+     value = Sylvia Charles
+  ```
diff --git a/examples/dotnet/FunctionExecutionCs/startserver.ps1 
b/examples/dotnet/FunctionExecutionCs/startserver.ps1
new file mode 100644
index 0000000..bc38327
--- /dev/null
+++ b/examples/dotnet/FunctionExecutionCs/startserver.ps1
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+$GFSH_PATH = ""
+if (Get-Command gfsh -ErrorAction SilentlyContinue)
+{
+    $GFSH_PATH = "gfsh"
+}
+else
+{
+    if (-not (Test-Path env:GEODE_HOME))
+    {
+        Write-Host "Could not find gfsh.  Please set the GEODE_HOME path. e.g. 
"
+        Write-Host "(Powershell) `$env:GEODE_HOME = <path to Geode>"
+        Write-Host " OR"
+        Write-Host "(Command-line) set %GEODE_HOME% = <path to Geode>"
+    }
+    else
+    {
+        $GFSH_PATH = "$env:GEODE_HOME\bin\gfsh.bat"
+    }
+}
+
+if ($GFSH_PATH -ne "")
+{
+   Invoke-Expression "$GFSH_PATH -e 'start locator --name=locator 
--dir=$PSScriptRoot/locator' -e 'deploy --jar=../../utilities/example.jar' -e 
'start server --name=the-server --server-port=50505' -e 'create region 
--name=partition_region --type=PARTITION'"
+}
\ No newline at end of file
diff --git a/examples/dotnet/CMakeLists.txt.in 
b/examples/dotnet/FunctionExecutionCs/stopserver.ps1
similarity index 52%
copy from examples/dotnet/CMakeLists.txt.in
copy to examples/dotnet/FunctionExecutionCs/stopserver.ps1
index 5035bec..742ce8d 100644
--- a/examples/dotnet/CMakeLists.txt.in
+++ b/examples/dotnet/FunctionExecutionCs/stopserver.ps1
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
+# Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
 # The ASF licenses this file to You under the Apache License, Version 2.0
@@ -13,15 +13,27 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-cmake_minimum_required(VERSION 3.10)
-
-project(@[email protected] LANGUAGES NONE)
-
-add_subdirectory(AuthInitialize)
-add_subdirectory(ContinuousQueryCs)
-add_subdirectory(DataSerializableCs)
-add_subdirectory(PdxAutoSerializer)
-add_subdirectory(PdxSerializableCs)
-add_subdirectory(PutGetRemove)
-add_subdirectory(RemoteQueryCs)
+$GFSH_PATH = ""
+if (Get-Command gfsh -ErrorAction SilentlyContinue)
+{
+    $GFSH_PATH = "gfsh"
+}
+else
+{
+    if (-not (Test-Path env:GEODE_HOME))
+    {
+        Write-Host "Could not find gfsh.  Please set the GEODE_HOME path. e.g. 
"
+        Write-Host "(Powershell) `$env:GEODE_HOME = <path to Geode>"
+        Write-Host " OR"
+        Write-Host "(Command-line) set %GEODE_HOME% = <path to Geode>"
+    }
+    else
+    {
+        $GFSH_PATH = "$env:GEODE_HOME\bin\gfsh.bat"
+    }
+}
 
+if ($GFSH_PATH -ne "")
+{
+   Invoke-Expression "$GFSH_PATH -e 'connect' -e 'shutdown 
--include-locators=true'"
+}
\ No newline at end of file
diff --git a/examples/dotnet/PdxAutoSerializer/Order.cs 
b/examples/dotnet/PdxAutoSerializer/Order.cs
index 8f7c1e8..7635f11 100644
--- a/examples/dotnet/PdxAutoSerializer/Order.cs
+++ b/examples/dotnet/PdxAutoSerializer/Order.cs
@@ -17,27 +17,27 @@
 
 namespace Apache.Geode.Examples.Serializer
 {
-    public class Order
-    {
-        public int OrderId { get; set; }
-        public string Name { get; set; }
-        public short Quantity { get; set; }
+  public class Order
+  {
+    public int OrderId { get; set; }
+    public string Name { get; set; }
+    public short Quantity { get; set; }
 
-        // A default constructor is required for reflection based 
autoserialization
-        public Order() { }
+    // A default constructor is required for reflection based autoserialization
+    public Order() { }
 
-        public Order(int orderId, string name, short quantity)
-        {
-            OrderId = orderId;
-            Name = name;
-            Quantity = quantity;
-        }
+    public Order(int orderId, string name, short quantity)
+    {
+      OrderId = orderId;
+      Name = name;
+      Quantity = quantity;
+    }
 
-        public override string ToString()
-        {
-            return "Order: [" + OrderId + ", " + Name + ", " + Quantity + "]";
-        }
+    public override string ToString()
+    {
+      return "Order: [" + OrderId + ", " + Name + ", " + Quantity + "]";
     }
+  }
 }
 
 
diff --git a/examples/dotnet/PdxAutoSerializer/Program.cs 
b/examples/dotnet/PdxAutoSerializer/Program.cs
index a5ea514..2cacc78 100644
--- a/examples/dotnet/PdxAutoSerializer/Program.cs
+++ b/examples/dotnet/PdxAutoSerializer/Program.cs
@@ -20,43 +20,43 @@ using Apache.Geode.Client;
 
 namespace Apache.Geode.Examples.Serializer
 {
-    public class Program
+  public class Program
+  {
+    public static void Main(string[] args)
     {
-        public static void Main(string[] args)
-        {
-            var cacheFactory = new CacheFactory()
-                .Set("log-level", "none");
-            var cache = cacheFactory.Create();
+      var cacheFactory = new CacheFactory()
+          .Set("log-level", "none");
+      var cache = cacheFactory.Create();
 
-            Console.WriteLine("Registering for reflection-based auto 
serialization");
+      Console.WriteLine("Registering for reflection-based auto serialization");
 
-            cache.TypeRegistry.PdxSerializer = new 
ReflectionBasedAutoSerializer();
+      cache.TypeRegistry.PdxSerializer = new ReflectionBasedAutoSerializer();
 
-            var poolFactory = cache.GetPoolFactory()
-                .AddLocator("localhost", 10334);
-            poolFactory.Create("pool");
+      var poolFactory = cache.GetPoolFactory()
+          .AddLocator("localhost", 10334);
+      poolFactory.Create("pool");
 
-            var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
-                .SetPoolName("pool");
-            var orderRegion = regionFactory.Create<int, 
Order>("example_orderobject");
+      var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+          .SetPoolName("pool");
+      var orderRegion = regionFactory.Create<int, 
Order>("example_orderobject");
 
-            Console.WriteLine("Storing order object in the region");
+      Console.WriteLine("Storing order object in the region");
 
-            const int orderKey = 65;
+      const int orderKey = 65;
 
-            var order = new Order(orderKey, "Vox AC30", 11);
+      var order = new Order(orderKey, "Vox AC30", 11);
 
-            Console.WriteLine("order to put is " + order);
-            orderRegion.Put(orderKey, order, null);
+      Console.WriteLine("order to put is " + order);
+      orderRegion.Put(orderKey, order, null);
 
-            Console.WriteLine("Successfully put order, getting now...");
-            var orderRetrieved = orderRegion.Get(orderKey, null);
+      Console.WriteLine("Successfully put order, getting now...");
+      var orderRetrieved = orderRegion.Get(orderKey, null);
 
-            Console.WriteLine("Order key: " + orderKey + " = " + 
orderRetrieved);
+      Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
 
-            cache.Close();
-        }
+      cache.Close();
     }
+  }
 }
 
 
diff --git a/examples/dotnet/PdxSerializableCs/Order.cs 
b/examples/dotnet/PdxSerializableCs/Order.cs
index 20ca913..968eaf4 100644
--- a/examples/dotnet/PdxSerializableCs/Order.cs
+++ b/examples/dotnet/PdxSerializableCs/Order.cs
@@ -19,55 +19,55 @@ using System;
 
 namespace Apache.Geode.Examples.Serializer
 {
-    public class Order : IPdxSerializable
-    {
-        private const string ORDER_ID_KEY_ = "order_id";
-        private const string NAME_KEY_ = "name";
-        private const string QUANTITY_KEY_ = "quantity";
+  public class Order : IPdxSerializable
+  {
+    private const string ORDER_ID_KEY_ = "order_id";
+    private const string NAME_KEY_ = "name";
+    private const string QUANTITY_KEY_ = "quantity";
 
-        public long OrderId { get; set; }
-        public string Name { get; set; }
-        public short Quantity { get; set; }
+    public long OrderId { get; set; }
+    public string Name { get; set; }
+    public short Quantity { get; set; }
 
-        // A default constructor is required for deserialization
-        public Order() { }
+    // A default constructor is required for deserialization
+    public Order() { }
 
-        public Order(int orderId, string name, short quantity)
-        {
-            OrderId = orderId;
-            Name = name;
-            Quantity = quantity;
-        }
+    public Order(int orderId, string name, short quantity)
+    {
+      OrderId = orderId;
+      Name = name;
+      Quantity = quantity;
+    }
 
-        public override string ToString()
-        {
-            return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, 
Quantity);
-        }
+    public override string ToString()
+    {
+      return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
+    }
 
-        public void ToData(IPdxWriter output)
-        {
-            output.WriteLong(ORDER_ID_KEY_, OrderId);
-            output.MarkIdentityField(ORDER_ID_KEY_);
+    public void ToData(IPdxWriter output)
+    {
+      output.WriteLong(ORDER_ID_KEY_, OrderId);
+      output.MarkIdentityField(ORDER_ID_KEY_);
 
-            output.WriteString(NAME_KEY_, Name);
-            output.MarkIdentityField(NAME_KEY_);
+      output.WriteString(NAME_KEY_, Name);
+      output.MarkIdentityField(NAME_KEY_);
 
-            output.WriteInt(QUANTITY_KEY_, Quantity);
-            output.MarkIdentityField(QUANTITY_KEY_);
-        }
+      output.WriteInt(QUANTITY_KEY_, Quantity);
+      output.MarkIdentityField(QUANTITY_KEY_);
+    }
 
-        public void FromData(IPdxReader input)
-        {
-            OrderId = input.ReadLong(ORDER_ID_KEY_);
-            Name = input.ReadString(NAME_KEY_);
-            Quantity = (short)input.ReadInt(QUANTITY_KEY_);
-        }
+    public void FromData(IPdxReader input)
+    {
+      OrderId = input.ReadLong(ORDER_ID_KEY_);
+      Name = input.ReadString(NAME_KEY_);
+      Quantity = (short)input.ReadInt(QUANTITY_KEY_);
+    }
 
-        public static IPdxSerializable CreateDeserializable()
-        {
-            return new Order();
-        }
+    public static IPdxSerializable CreateDeserializable()
+    {
+      return new Order();
     }
+  }
 }
 
 
diff --git a/examples/dotnet/PdxSerializableCs/Program.cs 
b/examples/dotnet/PdxSerializableCs/Program.cs
index 85580d6..30a07ef 100644
--- a/examples/dotnet/PdxSerializableCs/Program.cs
+++ b/examples/dotnet/PdxSerializableCs/Program.cs
@@ -20,43 +20,43 @@ using Apache.Geode.Client;
 
 namespace Apache.Geode.Examples.Serializer
 {
-    public class Program
+  public class Program
+  {
+    public static void Main(string[] args)
     {
-        public static void Main(string[] args)
-        {
-            var cacheFactory = new CacheFactory()
-                .Set("log-level", "none");
-            var cache = cacheFactory.Create();
+      var cacheFactory = new CacheFactory()
+          .Set("log-level", "none");
+      var cache = cacheFactory.Create();
 
-            Console.WriteLine("Registering for data serialization");
+      Console.WriteLine("Registering for data serialization");
 
-            cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
+      cache.TypeRegistry.RegisterPdxType(Order.CreateDeserializable);
 
-            var poolFactory = cache.GetPoolFactory()
-                .AddLocator("localhost", 10334);
-            poolFactory.Create("pool");
+      var poolFactory = cache.GetPoolFactory()
+          .AddLocator("localhost", 10334);
+      poolFactory.Create("pool");
 
-            var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
-                .SetPoolName("pool");
-            var orderRegion = regionFactory.Create<int, 
Order>("example_orderobject");
+      var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+          .SetPoolName("pool");
+      var orderRegion = regionFactory.Create<int, 
Order>("example_orderobject");
 
-            Console.WriteLine("Storing order object in the region");
+      Console.WriteLine("Storing order object in the region");
 
-            const int orderKey = 65;
+      const int orderKey = 65;
 
-            var order = new Order(orderKey, "Donuts", 12);
+      var order = new Order(orderKey, "Donuts", 12);
 
-            Console.WriteLine("order to put is " + order);
-            orderRegion.Put(orderKey, order, null);
+      Console.WriteLine("order to put is " + order);
+      orderRegion.Put(orderKey, order, null);
 
-            Console.WriteLine("Successfully put order, getting now...");
-            var orderRetrieved = orderRegion.Get(orderKey, null);
+      Console.WriteLine("Successfully put order, getting now...");
+      var orderRetrieved = orderRegion.Get(orderKey, null);
 
-            Console.WriteLine("Order key: " + orderKey + " = " + 
orderRetrieved);
+      Console.WriteLine("Order key: " + orderKey + " = " + orderRetrieved);
 
-            cache.Close();
-        }
+      cache.Close();
     }
+  }
 }
 
 
diff --git a/examples/dotnet/PutGetRemove/Program.cs 
b/examples/dotnet/PutGetRemove/Program.cs
index 121d640..8bbe9f1 100644
--- a/examples/dotnet/PutGetRemove/Program.cs
+++ b/examples/dotnet/PutGetRemove/Program.cs
@@ -20,51 +20,51 @@ using Apache.Geode.Client;
 
 namespace Apache.Geode.Examples.PutGetRemove
 {
-    class Program
+  class Program
+  {
+    static void Main(string[] args)
     {
-        static void Main(string[] args)
-        {
-            var cacheFactory = new CacheFactory()
-                .Set("log-level", "none");
-            var cache = cacheFactory.Create();
+      var cacheFactory = new CacheFactory()
+          .Set("log-level", "none");
+      var cache = cacheFactory.Create();
 
-            var poolFactory = cache.GetPoolFactory()
-                .AddLocator("localhost", 10334);
-            poolFactory.Create("pool");
+      var poolFactory = cache.GetPoolFactory()
+          .AddLocator("localhost", 10334);
+      poolFactory.Create("pool");
 
-            var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
-                .SetPoolName("pool");
-            var region = regionFactory.Create<string, 
string>("example_userinfo");
+      var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+          .SetPoolName("pool");
+      var region = regionFactory.Create<string, string>("example_userinfo");
 
-            Console.WriteLine("Storing id and username in the region");
+      Console.WriteLine("Storing id and username in the region");
 
-            const string rtimmonsKey = "rtimmons";
-            const string rtimmonsValue = "Robert Timmons";
-            const string scharlesKey = "scharles";
-            const string scharlesValue = "Sylvia Charles";
+      const string rtimmonsKey = "rtimmons";
+      const string rtimmonsValue = "Robert Timmons";
+      const string scharlesKey = "scharles";
+      const string scharlesValue = "Sylvia Charles";
 
-            region.Put(rtimmonsKey, rtimmonsValue, null);
-            region.Put(scharlesKey, scharlesValue, null);
+      region.Put(rtimmonsKey, rtimmonsValue, null);
+      region.Put(scharlesKey, scharlesValue, null);
 
-            Console.WriteLine("Getting the user info from the region");
-            var user1 = region.Get(rtimmonsKey, null);
-            var user2 = region.Get(scharlesKey, null);
+      Console.WriteLine("Getting the user info from the region");
+      var user1 = region.Get(rtimmonsKey, null);
+      var user2 = region.Get(scharlesKey, null);
 
-            Console.WriteLine(rtimmonsKey + " = " + user1);
-            Console.WriteLine(scharlesKey + " = " + user2);
+      Console.WriteLine(rtimmonsKey + " = " + user1);
+      Console.WriteLine(scharlesKey + " = " + user2);
 
-            Console.WriteLine("Removing " + rtimmonsKey + " info from the 
region");
+      Console.WriteLine("Removing " + rtimmonsKey + " info from the region");
 
-            if (region.Remove(rtimmonsKey))
-            {
-                Console.WriteLine("Info for " + rtimmonsKey + " has been 
deleted");
-            }
-            else
-            {
-                Console.WriteLine("Info for " + rtimmonsKey + " has not been 
deleted");
-            }
+      if (region.Remove(rtimmonsKey))
+      {
+        Console.WriteLine("Info for " + rtimmonsKey + " has been deleted");
+      }
+      else
+      {
+        Console.WriteLine("Info for " + rtimmonsKey + " has not been deleted");
+      }
 
-            cache.Close();
-        }
+      cache.Close();
     }
+  }
 }

Reply via email to