AddFacilityConfiguration() private method

private AddFacilityConfiguration ( String key, IConfiguration config ) : void
key String
config IConfiguration
return void
		public void SimpleCase()
		{
			String contents = 
				"import Castle.Facilities.AspectSharp.Tests.Components in Castle.Facilities.AspectSharp.Tests " + 
				"import Castle.Facilities.AspectSharp.Tests.Interceptors in Castle.Facilities.AspectSharp.Tests " + 
				" " + 
				" aspect MyAspect for SimpleService " + 
				"   " + 
				"   pointcut method|property(*)" + 
				"     advice(LoggerInterceptor)" + 
				"   end" + 
				"   " + 
				" end ";

			MutableConfiguration config = new MutableConfiguration("facility", contents);

			DefaultConfigurationStore store = new DefaultConfigurationStore();
			store.AddFacilityConfiguration("aop", config);

			WindsorContainer container = new WindsorContainer(store);
			container.AddFacility( "aop", new AspectSharpFacility() );

			container.AddComponent("comp1", typeof(SimpleService));

			SimpleService service = container[ typeof(SimpleService) ] as SimpleService;
			service.DoSomething();
			service.DoSomethingElse();

			Assert.AreEqual( "Enter DoSomething\r\nEnter DoSomethingElse\r\n", 
				LoggerInterceptor.Messages.ToString() );
		}
Esempio n. 2
0
 public void InvalidProtocol_throws() {
     var configStore = new DefaultConfigurationStore();
     var configuration = new MutableConfiguration("facility");
     configuration.Attribute("type", typeof(SolrNetFacility).AssemblyQualifiedName);
     configuration.CreateChild("solrURL", "ftp://localhost");
     configStore.AddFacilityConfiguration(typeof(SolrNetFacility).FullName, configuration);
     new WindsorContainer(configStore);
 }
Esempio n. 3
0
 public void InvalidUrl_throws() {
     var configStore = new DefaultConfigurationStore();
     var configuration = new MutableConfiguration("facility");
     configuration.Attributes.Add("type", typeof(SolrNetFacility).FullName);
     configuration.CreateChild("solrURL", "123");
     configStore.AddFacilityConfiguration(typeof(SolrNetFacility).FullName, configuration);
     new WindsorContainer(configStore);
 }
Esempio n. 4
0
 public void setup()
 {
     var store = new DefaultConfigurationStore();
     var solrSharpConfig = new MutableConfiguration("solrsharp");
     solrSharpConfig.Children.Add(new MutableConfiguration("solrUrl", "http://localhost:8983/solr/"));
     solrSharpConfig.Children.Add(new MutableConfiguration("searcherMode", "ReadWrite"));
     store.AddFacilityConfiguration("solrsharp", solrSharpConfig);
     container = new WindsorContainer(store);
     container.AddFacility("solrsharp", new SolrSharpFacility());
 }
        public void Ping_Query()
        {
            var configStore = new DefaultConfigurationStore();
            var configuration = new MutableConfiguration("facility");
            configuration.Attribute("type", typeof(SolrNetFacility).AssemblyQualifiedName);
            configuration.CreateChild("solrURL", "http://localhost:8983/solr");
            configStore.AddFacilityConfiguration(typeof(SolrNetFacility).FullName, configuration);
            var container = new WindsorContainer(configStore);

            var solr = container.Resolve<ISolrOperations<CastleFixture.Document>>();
            solr.Ping();
            Console.WriteLine(solr.Query(SolrQuery.All).Count);
        }
		public void AopInterceptorAndCastleInterceptor()
		{
			String contents = 
				"import Castle.Facilities.AspectSharp.Tests.Components in Castle.Facilities.AspectSharp.Tests " + 
				"import Castle.Facilities.AspectSharp.Tests.Interceptors in Castle.Facilities.AspectSharp.Tests " + 
				" " + 
				" aspect MyAspect for AnotherService " + 
				"   " + 
				"   pointcut method|property(*)" + 
				"     advice(LoggerInterceptor)" + 
				"   end" + 
				"   " + 
				" end ";

			MutableConfiguration config = new MutableConfiguration("facility", contents);

			DefaultConfigurationStore store = new DefaultConfigurationStore();
			store.AddFacilityConfiguration("aop", config);

			WindsorContainer container = new WindsorContainer(store);
			container.AddFacility( "aop", new AspectSharpFacility() );

			container.AddComponent( "interceptor1", typeof(CastleSimpleInterceptor) );
			container.AddComponent("comp1", typeof(SimpleService));
			container.AddComponent("comp2", typeof(IAnotherService), typeof(AnotherService));

			IAnotherService service = container[ typeof(IAnotherService) ] as IAnotherService;
			service.Name = "hammett";
			service.StartWork();

			Assert.AreEqual( "Enter set_Name\r\nEnter StartWork\r\n", 
				LoggerInterceptor.Messages.ToString() );

			CastleSimpleInterceptor interceptor = 
				container[ typeof(CastleSimpleInterceptor) ] as CastleSimpleInterceptor;

			Assert.AreEqual(2, interceptor.Executions);
		}
Esempio n. 7
0
        public void Ping_Query()
        {
            var configStore = new DefaultConfigurationStore();
            var configuration = new MutableConfiguration("facility");
            configuration.CreateChild("solrURL", "http://localhost:8983/solr");
            configStore.AddFacilityConfiguration("solr", configuration);
            var container = new WindsorContainer(configStore);
            container.AddFacility<SolrNetFacility>("solr");

            var solr = container.Resolve<ISolrOperations<Document>>();
            solr.Ping();
            Console.WriteLine(solr.Query(SolrQuery.All).Count);
        }
Esempio n. 8
0
 public void InvalidUrl_throws()
 {
     var configStore = new DefaultConfigurationStore();
     var configuration = new MutableConfiguration("facility");
     configuration.CreateChild("solrURL", "123");
     configStore.AddFacilityConfiguration("solr", configuration);
     var container = new WindsorContainer(configStore);
     container.AddFacility<SolrNetFacility>("solr");
 }