You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2010/05/28 20:09:12 UTC

svn commit: r949245 [3/3] - in /qpid/trunk/qpid/cpp/bindings/qpid/dotnet: ./ examples/csharp.direct.receiver/ examples/csharp.direct.sender/ examples/csharp.map.callback.receiver/ examples/csharp.map.callback.receiver/Properties/ examples/csharp.map.ca...

Added: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj?rev=949245&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj Fri May 28 18:09:10 2010
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>org.apache.qpid.messaging.sessionreceiver</RootNamespace>
+    <AssemblyName>org.apache.qpid.messaging.sessionreceiver</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\..\..\src\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="sessionreceiver.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\org.apache.qpid.messaging.vcproj">
+      <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+      <Name>org.apache.qpid.messaging</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

Added: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs?rev=949245&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs Fri May 28 18:09:10 2010
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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.Generic;
+using System.Linq;
+using System.Text;
+using org.apache.qpid.messaging;
+
+namespace org.apache.qpid.messaging.sessionreceiver
+{
+    /// <summary>
+    /// ISessionReceiver interface defines the callback for users to supply.
+    /// Once established this callback will receive all messages for all 
+    /// receivers defined by the current session.
+    /// Users are expected not to 'fetch' or 'get' messages by any other means.
+    /// Users must acknowledge() the Session's messages either in the callback
+    /// function or by some other scheme.
+    /// </summary>
+
+    public interface ISessionReceiver
+    {
+        void SessionReceiver(Receiver receiver, Message message);
+    }
+
+    
+    /// <summary>
+    /// eventEngine - wait for messages from the underlying C++ code.
+    /// When available get them and deliver them via callback to our 
+    /// client through the ISessionReceiver interface.
+    /// This class consumes the thread that calls the Run() function.
+    /// </summary>
+
+    internal class eventEngine
+    {
+        private Session          session;
+        private ISessionReceiver callback;
+        private bool             keepRunning;
+
+        public eventEngine(Session theSession, ISessionReceiver thecallback)
+        {
+            this.session  = theSession;
+            this.callback = thecallback;
+        }
+
+        /// <summary>
+        /// Function to call Session's nextReceiver, discover messages,
+        /// and to deliver messages through the callback.
+        /// </summary>
+        public void open()
+        {
+            Receiver rcvr = session.createReceiver();
+            Message  msg;
+
+            keepRunning = true;
+            while (keepRunning)
+            {
+                if (session.nextReceiver(rcvr, DurationConstants.SECOND))
+                {
+                    if (keepRunning)
+                    {
+                        msg = rcvr.fetch(DurationConstants.SECOND);
+                        this.callback.SessionReceiver(rcvr, msg);
+                    }
+                }
+                //else
+                //    receive timed out
+                //    eventEngine exits the nextReceiver() function periodically
+                //    in order to test the keepRunning flag
+            }
+            // Private thread is now exiting.
+        }
+
+        /// <summary>
+        /// Function to stop the eventEngine. Private thread will exit within
+        /// one second.
+        /// </summary>
+        public void close()
+        {
+            keepRunning = false;
+        }
+    }
+
+
+    /// <summary>
+    /// server is the class that users instantiate to connect a SessionReceiver
+    /// callback to the stream of received messages received on a Session.
+    /// </summary>
+    public class server
+    {
+        private eventEngine ee;
+
+        /// <summary>
+        /// Constructor for the server.
+        /// </summary>
+        /// <param name="session">The Session whose messages are collected.</param>
+        /// <param name="callback">The user function call with each message.</param>
+        /// 
+        public server(Session session, ISessionReceiver callback)
+        {
+            ee = new eventEngine(session, callback);
+
+            new System.Threading.Thread(
+                new System.Threading.ThreadStart(ee.open)).Start();
+        }
+
+        /// <summary>
+        /// Function to stop the server.
+        /// </summary>
+        public void close()
+        {
+            ee.close();
+        }
+    }
+}

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs?rev=949245&r1=949244&r2=949245&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs Fri May 28 18:09:10 2010
@@ -12,27 +12,77 @@ namespace org.apache.qpid.messaging
         {
             //
             // Duration test - stub until proper nunit tests are ready...
-            //
+
             Duration myDuration = new Duration(1234);
 
             Console.WriteLine("Duration should be : 1234, is : {0}",
-                            myDuration.getMilliseconds());
+                            myDuration.Milliseconds);
 
             Console.WriteLine("Duration FOREVER should be : 1.8x10^19 (realbig), is : {0}",
-                            myDuration.FOREVER());
+                            DurationConstants.FORVER.Milliseconds);
 
             Console.WriteLine("Duration IMMEDIATE should be : 0, is : {0}",
-                            myDuration.IMMEDIATE());
+                            DurationConstants.IMMEDIATE.Milliseconds);
 
             Console.WriteLine("Duration SECOND should be : 1,000, is : {0}",
-                            myDuration.SECOND());
+                            DurationConstants.SECOND.Milliseconds);
 
             Console.WriteLine("Duration MINUTE should be : 60,000, is : {0}",
-                            myDuration.MINUTE());
+                            DurationConstants.MINUTE.Milliseconds);
+
+            Duration isInfinite = new Duration();
 
+            Console.WriteLine("Duration() should be : realbig, is : {0}",
+                            isInfinite.Milliseconds);
+
+            Duration fiveMinutes = new Duration(DurationConstants.MINUTE.Milliseconds * 5);
+            Console.WriteLine("Duration 5MINUTE should be : 300,000, is : {0}",
+                            fiveMinutes.Milliseconds);
+
+            Duration fiveSec = DurationConstants.SECOND * 5;
+            Console.WriteLine("Duration 5SECOND should be : 5,000 is : {0}",
+                            fiveSec.Milliseconds);
             //
             // and so on
             //
+
+            Dictionary<string, object> dx = new Dictionary<string, object>();
+
+            Console.WriteLine("Dictionary.GetType() {0}", dx.GetType());
+
+            //
+            // Address test
+            //
+            Address aEmpty = new Address();
+            Address aStr   = new Address("rare");
+
+            Dictionary<string, object> options = new Dictionary<string,object>();
+            options["one"] = 1;
+            options["two"] = "two";
+
+            Address aSubj = new Address("rare2", "subj", options);
+
+            Address aType = new Address ("check3", "subj", options, "hot");
+
+            Console.WriteLine("aEmpty : {0}", aEmpty.str());
+            Console.WriteLine("aStr   : {0}", aStr.str());
+            Console.WriteLine("aSubj  : {0}", aSubj.str());
+            Console.WriteLine("aType  : {0}", aType.str());
+
+            //
+            // Raw message data retrieval
+            //
+
+            Message m2 = new Message("rarey");
+            UInt64 m2Size = m2.getContentSize();
+
+
+            byte[] myRaw = new byte [m2Size];
+
+            m2.getRaw(myRaw);
+            Console.WriteLine("Got raw array size {0}", m2Size);
+            for (UInt64 i = 0; i < m2Size; i++)
+                Console.Write("{0} ", myRaw[i].ToString());
         }
     }
 }

Modified: qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj?rev=949245&r1=949244&r2=949245&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj Fri May 28 18:09:10 2010
@@ -17,7 +17,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
+    <OutputPath>..\..\..\..\..\src\Debug\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -31,10 +31,6 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="org.apache.qpid.messagingd, Version=1.0.3779.23054, Culture=neutral, PublicKeyToken=679e1f50b62dbace, processorArchitecture=x86">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\bin\Debug\org.apache.qpid.messagingd.dll</HintPath>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -52,6 +48,12 @@
     <Compile Include="messaging.test.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+      <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+      <Name>org.apache.qpid.messaging</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
@@ -60,4 +62,10 @@
   <Target Name="AfterBuild">
   </Target>
   -->
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+    <PreBuildEvent>
+    </PreBuildEvent>
+  </PropertyGroup>
 </Project>



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org