Mercurial > altnet-hispano
changeset 160:4241a930cab2
Combinar
author | juanjose.montesdeocaarbos |
---|---|
date | Fri, 05 Aug 2011 21:39:37 -0300 |
parents | f6e4af3a0b09 (current diff) 734d3f0853bf (diff) |
children | c1062de96845 93aa103f75ec |
files | |
diffstat | 40 files changed, 787 insertions(+), 190 deletions(-) [+] |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Blog/Agendas.Blog.csproj Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Agendas.Blog.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -71,6 +71,10 @@ </Compile> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Agendas.Configurations\Agendas.Configurations.csproj"> + <Project>{583304D0-51C7-4808-BE20-6E9A904CA908}</Project> + <Name>Agendas.Configurations</Name> + </ProjectReference> <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj"> <Project>{A14907DF-02E4-4FA7-BE27-4292AF50AA22}</Project> <Name>Agendas.Domain</Name>
--- a/Agendas/trunk/src/Agendas.Blog/Impl/BlogPublicador.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/BlogPublicador.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using AltNetHispano.Agendas.Configurations; using AltNetHispano.Agendas.Domain; namespace Agendas.Blog.Impl @@ -9,6 +10,16 @@ { private readonly IPostWriterFactory _postWriterFactory; + public BlogPublicador() + : this( + new PostWriterFactory( + new PostWriterWebServiceAdapter( + new BlogPublicadorConfig(AgendasConfigurationManager.Publicadores.Blog.Writer.PostWriterServiceUrl, + AgendasConfigurationManager.Publicadores.Blog.Writer.BlogName, + AgendasConfigurationManager.Publicadores.Blog.Writer.BlogWriterMasterKey)))) + { + } + public BlogPublicador(IPostWriterFactory postWriterFactory) { _postWriterFactory = postWriterFactory; @@ -16,6 +27,8 @@ public void Publicar(IEnumerable<Track> tracks) { + if (!AgendasConfigurationManager.Publicadores.Blog.Enabled) return; + foreach (var track in tracks) { if (track.Logs.Any(l => l.Propietario == TrackLogPropietario.Blog && l.Successful)) continue; @@ -32,4 +45,4 @@ } } } -} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations.Tests/Agendas.Configurations.Tests.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BBE36765-6AAB-4689-B2F3-6D18E3F11746}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Agendas.Configurations.Tests</RootNamespace> + <AssemblyName>Agendas.Configurations.Tests</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\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="nunit.framework"> + <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Read_configuration.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Agendas.Configurations\Agendas.Configurations.csproj"> + <Project>{583304D0-51C7-4808-BE20-6E9A904CA908}</Project> + <Name>Agendas.Configurations</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </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> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations.Tests/App.config Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> + +<configuration> + <configSections> + <section name="publicadores" type="AltNetHispano.Agendas.Configurations.PublicadoresConfigurationSection, AltNetHispano.Agendas.Configurations, Version=1.0.0.0, Culture=neutral" /> + </configSections> + + <publicadores> + <twitter enabled="true"> + <signIn consumerKey="consumerKey1" consumerSecret="consumerSecret1" /> + <sendTwitter consumerKey="consumerKey2" consumerSecret="consumerSecret2" accessToken="accessToken2" accessTokenSecret="accessTokenSecret2" /> + </twitter> + <google enabled="true"> + <calendar userName="altnethispano.desa@gmail.com" password="password" calendarId="altnethispano.desa@gmail.com" /> + </google> + <blog enabled="true"> + <writer postWriterServiceUrl="postWriterServiceUrl" blogName="blogName" blogWriterMasterKey="blogWriterMasterKey" /> + </blog> + </publicadores> +</configuration> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations.Tests/Properties/AssemblyInfo.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Agendas.Configurations.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Agendas.Configurations.Tests")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("094376cb-d2c5-479e-bce4-b46babd6627d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations.Tests/Read_configuration.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,71 @@ +using AltNetHispano.Agendas.Configurations; +using NUnit.Framework; + +namespace Agendas.Configurations.Tests +{ + [TestFixture] + public class Read_configuration + { + [Test] + public void Read() + { + var section = AgendasConfigurationManager.Publicadores; + Assert.IsNotNull(section); + } + + [Test] + public void Read_twitter() + { + var publicadores = AgendasConfigurationManager.Publicadores; + Assert.IsNotNull(publicadores); + + Assert.IsNotNull(publicadores.Twitter); + + var twitter = publicadores.Twitter; + Assert.AreEqual(true, twitter.Enabled); + + Assert.IsNotNull(twitter.SignIn); + Assert.AreEqual("consumerKey1", twitter.SignIn.ConsumerKey); + Assert.AreEqual("consumerSecret1", twitter.SignIn.ConsumerSecret); + + Assert.AreEqual("consumerKey2", twitter.SendTwitter.ConsumerKey); + Assert.AreEqual("consumerSecret2", twitter.SendTwitter.ConsumerSecret); + Assert.AreEqual("accessToken2", twitter.SendTwitter.AccessToken); + Assert.AreEqual("accessTokenSecret2", twitter.SendTwitter.AccessTokenSecret); + } + + [Test] + public void Read_blog() + { + var publicadores = AgendasConfigurationManager.Publicadores; + Assert.IsNotNull(publicadores); + + Assert.IsNotNull(publicadores.Blog); + + var blog = publicadores.Blog; + Assert.AreEqual(true, blog.Enabled); + + Assert.IsNotNull(blog.Writer); + Assert.AreEqual("blogName", blog.Writer.BlogName); + Assert.AreEqual("blogWriterMasterKey", blog.Writer.BlogWriterMasterKey); + Assert.AreEqual("postWriterServiceUrl", blog.Writer.PostWriterServiceUrl); + } + + [Test] + public void Read_google() + { + var publicadores = AgendasConfigurationManager.Publicadores; + Assert.IsNotNull(publicadores); + + Assert.IsNotNull(publicadores.Google); + + var google = publicadores.Google; + Assert.AreEqual(true, google.Enabled); + + Assert.IsNotNull(google.Calendar); + Assert.AreEqual("altnethispano.desa@gmail.com", google.Calendar.UserName); + Assert.AreEqual("altnethispano.desa@gmail.com", google.Calendar.CalendarId); + Assert.AreEqual("password", google.Calendar.Password); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/Agendas.Configurations.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{583304D0-51C7-4808-BE20-6E9A904CA908}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>AltNetHispano.Agendas.Configurations</RootNamespace> + <AssemblyName>AltNetHispano.Agendas.Configurations</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\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="Microsoft.CSharp" /> + <Reference Include="System" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="BlogConfigurationElement.cs" /> + <Compile Include="BlogWriterConfigurationElement.cs" /> + <Compile Include="CalendarConfigurationElement.cs" /> + <Compile Include="ConfigurationManager.cs" /> + <Compile Include="GoogleConfigurationElement.cs" /> + <Compile Include="PublicadoresConfigurationException.cs" /> + <Compile Include="PublicadoresConfigurationSection.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="TwitterConfigurationElement.cs" /> + <Compile Include="TwitterSendTwitterConfigurationElement.cs" /> + <Compile Include="TwitterSignInConfigurationElement.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PreBuildEvent> + </PreBuildEvent> + </PropertyGroup> + <PropertyGroup> + <PostBuildEvent> + </PostBuildEvent> + </PropertyGroup> + <!-- 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> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/BlogConfigurationElement.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,19 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class BlogConfigurationElement : ConfigurationElement + { + [ConfigurationProperty("writer")] + public BlogWriterConfigurationElement Writer + { + get { return base["writer"] as BlogWriterConfigurationElement; } + } + + [ConfigurationProperty("enabled")] + public bool Enabled + { + get { return (bool) base["enabled"]; } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/BlogWriterConfigurationElement.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,28 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class BlogWriterConfigurationElement : ConfigurationElement + { + [ConfigurationProperty("postWriterServiceUrl")] + public string PostWriterServiceUrl + { + get { return base["postWriterServiceUrl"] as string; } + + } + + [ConfigurationProperty("blogName")] + public string BlogName + { + get { return base["blogName"] as string; } + + } + + [ConfigurationProperty("blogWriterMasterKey")] + public string BlogWriterMasterKey + { + get { return base["blogWriterMasterKey"] as string; } + + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/CalendarConfigurationElement.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,25 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class CalendarConfigurationElement : ConfigurationElement + { + [ConfigurationProperty("userName")] + public string UserName + { + get { return base["userName"] as string; } + } + + [ConfigurationProperty("password")] + public string Password + { + get { return base["password"] as string; } + } + + [ConfigurationProperty("calendarId")] + public string CalendarId + { + get { return base["calendarId"] as string; } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/ConfigurationManager.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,18 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class AgendasConfigurationManager + { + public static PublicadoresConfigurationSection Publicadores + { + get + { + var config = ConfigurationManager.GetSection("publicadores") as PublicadoresConfigurationSection; + if (config == null) + throw new PublicadoresConfigurationException(); + return config; + } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/GoogleConfigurationElement.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,19 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class GoogleConfigurationElement : ConfigurationElement + { + [ConfigurationProperty("calendar")] + public CalendarConfigurationElement Calendar + { + get { return base["calendar"] as CalendarConfigurationElement; } + } + + [ConfigurationProperty("enabled")] + public bool Enabled + { + get { return (bool) base["enabled"]; } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/Properties/AssemblyInfo.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Agendas.Configurations")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Agendas.Configurations")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c404575c-e8c5-45dd-8745-c77436045824")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/PublicadoresConfigurationException.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,11 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class PublicadoresConfigurationException : ConfigurationErrorsException + { + public PublicadoresConfigurationException() : base("Falta configurar la sección Publicadores") + { + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/PublicadoresConfigurationSection.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,25 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class PublicadoresConfigurationSection : ConfigurationSection + { + [ConfigurationProperty("twitter", IsRequired = true)] + public TwitterConfigurationElement Twitter + { + get { return base["twitter"] as TwitterConfigurationElement; } + } + + [ConfigurationProperty("google")] + public GoogleConfigurationElement Google + { + get { return base["google"] as GoogleConfigurationElement; } + } + + [ConfigurationProperty("blog")] + public BlogConfigurationElement Blog + { + get { return base["blog"] as BlogConfigurationElement; } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/TwitterConfigurationElement.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,27 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class TwitterConfigurationElement : ConfigurationElement + { + [ConfigurationProperty("signIn")] + public TwitterSignInConfigurationElement SignIn + { + get { return base["signIn"] as TwitterSignInConfigurationElement; } + } + + + [ConfigurationProperty("sendTwitter")] + public TwitterSendTwitterConfigurationElement SendTwitter + { + get { return base["sendTwitter"] as TwitterSendTwitterConfigurationElement; } + } + + [ConfigurationProperty("enabled")] + public bool Enabled + { + get { return (bool) base["enabled"]; } + + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/TwitterSendTwitterConfigurationElement.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,31 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class TwitterSendTwitterConfigurationElement : ConfigurationElement + { + [ConfigurationProperty("consumerKey")] + public string ConsumerKey + { + get { return base["consumerKey"] as string; } + } + + [ConfigurationProperty("consumerSecret")] + public string ConsumerSecret + { + get { return base["consumerSecret"] as string; } + } + + [ConfigurationProperty("accessToken")] + public string AccessToken + { + get { return base["accessToken"] as string; } + } + + [ConfigurationProperty("accessTokenSecret")] + public string AccessTokenSecret + { + get { return base["accessTokenSecret"] as string; } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/TwitterSignInConfigurationElement.cs Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,21 @@ +using System.Configuration; + +namespace AltNetHispano.Agendas.Configurations +{ + public class TwitterSignInConfigurationElement : ConfigurationElement + { + [ConfigurationProperty("consumerKey")] + public string ConsumerKey + { + get { return base["consumerKey"] as string; } + + } + + [ConfigurationProperty("consumerSecret")] + public string ConsumerSecret + { + get { return base["consumerSecret"] as string; } + + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Configurations/build.bat Fri Aug 05 21:39:37 2011 -0300 @@ -0,0 +1,3 @@ +"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\xsd.exe" "C:\Users\nelo.NELUZ\Desktop\altnethispano\Agendas\trunk\src\Agendas.Configurations\bin\Debug\AltNetHispano.Agendas.Configurations.dll" /type:PublicadoresSection /outputdir:"C:\Users\nelo.NELUZ\Desktop\altnethispano\Agendas\trunk\src\Agendas.Configurations" + +PAUSE \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Factories/AgendaFactory.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Factories/AgendaFactory.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,7 +1,9 @@ -using Agendas.NHibernate; +using Agendas.Blog.Impl; +using Agendas.NHibernate; using AltNetHispano.Agendas.Domain; using AltNetHispano.Agendas.Domain.Repositories; using AltNetHispano.Agendas.Domain.Services; +using AltNetHispano.Agendas.Google; using AltNetHispano.Agendas.Repositories.NHibernate; using AltNetHispano.Agendas.Twitter; using NHibernate; @@ -15,10 +17,13 @@ public static Agenda GetAgenda() { + var publicadores = + new CompositePublicador(new IPublicador[] {new TwitterPublicador(), new BlogPublicador(), new GooglePublicador()}); + ISessionFactory sessionFactory = NhHelper.GetSessionFactory(); return _agenda ?? (_agenda = - new Agenda(new TwitterPublicador(), new EventoRepository(sessionFactory), + new Agenda(publicadores, new EventoRepository(sessionFactory), new PersonaRepository(sessionFactory), new PatrocinadorRepository(sessionFactory))); }
--- a/Agendas/trunk/src/Agendas.Factories/Agendas.Factories.csproj Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Factories/Agendas.Factories.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -49,10 +49,18 @@ <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Agendas.Blog\Agendas.Blog.csproj"> + <Project>{DDD605FF-EF42-428A-AEB6-F3496A46A82B}</Project> + <Name>Agendas.Blog</Name> + </ProjectReference> <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj"> <Project>{A14907DF-02E4-4FA7-BE27-4292AF50AA22}</Project> <Name>Agendas.Domain</Name> </ProjectReference> + <ProjectReference Include="..\Agendas.Google\Agendas.Google.csproj"> + <Project>{45804F1F-EB72-4F82-A227-088CAD9B785D}</Project> + <Name>Agendas.Google</Name> + </ProjectReference> <ProjectReference Include="..\Agendas.NHibernate\Agendas.NHibernate.csproj"> <Project>{9519A43A-9D5E-4BFD-9F88-AFFC53C9973A}</Project> <Name>Agendas.NHibernate</Name>
--- a/Agendas/trunk/src/Agendas.Google.Test/App.config Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Google.Test/App.config Fri Aug 05 21:39:37 2011 -0300 @@ -1,8 +1,13 @@ -<?xml version="1.0" encoding="utf-8" ?> +<?xml version="1.0" encoding="utf-8"?> + <configuration> - <appSettings> - <add key="userNameGoogleCalendar" value="altnethispano.desa@gmail.com" /> - <add key="passwordGoogleCalendar" value="fA&Ec3wU3est" /> - <add key="calendarIdGoogleCalendar" value="altnethispano.desa@gmail.com" /> - </appSettings> + <configSections> + <section name="publicadores" type="AltNetHispano.Agendas.Configurations.PublicadoresConfigurationSection, AltNetHispano.Agendas.Configurations, Version=1.0.0.0, Culture=neutral" /> + </configSections> + + <publicadores> + <google enabled="true"> + <calendar userName="altnethispano.desa@gmail.com" password="fA&Ec3wU3est" calendarId="altnethispano.desa@gmail.com" /> + </google> + </publicadores> </configuration> \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Google.Test/GCalendarTest.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Google.Test/GCalendarTest.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,10 +1,8 @@ using System; -using System.Configuration; using AltNetHispano.Agendas.Domain; using AltNetHispano.Agendas.Google; using AltNetHispano.Agendas.Google.DetailsEvents; using AltNetHispano.Agendas.Tests; -using Moq; using NUnit.Framework; namespace Agendas.Google.Test @@ -17,9 +15,7 @@ [Test] public void CrearEventoGoogleCalendar() { - var gCalendar = new GCalendarAdapter("VAN", ConfigurationManager.AppSettings["userNameGoogleCalendar"], - ConfigurationManager.AppSettings["passwordGoogleCalendar"], - ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]); + var gCalendar = new GCalendarAdapter("VAN"); var ev = Evento.Agendar("Evento Test", null, _fechaEvento, "url", TipoEvento.Cafe); string message; var detail = new CafeGEventDetail(); @@ -32,9 +28,7 @@ [Test] public void EliminarEventoGoogleCalendar() { - var gCalendar = new GCalendarAdapter("VAN", ConfigurationManager.AppSettings["userNameGoogleCalendar"], - ConfigurationManager.AppSettings["passwordGoogleCalendar"], - ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]); + var gCalendar = new GCalendarAdapter("VAN"); string message; var startEvent = new DateTime(_fechaEvento.Year, _fechaEvento.Month, _fechaEvento.Day, 18, 0, 0, DateTimeKind.Utc);
--- a/Agendas/trunk/src/Agendas.Google/Agendas.Google.csproj Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Google/Agendas.Google.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -63,6 +63,10 @@ <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Agendas.Configurations\Agendas.Configurations.csproj"> + <Project>{583304D0-51C7-4808-BE20-6E9A904CA908}</Project> + <Name>Agendas.Configurations</Name> + </ProjectReference> <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj"> <Project>{A14907DF-02E4-4FA7-BE27-4292AF50AA22}</Project> <Name>Agendas.Domain</Name>
--- a/Agendas/trunk/src/Agendas.Google/GCalendarAdapter.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Google/GCalendarAdapter.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,79 +1,90 @@ using System; +using AltNetHispano.Agendas.Configurations; using Google.GData.Calendar; using Google.GData.Extensions; namespace AltNetHispano.Agendas.Google { - public class GCalendarAdapter : IGCalendarAdapter - { - private readonly CalendarService _service; - private readonly Uri _feedUri; + public class GCalendarAdapter : IGCalendarAdapter + { + private readonly CalendarService _service; + private readonly Uri _feedUri; - public bool CreateEvent(IGEventDetail gEventDetail, out string message) - { - try - { - var entry = new EventEntry - { - Title = { Text = gEventDetail.Title }, - Content = { Content = gEventDetail.Summary } - }; + public bool CreateEvent(IGEventDetail gEventDetail, out string message) + { + try + { + var entry = new EventEntry + { + Title = {Text = gEventDetail.Title}, + Content = {Content = gEventDetail.Summary} + }; - var eventLocation = new Where - { - ValueString = gEventDetail.Location - }; + var eventLocation = new Where + { + ValueString = gEventDetail.Location + }; - entry.Locations.Add(eventLocation); + entry.Locations.Add(eventLocation); - var eventTime = new When(gEventDetail.StartEvent, gEventDetail.EndEvent); - entry.Times.Add(eventTime); + var eventTime = new When(gEventDetail.StartEvent, gEventDetail.EndEvent); + entry.Times.Add(eventTime); - _service.Insert(_feedUri, entry); - message = "Event create successful"; - return true; - } - catch (Exception exception) - { - message = exception.Message; - return false; - } - } + _service.Insert(_feedUri, entry); + message = "Event create successful"; + return true; + } + catch (Exception exception) + { + message = exception.Message; + return false; + } + } - public bool DeleteEvent(DateTime startEvent, DateTime endEvent, out string message) - { - try - { - var myQuery = new EventQuery - { - StartTime = startEvent, - EndTime = endEvent, - Uri = _feedUri - }; + public bool DeleteEvent(DateTime startEvent, DateTime endEvent, out string message) + { + try + { + var myQuery = new EventQuery + { + StartTime = startEvent, + EndTime = endEvent, + Uri = _feedUri + }; - var myResultsFeed = _service.Query(myQuery); - if (myResultsFeed.Entries.Count > 0) - { - myResultsFeed.Entries[0].Delete(); - message = "Event delete successful"; - return true; - } + var myResultsFeed = _service.Query(myQuery); + if (myResultsFeed.Entries.Count > 0) + { + myResultsFeed.Entries[0].Delete(); + message = "Event delete successful"; + return true; + } - message = "Event not found"; - return false; - } - catch (Exception exception) - { - message = exception.Message; - return false; - } - } + message = "Event not found"; + return false; + } + catch (Exception exception) + { + message = exception.Message; + return false; + } + } - public GCalendarAdapter(string applicationName ,string userName, string password, string calendarId) - { - _service = new CalendarService(applicationName); - _service.setUserCredentials(userName, password); - _feedUri = new Uri("https://www.google.com/calendar/feeds/" + calendarId + "/private/full"); - } - } + public GCalendarAdapter(string applicationName) : this(applicationName, + AgendasConfigurationManager.Publicadores.Google.Calendar. + UserName, + AgendasConfigurationManager.Publicadores.Google.Calendar. + Password, + AgendasConfigurationManager.Publicadores.Google.Calendar. + CalendarId) + { + } + + public GCalendarAdapter(string applicationName, string userName, string password, string calendarId) + { + _service = new CalendarService(applicationName); + _service.setUserCredentials(userName, password); + _feedUri = new Uri("https://www.google.com/calendar/feeds/" + calendarId + "/private/full"); + } + } } \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Google/GooglePublicador.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Google/GooglePublicador.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,5 +1,5 @@ using System.Collections.Generic; -using System.Configuration; +using AltNetHispano.Agendas.Configurations; using AltNetHispano.Agendas.Domain; using AltNetHispano.Agendas.Google.DetailsEvents; @@ -12,21 +12,23 @@ private static string GetUserName { - get { return ConfigurationManager.AppSettings["userNameGoogleCalendar"]; } + get { return AgendasConfigurationManager.Publicadores.Google.Calendar.UserName; } } private static string GetPassword { - get { return ConfigurationManager.AppSettings["passwordGoogleCalendar"]; } + get { return AgendasConfigurationManager.Publicadores.Google.Calendar.Password; } } private static string GetCalendarId { - get { return ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]; } + get { return AgendasConfigurationManager.Publicadores.Google.Calendar.CalendarId; } } public void Publicar(IEnumerable<Track> tracks) { + if (!AgendasConfigurationManager.Publicadores.Google.Enabled) return; + foreach (var track in tracks) { switch (track.Accion)
--- a/Agendas/trunk/src/Agendas.Tests/App.config Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/App.config Fri Aug 05 21:39:37 2011 -0300 @@ -1,6 +1,15 @@ <?xml version="1.0" encoding="utf-8" ?> <configuration> + <configSections> + <section name="publicadores" type="AltNetHispano.Agendas.Configurations.PublicadoresConfigurationSection, AltNetHispano.Agendas.Configurations, Version=1.0.0.0, Culture=neutral" /> + </configSections> + <connectionStrings> <add name="AltNetHispano" connectionString="Data Source=.\sqlexpress;Initial Catalog=AltNetHispano_Test;Integrated Security=SSPI"/> </connectionStrings> + + <publicadores> + <blog enabled="true" /> + </publicadores> + </configuration> \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Blog/PostWriterWebServiceAdapterTests.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/Blog/PostWriterWebServiceAdapterTests.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,14 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Linq; -using System.ServiceModel; -using System.Text; -using Agendas.Blog; -using Agendas.Blog.Exceptions; +using System.ServiceModel; using Agendas.Blog.Impl; -using AltNetHispano.Agendas.Domain; -using Moq; using NUnit.Framework; namespace AltNetHispano.Agendas.Tests.Blog
--- a/Agendas/trunk/src/Agendas.Twitter.Tests/Agendas.Twitter.Tests.csproj Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Agendas.Twitter.Tests.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -63,7 +63,9 @@ <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> - <None Include="App.config" /> + <None Include="App.config"> + <SubType>Designer</SubType> + </None> <None Include="packages.config" /> </ItemGroup> <ItemGroup>
--- a/Agendas/trunk/src/Agendas.Twitter.Tests/App.config Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter.Tests/App.config Fri Aug 05 21:39:37 2011 -0300 @@ -1,9 +1,15 @@ -<?xml version="1.0" encoding="utf-8" ?> +<?xml version="1.0" encoding="utf-8"?> + <configuration> - <appSettings> - <add key="consumerKeyAppTwitt" value="UpwG7RKRAqQfdsCKnBfHA"/> - <add key="consumerSecretAppTwitt" value="HIOb9tMewejyFX97mhsQO2FXSEQN4kzJFF6iQLx4k"/> - <add key="accessTokenAppTwitt" value="301500900-1GGyiecfAgmbrJMEcjp4XA9KXEJU2bBLyEQNQL5S" /> - <add key="accessTokenSecretAppTwitt" value="46vNqg4djzyh9GRtZoUv0c7uEl7mQ3CjVBeJ4wwRpds"/> - </appSettings> + <configSections> + <section name="publicadores" type="AltNetHispano.Agendas.Configurations.PublicadoresConfigurationSection, AltNetHispano.Agendas.Configurations, Version=1.0.0.0, Culture=neutral" /> + </configSections> + + <publicadores> + <twitter enabled="true"> + <signIn consumerKey="uUSzC5EZ2LCNoBmaQXcUFA" consumerSecret="CNN2uUwza4nGNoZf3FlAqC0xoUEKXKFWxZn3Frow" /> + <sendTwitter consumerKey="UpwG7RKRAqQfdsCKnBfHA" consumerSecret="HIOb9tMewejyFX97mhsQO2FXSEQN4kzJFF6iQLx4k" accessToken="301500900-1GGyiecfAgmbrJMEcjp4XA9KXEJU2bBLyEQNQL5S" accessTokenSecret="46vNqg4djzyh9GRtZoUv0c7uEl7mQ3CjVBeJ4wwRpds" /> + </twitter> + </publicadores> + </configuration> \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Publicador_tests.cs Fri Aug 05 21:39:37 2011 -0300 @@ -4,7 +4,6 @@ using AltNetHispano.Agendas.Twitter; using Moq; using NUnit.Framework; -using Twitterizer; namespace Agendas.Twitter.Tests { @@ -15,17 +14,10 @@ public void Proponer_evento() { var adapter = new Mock<ITwitterAdapter>(); + + string message; string twitt = null; - - var response = new TwitterResponse<TwitterStatus> - { - Result = - RequestResult.Success - }; - - adapter.Setup(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>())) - .Returns(response) - .Callback<OAuthTokens, string>((tokens, status) => twitt = status); + adapter.Setup(a => a.Update(It.IsAny<string>(), out message)).Returns(true).Callback<string, string>((status, m) => twitt = status); var publicador = new TwitterPublicador(adapter.Object); @@ -33,7 +25,7 @@ agenda.Proponer("Identity Providers", null, null, TipoEvento.GrupoEstudio); - adapter.Verify(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()), Times.Once()); + adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Once()); Assert.That(twitt, Is.StringContaining("GrupoEstudio")); } @@ -42,28 +34,21 @@ public void Proponer_y_agendar_evento() { var adapter = new Mock<ITwitterAdapter>(); + + string message; string twitt = null; - - var response = new TwitterResponse<TwitterStatus> - { - Result = - RequestResult.Success - }; - - adapter.Setup(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>())) - .Returns(response) - .Callback<OAuthTokens, string>((tokens, status) => twitt = status); + adapter.Setup(a => a.Update(It.IsAny<string>(), out message)).Returns(true).Callback<string, string>((status, m) => twitt = status); var publicador = new TwitterPublicador(adapter.Object); var agenda = new Agenda(publicador, DefaultEventoRepository, DefaultPersonaRepository, DefaultPatrocinadorRepository); agenda.Proponer("Identity Providers", null, null, TipoEvento.GrupoEstudio); - adapter.Verify(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()), Times.Once()); + adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Once()); agenda.Agendar("Identity Providers", TestsHelper.GetOrCreatePonente("Nelo Pauselli"), DateTime.Today.AddDays(7), null, TipoEvento.GrupoEstudio); - adapter.Verify(a => a.UpdateStatus(It.IsAny<OAuthTokens>(), It.IsAny<string>()), Times.Exactly(2)); + adapter.Verify(a => a.Update(It.IsAny<string>(), out message), Times.Exactly(2)); Assert.That(twitt, Is.StringContaining("@nelopauselli"));
--- a/Agendas/trunk/src/Agendas.Twitter.Tests/Send_twitt_tests.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Send_twitt_tests.cs Fri Aug 05 21:39:37 2011 -0300 @@ -10,10 +10,10 @@ [Test] public void Send_twitt() { - var p = new TwitterPublicador(); + var p = new TwitterAdapter(); string message; - var r = p.Publicar("Ejecutando los tests. Hora: " + DateTime.Now, out message); + var r = p.Update("Ejecutando los tests. Hora: " + DateTime.Now, out message); Console.WriteLine(message); Assert.IsTrue(r);
--- a/Agendas/trunk/src/Agendas.Twitter/Agendas.Twitter.csproj Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter/Agendas.Twitter.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -60,6 +60,10 @@ <Compile Include="Writers\TwitterHelper.cs" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Agendas.Configurations\Agendas.Configurations.csproj"> + <Project>{583304D0-51C7-4808-BE20-6E9A904CA908}</Project> + <Name>Agendas.Configurations</Name> + </ProjectReference> <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj"> <Project>{A14907DF-02E4-4FA7-BE27-4292AF50AA22}</Project> <Name>Agendas.Domain</Name>
--- a/Agendas/trunk/src/Agendas.Twitter/ITwitterAdapter.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter/ITwitterAdapter.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,4 +1,5 @@ using System; +using AltNetHispano.Agendas.Configurations; using Twitterizer; namespace AltNetHispano.Agendas.Twitter @@ -7,11 +8,40 @@ { Uri BuildAuthorizationUri(string consumerKey, string consumerSecret, string callbackAddress); string GetAccessToken(string consumerKey, string consumerSecret, string requestToken, string verifier); - TwitterResponse<TwitterStatus> UpdateStatus(OAuthTokens tokens, string status); + bool Update(string status, out string message); } public class TwitterAdapter : ITwitterAdapter { + private static TwitterConfigurationElement _config; + + public TwitterAdapter() + { + _config = AgendasConfigurationManager.Publicadores.Twitter; + } + + private static string ConsumerKey + { + get { return _config.SendTwitter.ConsumerKey; } + } + + private static string ConsumerSecret + { + get { return _config.SendTwitter.ConsumerSecret; } + } + + + private static string AccessToken + { + get { return _config.SendTwitter.AccessToken; } + } + + + private static string AccessTokenSecret + { + get { return _config.SendTwitter.AccessTokenSecret; } + } + public Uri BuildAuthorizationUri(string consumerKey, string consumerSecret, string callbackAddress) { // Obtain a request token @@ -47,9 +77,21 @@ } - public TwitterResponse<TwitterStatus> UpdateStatus(OAuthTokens tokens, string status) + public bool Update(string status, out string message) { - return TwitterStatus.Update(tokens, status); + var tokens = new OAuthTokens + { + ConsumerKey = ConsumerKey, + ConsumerSecret = ConsumerSecret, + AccessToken = AccessToken, + AccessTokenSecret = AccessTokenSecret + }; + + var response = TwitterStatus.Update(tokens, status); + + message = response.ErrorMessage; + return response.Result == RequestResult.Success; + } } } \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,9 +1,8 @@ using System.Collections.Generic; -using System.Configuration; using System.Linq; +using AltNetHispano.Agendas.Configurations; using AltNetHispano.Agendas.Domain; using AltNetHispano.Agendas.Twitter.Writers; -using Twitterizer; namespace AltNetHispano.Agendas.Twitter { @@ -32,30 +31,10 @@ private const int LIMITE_MENSAJE = 140; - private static string ConsumerKey - { - get { return ConfigurationManager.AppSettings["consumerKeyAppTwitt"]; } - } - - private static string ConsumerSecret - { - get { return ConfigurationManager.AppSettings["consumerSecretAppTwitt"]; } - } - - - private static string AccessToken - { - get { return ConfigurationManager.AppSettings["accessTokenAppTwitt"]; } - } - - - private static string AccessTokenSecret - { - get { return ConfigurationManager.AppSettings["accessTokenSecretAppTwitt"]; } - } - public void Publicar(IEnumerable<Track> tracks) { + if (!AgendasConfigurationManager.Publicadores.Twitter.Enabled) return; + foreach (var track in tracks) { //Si ya hicimos el twitt de este track, no volvemos a hacerlo @@ -65,7 +44,7 @@ if (!string.IsNullOrWhiteSpace(twitt)) { string message; - bool success = Publicar(twitt, out message); + bool success = _twitterAdapter.Update(twitt, out message); track.LogAdd(new TrackLog(TrackLogPropietario.Twitter, message, track.Usuario, success)); } } @@ -81,21 +60,5 @@ return body.Length > LIMITE_MENSAJE ? body.Substring(0, LIMITE_MENSAJE - 1) : body; } - - public bool Publicar(string status, out string message) - { - var tokens = new OAuthTokens - { - ConsumerKey = ConsumerKey, - ConsumerSecret = ConsumerSecret, - AccessToken = AccessToken, - AccessTokenSecret = AccessTokenSecret - }; - - var response = _twitterAdapter.UpdateStatus(tokens, status); - - message = response.ErrorMessage; - return response.Result == RequestResult.Success; - } } } \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs Fri Aug 05 21:39:37 2011 -0300 @@ -1,5 +1,5 @@ using System; -using System.Configuration; +using AltNetHispano.Agendas.Configurations; namespace AltNetHispano.Agendas.Twitter { @@ -19,12 +19,12 @@ private string ConsumerKey { - get { return ConfigurationManager.AppSettings["consumerKeyAppSignIn"]; } + get { return AgendasConfigurationManager.Publicadores.Twitter.SignIn.ConsumerKey; } } private string ConsumerSecret { - get { return ConfigurationManager.AppSettings["consumerSecretAppSignIn"]; } + get { return AgendasConfigurationManager.Publicadores.Twitter.SignIn.ConsumerSecret; } } public Uri AuthorizationLinkGet(string callbackAddress)
--- a/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Fri Aug 05 21:39:37 2011 -0300 @@ -56,7 +56,6 @@ <Reference Include="System.Web.Abstractions" /> <Reference Include="System.Web.Routing" /> <Reference Include="System.Xml" /> - <Reference Include="System.Configuration" /> <Reference Include="System.Web.Services" /> <Reference Include="System.EnterpriseServices" /> </ItemGroup> @@ -163,6 +162,10 @@ <Content Include="Views\Evento\Index.cshtml" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Agendas.Configurations\Agendas.Configurations.csproj"> + <Project>{583304D0-51C7-4808-BE20-6E9A904CA908}</Project> + <Name>Agendas.Configurations</Name> + </ProjectReference> <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj"> <Project>{A14907DF-02E4-4FA7-BE27-4292AF50AA22}</Project> <Name>Agendas.Domain</Name>
--- a/Agendas/trunk/src/Agendas.Web/DataProviders.cs Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/DataProviders.cs Fri Aug 05 21:39:37 2011 -0300 @@ -23,6 +23,5 @@ select new SelectListItem {Text = p.Nombre, Value = p.Id.ToString(), Selected = p.Id.Equals(id)}; } - } -} \ No newline at end of file +}
--- a/Agendas/trunk/src/Agendas.Web/Web.config Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Web.config Fri Aug 05 21:39:37 2011 -0300 @@ -5,23 +5,15 @@ --> <configuration> + <configSections> + <section name="publicadores" type="AltNetHispano.Agendas.Configurations.PublicadoresConfigurationSection, AltNetHispano.Agendas.Configurations, Version=1.0.0.0, Culture=neutral" /> + </configSections> + <connectionStrings> <add name="AltNetHispano" connectionString="Data Source=.\sqlexpress;Initial Catalog=AltNetHispano;Integrated Security=SSPI"/> </connectionStrings> <appSettings> - <add key="consumerKeyAppSignIn" value="uUSzC5EZ2LCNoBmaQXcUFA"/> - <add key="consumerSecretAppSignIn" value="CNN2uUwza4nGNoZf3FlAqC0xoUEKXKFWxZn3Frow"/> - - <add key="consumerKeyAppTwitt" value="UpwG7RKRAqQfdsCKnBfHA"/> - <add key="consumerSecretAppTwitt" value="HIOb9tMewejyFX97mhsQO2FXSEQN4kzJFF6iQLx4k"/> - <add key="accessTokenAppTwitt" value="301500900-1GGyiecfAgmbrJMEcjp4XA9KXEJU2bBLyEQNQL5S" /> - <add key="accessTokenSecretAppTwitt" value="46vNqg4djzyh9GRtZoUv0c7uEl7mQ3CjVBeJ4wwRpds"/> - - <add key="userNameGoogleCalendar" value="altnethispano.desa@gmail.com" /> - <add key="passwordGoogleCalendar" value="" /> - <add key="calendarIdGoogleCalendar" value="altnethispano.desa@gmail.com" /> - <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> </appSettings> @@ -93,4 +85,17 @@ </dependentAssembly> </assemblyBinding> </runtime> + + <publicadores> + <twitter enabled="true"> + <signIn consumerKey="uUSzC5EZ2LCNoBmaQXcUFA" consumerSecret="CNN2uUwza4nGNoZf3FlAqC0xoUEKXKFWxZn3Frow" /> + <sendTwitter consumerKey="UpwG7RKRAqQfdsCKnBfHA" consumerSecret="HIOb9tMewejyFX97mhsQO2FXSEQN4kzJFF6iQLx4k" accessToken="301500900-1GGyiecfAgmbrJMEcjp4XA9KXEJU2bBLyEQNQL5S" accessTokenSecret="46vNqg4djzyh9GRtZoUv0c7uEl7mQ3CjVBeJ4wwRpds"/> + </twitter> + <google enabled="true"> + <calendar userName="altnethispano.desa@gmail.com" password="" calendarId="altnethispano.desa@gmail.com" /> + </google> + <blog enabled="false"> + <writer postWriterServiceUrl="http://dummy/dummy.aspx" blogName="dummy" blogWriterMasterKey="dummy" /> + </blog> + </publicadores> </configuration> \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.sln Fri Aug 05 21:37:30 2011 -0300 +++ b/Agendas/trunk/src/Agendas.sln Fri Aug 05 21:39:37 2011 -0300 @@ -34,6 +34,10 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Google.Test", "Agendas.Google.Test\Agendas.Google.Test.csproj", "{3257EEC5-8FB7-4AD6-AD4C-F9748A1791B1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Configurations", "Agendas.Configurations\Agendas.Configurations.csproj", "{583304D0-51C7-4808-BE20-6E9A904CA908}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Configurations.Tests", "Agendas.Configurations.Tests\Agendas.Configurations.Tests.csproj", "{BBE36765-6AAB-4689-B2F3-6D18E3F11746}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -92,6 +96,14 @@ {3257EEC5-8FB7-4AD6-AD4C-F9748A1791B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {3257EEC5-8FB7-4AD6-AD4C-F9748A1791B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {3257EEC5-8FB7-4AD6-AD4C-F9748A1791B1}.Release|Any CPU.Build.0 = Release|Any CPU + {583304D0-51C7-4808-BE20-6E9A904CA908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {583304D0-51C7-4808-BE20-6E9A904CA908}.Debug|Any CPU.Build.0 = Debug|Any CPU + {583304D0-51C7-4808-BE20-6E9A904CA908}.Release|Any CPU.ActiveCfg = Release|Any CPU + {583304D0-51C7-4808-BE20-6E9A904CA908}.Release|Any CPU.Build.0 = Release|Any CPU + {BBE36765-6AAB-4689-B2F3-6D18E3F11746}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BBE36765-6AAB-4689-B2F3-6D18E3F11746}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BBE36765-6AAB-4689-B2F3-6D18E3F11746}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BBE36765-6AAB-4689-B2F3-6D18E3F11746}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE