Beispiel #1
0
 /// <summary>
 /// finds the code set service context among the collection of received service contexts.
 /// </summary>
 internal static CodeSetServiceContext FindCodeSetServiceContext(omg.org.IOP.ServiceContextList contexts)
 {
     if (contexts.ContainsServiceContext(SERVICE_ID))
     {
         omg.org.IOP.ServiceContext context = contexts.GetServiceContext(SERVICE_ID);
         return(new CodeSetServiceContext(context));
     }
     else
     {
         return(null);
     }
 }
 public void TestSameServiceIdMultiple() {
     // checks if service contexts with the same id, doesn't throw an exception
     // checks, that the first service context is considered, others are thrown away
     GiopMessageBodySerialiser ser = new GiopMessageBodySerialiser(
                                         new ArgumentsSerializerFactory(m_serFactory));
     MemoryStream stream = new MemoryStream();
     CdrOutputStreamImpl cdrOut = new CdrOutputStreamImpl(stream, 0, new GiopVersion(1,2));
     cdrOut.WriteULong(2); // nr of contexts
     cdrOut.WriteULong(1234567); // id of context 1
     CdrEncapsulationOutputStream encap = new CdrEncapsulationOutputStream(0);
     cdrOut.WriteEncapsulation(encap);
     cdrOut.WriteULong(1234567); // id of context 2
     encap = new CdrEncapsulationOutputStream(0);
     cdrOut.WriteEncapsulation(encap);
     // reset stream
     stream.Seek(0, SeekOrigin.Begin);
     CdrInputStreamImpl cdrIn = new CdrInputStreamImpl(stream);
     cdrIn.ConfigStream(0, new GiopVersion(1,2));
     omg.org.IOP.ServiceContextList result = new ServiceContextList(cdrIn);
     // check if context is present
     Assert.IsTrue(result.ContainsServiceContext(1234567), "expected context not in collection");
 }