public static IApplicationContext GetContext(params string[] files) { NamespaceParserRegistry.RegisterParser(typeof(IntegrationNamespaceParser)); NamespaceParserRegistry.RegisterParser(typeof(NmsNamespaceParser)); return(new XmlApplicationContext(files)); }
public void InitContext() { // Configure Spring programmatically NamespaceParserRegistry.RegisterParser(typeof(DatabaseNamespaceParser)); ctx = new XmlApplicationContext( "assembly://Spring.DataQuickStart.Tests/Spring.DataQuickStart.GenericTemplate/ExampleTests.xml"); }
//[Test] public void BasicConfig() { NamespaceParserRegistry.RegisterParser(typeof(WcfNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext( ReadOnlyXmlTestResource.GetFilePath("ChannelFactoryObjectDefinitionParserTests.BasicConfig.xml", this.GetType())); Assert.IsTrue(ctx.ContainsObjectDefinition("channel")); RootObjectDefinition rod = ((IObjectDefinitionRegistry)ctx).GetObjectDefinition("channel") as RootObjectDefinition; Assert.IsNotNull(rod); Assert.IsTrue(rod.HasObjectType); Assert.AreEqual(typeof(ChannelFactoryObject <IContract>), rod.ObjectType); Assert.AreEqual(1, rod.ConstructorArgumentValues.NamedArgumentValues.Count); Assert.AreEqual("ecn", rod.ConstructorArgumentValues.GetNamedArgumentValue("endpointConfigurationName").Value); ChannelFactoryObject <IContract> cfo = ctx.GetObject("&channel") as ChannelFactoryObject <IContract>; Assert.IsNotNull(cfo); Assert.AreEqual(typeof(IContract), cfo.ObjectType); IContract contract = ctx.GetObject("channel") as IContract; Assert.IsNotNull(contract); }
//[Test] public void CustomProperties() { NamespaceParserRegistry.RegisterParser(typeof(WcfNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext( ReadOnlyXmlTestResource.GetFilePath("ChannelFactoryObjectDefinitionParserTests.CustomProperties.xml", this.GetType())); Assert.IsTrue(ctx.ContainsObjectDefinition("channel")); RootObjectDefinition rod = ((IObjectDefinitionRegistry)ctx).GetObjectDefinition("channel") as RootObjectDefinition; Assert.IsNotNull(rod); Assert.IsTrue(rod.HasObjectType); Assert.AreEqual(typeof(ChannelFactoryObject <IContract>), rod.ObjectType); Assert.AreEqual(1, rod.ConstructorArgumentValues.NamedArgumentValues.Count); Assert.AreEqual("ecn", rod.ConstructorArgumentValues.GetNamedArgumentValue("endpointConfigurationName").Value); Assert.IsTrue(rod.PropertyValues.Contains("Credentials.Windows.ClientCredential")); Assert.AreEqual("Spring\\Bruno:gnirpS", rod.PropertyValues.GetPropertyValue("Credentials.Windows.ClientCredential").Value); ChannelFactoryObject <IContract> cfo = ctx.GetObject("&channel") as ChannelFactoryObject <IContract>; Assert.IsNotNull(cfo); Assert.AreEqual(typeof(IContract), cfo.ObjectType); Assert.AreEqual("Spring", cfo.Credentials.Windows.ClientCredential.Domain); Assert.AreEqual("Bruno", cfo.Credentials.Windows.ClientCredential.UserName); Assert.AreEqual("gnirpS", cfo.Credentials.Windows.ClientCredential.Password); IContract contract = ctx.GetObject("channel") as IContract; Assert.IsNotNull(contract); }
public void Registered() { NamespaceParserRegistry.RegisterParser(typeof(WcfNamespaceParser)); INamespaceParser namespaceParser = NamespaceParserRegistry.GetParser("http://www.springframework.net/wcf"); Assert.IsNotNull(namespaceParser); Assert.IsTrue(namespaceParser is WcfNamespaceParser); }
private XmlApplicationContext GetXmlApplicationContext() { NamespaceParserRegistry.RegisterParser(typeof(DatabaseNamespaceParser)); XmlApplicationContext ctx = new XmlApplicationContext( "assembly://VisualSmart.Dao.DataQuickStart/VisualSmart.Dao.DataQuickStart.Config/Dao.xml"); return(ctx); }
public void Setup() { NamespaceParserRegistry.RegisterParser(typeof(RabbitNamespaceHandler)); var resourceName = @"assembly://Spring.Messaging.Amqp.Rabbit.Tests/Spring.Messaging.Amqp.Rabbit.Tests.Config/" + typeof(RabbitNamespaceHandlerTests).Name + "-context.xml"; var resource = new AssemblyResource(resourceName); this.objectFactory = new XmlObjectFactory(resource); }
public virtual void Setup() { NamespaceParserRegistry.RegisterParser(typeof(RabbitNamespaceHandler)); var resourceName = @"assembly://Spring.Messaging.Amqp.Rabbit.Tests/Spring.Messaging.Amqp.Rabbit.Tests.Config/" + typeof(ListenerContainerPlaceholderParserTests).Name + "-context.xml"; this.objectFactory = new XmlApplicationContext(resourceName); }
public void TestReceivesMessageFromChannelWithSource() { NamespaceParserRegistry.RegisterParser(typeof(IntegrationNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext(@"Channel\Config\DirectChannelParserTests.xml"); object channel = ctx.GetObject("channel"); Assert.That(channel.GetType(), Is.EqualTo(typeof(DirectChannel))); }
public static XmlObjectFactory LoadMessagingConfig() { NamespaceParserRegistry.RegisterParser(typeof(RedisNamespaceHandler)); const string resourceName = "assembly://RedisMessaging.Tests/RedisMessaging.Tests.Configs/Messaging.config"; var resource = new AssemblyResource(resourceName); return(new XmlObjectFactory(resource)); }
public void Setup() { NamespaceParserRegistry.RegisterParser(typeof(RabbitNamespaceHandler)); var resourceName = @"assembly://Spring.Messaging.Amqp.Rabbit.Tests/Spring.Messaging.Amqp.Rabbit.Tests.Config/" + typeof(ListenerContainerParserTests).Name + "-context.xml"; var resource = new AssemblyResource(resourceName); this.objectFactory = new XmlObjectFactory(resource); // ((IConfigurableObjectFactory)objectFactory).setObjectExpressionResolver(new StandardObjectExpressionResolver()); }
public static XmlObjectFactory LoadConfig(string configConventionPrefix, int configId) { NamespaceParserRegistry.RegisterParser(typeof(RedisNamespaceHandler)); var resourceName = $"assembly://RedisMessaging.Tests/RedisMessaging.Tests.Configs.{configConventionPrefix}/{configConventionPrefix}-{configId}.config"; var resource = new AssemblyResource(resourceName); return(new XmlObjectFactory(resource)); }
//[Test] public void WithoutId() { NamespaceParserRegistry.RegisterParser(typeof(WcfNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext( ReadOnlyXmlTestResource.GetFilePath("ChannelFactoryObjectDefinitionParserTests.WithoutId.xml", this.GetType())); IDictionary <string, IContract> channels = ctx.GetObjects <IContract>(); Assert.AreEqual(1, channels.Count); }
public void testRendezvous() { NamespaceParserRegistry.RegisterParser(typeof(IntegrationNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext(@"Channel\Config\RendezvousChannelParserTests.xml"); object channel = ctx.GetObject("channel"); Assert.That(channel.GetType(), Is.EqualTo(typeof(RendezvousChannel))); }
private void LoadSpringConfig() { NamespaceParserRegistry.RegisterParser(typeof(DatabaseNamespaceParser)); NamespaceParserRegistry.RegisterParser(typeof(TxNamespaceParser)); NamespaceParserRegistry.RegisterParser(typeof(AopNamespaceParser)); string[] param = { "~/AppConfig/Config.xml" }; IApplicationContext context = new XmlApplicationContext(param); ContextRegistry.RegisterContext(context); }
public void SetUp() { // Configure Spring programmatically NamespaceParserRegistry.RegisterParser(typeof(DatabaseNamespaceParser)); NamespaceParserRegistry.RegisterParser(typeof(TxNamespaceParser)); NamespaceParserRegistry.RegisterParser(typeof(AopNamespaceParser)); IApplicationContext context = CreateContextFromXml(); accountManager = context["accountManager"] as IAccountManager; CleanDb(context); }
static void Main(string[] args) { NamespaceParserRegistry.RegisterParser(typeof(IntegrationNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext("HelloWorld.xml"); IChannelResolver channelResolver = new ObjectFactoryChannelResolver(ctx); IMessageChannel inputChannel = channelResolver.ResolveChannelName("inputChannel"); IPollableChannel outputChannel = (IPollableChannel)channelResolver.ResolveChannelName("outputChannel"); inputChannel.Send(new StringMessage("World")); Console.WriteLine(outputChannel.Receive(TimeSpan.Zero).Payload); Console.ReadKey(); }
/// <summary> /// Registers parsers specified in the (recommended, Spring.NET standard) /// <c>parsers</c> config section with the <see cref="NamespaceParserRegistry"/>. /// </summary> /// <param name="parent"> /// The configuration settings in a corresponding parent /// configuration section. /// </param> /// <param name="configContext"> /// The configuration context when called from the ASP.NET /// configuration system. Otherwise, this parameter is reserved and /// is <see langword="null"/>. /// </param> /// <param name="section"> /// The <see cref="System.Xml.XmlNode"/> for the section. /// </param> /// <returns> /// This method always returns <see langword="null"/>, because parsers /// are registered as a side-effect of this object's execution and there /// is thus no need to return anything. /// </returns> public object Create(object parent, object configContext, XmlNode section) { if (section != null) { XmlNodeList parsers = ((XmlElement)section).GetElementsByTagName(ParserElementName); foreach (XmlElement parserElement in parsers) { string parserTypeName = GetRequiredAttributeValue(parserElement, TypeAttributeName, section); string xmlNamespace = parserElement.GetAttribute(NamespaceAttributeName); string schemaLocation = parserElement.GetAttribute(SchemaLocationAttributeName); Type parserType = TypeResolutionUtils.ResolveType(parserTypeName); NamespaceParserRegistry.RegisterParser(parserType, xmlNamespace, schemaLocation); } } return(null); }
public void FixtureSetUp() { NamespaceParserRegistry.RegisterParser(typeof(RabbitNamespaceHandler)); try { if (Environment.IsActive()) { // Set up broker admin for non-root user this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(); // "rabbit@LOCALHOST", 5672); this.brokerAdmin.StartNode(); } } catch (Exception ex) { Logger.Error("An error occurred during SetUp", ex); Assert.Fail("An error occurred during SetUp."); } if (!this.brokerFederated.Apply()) { Assert.Ignore("Rabbit broker is not running. Ignoring integration test fixture."); } }
static void Main() { try { log.Info("Running...."); NamespaceParserRegistry.RegisterParser(typeof(GemfireNamespaceParser)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); BrokerConfiguration.Configure(); using (IApplicationContext ctx = ContextRegistry.GetContext()) { StockForm stockForm = new StockForm(); Application.ThreadException += ThreadException; Application.Run(stockForm); } } catch (Exception e) { log.Error("Spring.Interop.StockTraderSample.Client is broken.", e); throw; } }
static void Main(string[] args) { NamespaceParserRegistry.RegisterParser(typeof(IntegrationNamespaceParser)); new XmlApplicationContext("IntervalOddEvenDemo.xml"); }
public void Setup() { NamespaceParserRegistry.RegisterParser(typeof(ContextNamespaceParser)); _applicationContext = new XmlApplicationContext(ReadOnlyXmlTestResource.GetFilePath("SimpleScanTest.xml", GetType())); }
public void Setup() { NamespaceParserRegistry.RegisterParser(typeof(ContextNamespaceParser)); }
public void SetUp() { NamespaceParserRegistry.RegisterParser(typeof(GemfireNamespaceParser)); NamespaceParserRegistry.RegisterParser(typeof(AopNamespaceParser)); context = new XmlApplicationContext(@"Caching\XmlBasedGemfireCacheTests.xml"); }
public void Setup() { NamespaceParserRegistry.RegisterParser(typeof(GemfireNamespaceParser)); ctx = new XmlApplicationContext(@"Config\PoolNamespaceTests.xml"); }
protected override IConfigurableApplicationContext LoadContextLocations(string[] locations) { NamespaceParserRegistry.RegisterParser(typeof(IntegrationNamespaceParser)); NamespaceParserRegistry.RegisterParser(typeof(NmsNamespaceParser)); return(base.LoadContextLocations(locations)); }
public void SetUp() { NamespaceParserRegistry.RegisterParser(typeof(MongoNamespaceParser)); }
public void FixtureSetUp() { NamespaceParserRegistry.RegisterParser(typeof(RabbitNamespaceHandler)); }
public void Setup() { NamespaceParserRegistry.RegisterParser(typeof(EmsNamespaceParser)); ctx = new XmlApplicationContext(ReadOnlyXmlTestResource.GetFilePath("EmsNamespaceHandlerTests.xml", GetType())); }
public void SetUp() { NamespaceParserRegistry.RegisterParser(typeof(RabbitNamespaceHandler)); this.brokerIsRunning.Apply(); }