summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/plugin/PluginFactory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/test/Ice/plugin/PluginFactory.cs')
-rw-r--r--csharp/test/Ice/plugin/PluginFactory.cs64
1 files changed, 64 insertions, 0 deletions
diff --git a/csharp/test/Ice/plugin/PluginFactory.cs b/csharp/test/Ice/plugin/PluginFactory.cs
new file mode 100644
index 00000000000..578f5104218
--- /dev/null
+++ b/csharp/test/Ice/plugin/PluginFactory.cs
@@ -0,0 +1,64 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+using System;
+
+public class PluginFactory : Ice.PluginFactory
+{
+ public Ice.Plugin create(Ice.Communicator communicator, string name, string[] args)
+ {
+ return new Plugin(communicator, args);
+ }
+
+ internal class Plugin : Ice.Plugin
+ {
+ public Plugin(Ice.Communicator communicator, string[] args)
+ {
+ _args = args;
+ }
+
+ public void initialize()
+ {
+ _initialized = true;
+ test(_args.Length == 3);
+ test(_args[0] == "C:\\Program Files\\");
+ test(_args[1] == "--DatabasePath");
+ test(_args[2] == "C:\\Program Files\\Application\\db");
+ }
+
+ public void destroy()
+ {
+ _destroyed = true;
+ }
+
+ ~Plugin()
+ {
+ if(!_initialized)
+ {
+ Console.WriteLine("Plugin not initialized");
+ }
+ if(!_destroyed)
+ {
+ Console.WriteLine("Plugin not destroyed");
+ }
+ }
+
+ private static void test(bool b)
+ {
+ if(!b)
+ {
+ throw new System.Exception();
+ }
+ }
+
+ private bool _initialized = false;
+ private bool _destroyed = false;
+ private string[] _args;
+ }
+}