Пример #1
0
        public void Start()
        {
            if (_serviceHost != null)
            {
                throw new InvalidOperationException("Server is already started.");
            }

            var managementHandler = new ManagementTransferRequestHandler();
            managementHandler.Bind(Schema.DynamicMBeanResourceUri, new DynamicMBeanManagementRequestHandler(_server));
            managementHandler.Bind(Schema.MBeanServerResourceUri, new MBeanServerManagementRequestHandler(_server));

            var enumerationServer = new EnumerationServer();
            enumerationServer.Bind(Schema.DynamicMBeanResourceUri, Schema.QueryNamesDialect, typeof(string), new QueryNamesEnumerationRequestHandler(_server));
            enumerationServer.Bind(Schema.DynamicMBeanResourceUri, FilterMap.DefaultDialect, typeof(void), new IsRegisteredEnumerationRequestHandler(_server));

            var eventingServer = new EventingServer(new EventingRequestHandler(_server));
            eventingServer.Bind(Schema.NotificationDialect, typeof (NotificationFilter));
            eventingServer.EnablePullDeliveryUsing(enumerationServer.PullServer);

            var extensionHandler = new Jsr262ExtensionMethodHandler(_server);

            _serviceHost = new HttpListenerTransferEndpoint(_serviceUrl,
                new TransferServer(managementHandler),
                enumerationServer,
                enumerationServer,
                eventingServer,
                extensionHandler);
        }
Пример #2
0
      static void Main(string[] args)
      {
          var enumerationServer = new EnumerationServer()
              .Bind(FilterMap.DefaultDialect, typeof (JmxNotificationFilter), new RequestHandler());

         using (new HttpListenerTransferEndpoint("http://localhost:12345/", enumerationServer))
         {
             Client.PerformTest();
             Console.WriteLine("Press any key to exit.");
             Console.ReadKey();
         }
      }
Пример #3
0
        public void It_returns_proper_fault_if_filter_dialect_is_not_supported()
        {
            var enumerationServer = new EnumerationServer()
                                    .Bind("supportedDialect", typeof(object), new Mock <IEnumerationRequestHandler>().Object);

            var soapClient        = new TestingSOAPClient(enumerationServer);
            var enumerationClient = new EnumerationClient(false, soapClient);

            try
            {
                enumerationClient
                .EnumerateEPR("http://tempuri.org", new Filter("unsupportedDialect", "A"), 10)
                .ToList();
            }
            catch (FaultException ex)
            {
                Assert.AreEqual(new NotSupportedDialectFaultException(), ex);
                return;
            }
            Assert.Fail();
        }
Пример #4
0
        public void It_returns_proper_fault_if_filter_dialect_is_not_supported()
        {
            var enumerationServer = new EnumerationServer()
                .Bind("supportedDialect", typeof (object), new Mock<IEnumerationRequestHandler>().Object);

            var soapClient = new TestingSOAPClient(enumerationServer);
            var enumerationClient = new EnumerationClient(false, soapClient);

            try
            {
                enumerationClient
                    .EnumerateEPR("http://tempuri.org", new Filter("unsupportedDialect", "A"), 10)
                    .ToList();            
            }
            catch (FaultException ex)
            {
                Assert.AreEqual(new NotSupportedDialectFaultException(), ex);
                return;
            }
            Assert.Fail();
        }