Mercurial > altnet-hispano
changeset 100:cc91817a4206
Merge
author | jorge.rowies |
---|---|
date | Sat, 04 Jun 2011 22:46:06 -0300 |
parents | 3027c64344bd (diff) 2434c2323f3d (current diff) |
children | 9bfdd5bf3ad2 |
files | Agendas/trunk/src/Agendas.Blog/Impl/AgendarReunionPostWriter.cs Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs Agendas/trunk/src/Agendas.Blog/Impl/PublicarReunionPostWriter.cs Agendas/trunk/src/Agendas.Domain/Ponente.cs Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Agendas/trunk/src/Agendas.Tests/Blog/PublicadorTests.cs |
diffstat | 22 files changed, 897 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Blog/Agendas.Blog.csproj Sat Jun 04 19:41:40 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Agendas.Blog.csproj Sat Jun 04 22:46:06 2011 -0300 @@ -32,7 +32,10 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> + <Reference Include="System.Runtime.Serialization" /> + <Reference Include="System.ServiceModel" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> @@ -40,12 +43,17 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Exceptions\BlogNameNotFoundException.cs" /> + <Compile Include="Exceptions\PostWriterServiceUrlNotFoundException.cs" /> <Compile Include="Impl\BlogPublicador.cs" /> + <Compile Include="Exceptions\BlogWriterMasterKeyNotFoundException.cs" /> <Compile Include="IPostWriter.cs" /> <Compile Include="IPostWriterFactory.cs" /> <Compile Include="Impl\NullObjectPostWriter.cs" /> <Compile Include="Impl\PostWriter.cs" /> <Compile Include="Impl\PostWriterFactory.cs" /> + <Compile Include="IPostWriterWebService.cs" /> + <Compile Include="Impl\PostWriterWebServiceAdapter.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> @@ -54,6 +62,11 @@ </Compile> <Compile Include="Impl\PublicarReunionPostWriter.cs" /> <Compile Include="Impl\AgendarReunionPostWriter.cs" /> + <Compile Include="Service References\PortalSitefinity\Reference.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Reference.svcmap</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj"> @@ -68,6 +81,32 @@ <SubType>Designer</SubType> </EmbeddedResource> </ItemGroup> + <ItemGroup> + <WCFMetadata Include="Service References\" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="Service References\PortalSitefinity\PostWriterWebService.wsdl" /> + </ItemGroup> + <ItemGroup> + <WCFMetadataStorage Include="Service References\PortalSitefinity\" /> + </ItemGroup> + <ItemGroup> + <None Include="Service References\PortalSitefinity\PostWriterWebService.disco" /> + </ItemGroup> + <ItemGroup> + <None Include="Service References\PortalSitefinity\configuration91.svcinfo" /> + </ItemGroup> + <ItemGroup> + <None Include="Service References\PortalSitefinity\configuration.svcinfo" /> + </ItemGroup> + <ItemGroup> + <None Include="Service References\PortalSitefinity\Reference.svcmap"> + <Generator>WCF Proxy Generator</Generator> + <LastGenOutput>Reference.cs</LastGenOutput> + </None> + </ItemGroup> + <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.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Exceptions/BlogNameNotFoundException.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,13 @@ +using System; + +namespace Agendas.Blog.Exceptions +{ + public class BlogNameNotFoundException : Exception + { + public BlogNameNotFoundException() + : base("Key 'PublicadorBlog.BlogName' not found in appSettings") + { + + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Exceptions/BlogWriterMasterKeyNotFoundException.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,12 @@ +using System; + +namespace Agendas.Blog.Exceptions +{ + public class BlogWriterMasterKeyNotFoundException : Exception + { + public BlogWriterMasterKeyNotFoundException() + : base("Key 'PublicadorBlog.BlogWriterMasterKey' not found in appSettings") + { + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Exceptions/PostWriterServiceUrlNotFoundException.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,12 @@ +using System; + +namespace Agendas.Blog.Exceptions +{ + public class PostWriterServiceUrlNotFoundException : Exception + { + public PostWriterServiceUrlNotFoundException() + : base("Key 'PublicadorBlog.PostWriterServiceUrl' not found in appSettings") + { + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/IPostWriterWebService.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,7 @@ +namespace Agendas.Blog +{ + public interface IPostWriterWebService + { + void WriteBlogPost(string postTitle, string postHtmlContent, string postAuthor, bool setPublicationDate); + } +}
--- a/Agendas/trunk/src/Agendas.Blog/Impl/AgendarReunionPostWriter.cs Sat Jun 04 19:41:40 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/AgendarReunionPostWriter.cs Sat Jun 04 22:46:06 2011 -0300 @@ -8,7 +8,11 @@ { public class AgendarReunionPostWriter : PostWriter { - protected override string GetTitle(Evento evento) + public AgendarReunionPostWriter(IPostWriterWebService postWriterWebService) : base(postWriterWebService) + { + } + + protected override string GetTitle(Evento evento) { return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Title, evento.Ponente.Nombre, //Nombre y apellido del ponente
--- a/Agendas/trunk/src/Agendas.Blog/Impl/NullObjectPostWriter.cs Sat Jun 04 19:41:40 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/NullObjectPostWriter.cs Sat Jun 04 22:46:06 2011 -0300 @@ -4,6 +4,10 @@ { public class NullObjectPostWriter : PostWriter { + public NullObjectPostWriter(IPostWriterWebService postWriterWebService) : base(postWriterWebService) + { + } + public override void WritePost(Evento evento) { //no-op
--- a/Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs Sat Jun 04 19:41:40 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs Sat Jun 04 22:46:06 2011 -0300 @@ -1,16 +1,22 @@ -using System; -using System.Linq; +using System.Linq; using AltNetHispano.Agendas.Domain; namespace Agendas.Blog.Impl { public abstract class PostWriter : IPostWriter { + private readonly IPostWriterWebService _postWriterWebService; + + protected PostWriter(IPostWriterWebService postWriterWebService) + { + _postWriterWebService = postWriterWebService; + } + public virtual void WritePost(Evento evento) { var title = GetTitle(evento); var body = GetBody(evento); - this.ExecuteService(title, body); + this.ExecuteService(title, body, this.GetNombreUsuario(evento)); } protected abstract string GetBody(Evento evento); @@ -22,10 +28,11 @@ return evento.Tracks.Single(t => t.Accion == Accion.Publicar).Usuario.Nombre; } - protected void ExecuteService(string title, string body) + protected void ExecuteService(string title, string body, string author) { - //TODO: invocar al web service - throw new NotImplementedException(); + _postWriterWebService.WriteBlogPost(title, body, author, true); } + + } } \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Blog/Impl/PostWriterFactory.cs Sat Jun 04 19:41:40 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/PostWriterFactory.cs Sat Jun 04 22:46:06 2011 -0300 @@ -4,16 +4,23 @@ { public class PostWriterFactory : IPostWriterFactory { + private readonly IPostWriterWebService _postWriterWebService; + + public PostWriterFactory(IPostWriterWebService postWriterWebService) + { + _postWriterWebService = postWriterWebService; + } + public IPostWriter GetPostWriter(Accion accion) { switch (accion) { case Accion.Agendar: - return new AgendarReunionPostWriter(); + return new AgendarReunionPostWriter(_postWriterWebService); case Accion.Publicar: - return new PublicarReunionPostWriter(); + return new PublicarReunionPostWriter(_postWriterWebService); default: - return new NullObjectPostWriter(); + return new NullObjectPostWriter(_postWriterWebService); } } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/PostWriterWebServiceAdapter.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,60 @@ +using System; +using System.Globalization; +using System.Security.Cryptography; +using System.ServiceModel; +using Agendas.Blog.Exceptions; +using Agendas.Blog.PortalSitefinity; + +namespace Agendas.Blog.Impl +{ + public class PostWriterWebServiceAdapter : IPostWriterWebService + { + private readonly PostWriterWebServiceSoapClient _service; + + public PostWriterWebServiceAdapter() + { + var postWriterUrl = System.Configuration.ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"]; + if (string.IsNullOrEmpty(postWriterUrl)) + throw new PostWriterServiceUrlNotFoundException(); + + _service = new PortalSitefinity.PostWriterWebServiceSoapClient(new BasicHttpBinding(), new EndpointAddress(postWriterUrl)); + } + + private static string buildToken(string key, DateTime time) + { + var aux = key + time.ToString(CultureInfo.InvariantCulture); + + var enc = System.Text.Encoding.ASCII.GetEncoder(); + + var data = new byte[aux.Length]; + enc.GetBytes(aux.ToCharArray(), 0, aux.Length, data, 0, true); + + var md5 = new MD5CryptoServiceProvider(); + var result = md5.ComputeHash(data); + + return BitConverter.ToString(result).Replace("-", "").ToLower(); + } + + public void WriteBlogPost(string postTitle, string postHtmlContent, string postAuthor, bool setPublicationDate) + { + var securityToken = getSecurityToken(); + var blogName = System.Configuration.ConfigurationManager.AppSettings["PublicadorBlog.BlogName"]; + if (string.IsNullOrEmpty(blogName)) + throw new BlogNameNotFoundException(); + + _service.WriteBlogPost(securityToken, blogName, postTitle, postHtmlContent, postAuthor, setPublicationDate); + } + + private static string getSecurityToken() + { + var masterKey = System.Configuration.ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"]; + if (string.IsNullOrEmpty(masterKey)) + throw new BlogWriterMasterKeyNotFoundException(); + + var now = DateTime.UtcNow; + now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, 0); + + return buildToken(masterKey, now); + } + } +} \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Blog/Impl/PublicarReunionPostWriter.cs Sat Jun 04 19:41:40 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/PublicarReunionPostWriter.cs Sat Jun 04 22:46:06 2011 -0300 @@ -7,6 +7,10 @@ { public class PublicarReunionPostWriter : PostWriter { + public PublicarReunionPostWriter(IPostWriterWebService postWriterWebService) : base(postWriterWebService) + { + } + protected override string GetTitle(Evento evento) { return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Publicacion_Title,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Service References/PortalSitefinity/PostWriterWebService.disco Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/"> + <contractRef ref="http://localhost/TestAltNet/PostWriterWebService.asmx?wsdl" docRef="http://localhost/TestAltNet/PostWriterWebService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" /> + <soap address="http://localhost/TestAltNet/PostWriterWebService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:PostWriterWebServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" /> + <soap address="http://localhost/TestAltNet/PostWriterWebService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:PostWriterWebServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" /> +</discovery> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Service References/PortalSitefinity/PostWriterWebService.wsdl Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> + <wsdl:types> + <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> + <s:element name="WriteBlogPost"> + <s:complexType> + <s:sequence> + <s:element minOccurs="0" maxOccurs="1" name="securityToken" type="s:string" /> + <s:element minOccurs="0" maxOccurs="1" name="blogName" type="s:string" /> + <s:element minOccurs="0" maxOccurs="1" name="postTitle" type="s:string" /> + <s:element minOccurs="0" maxOccurs="1" name="postHtmlContent" type="s:string" /> + <s:element minOccurs="0" maxOccurs="1" name="postAuthor" type="s:string" /> + <s:element minOccurs="1" maxOccurs="1" name="setPublicationDate" type="s:boolean" /> + </s:sequence> + </s:complexType> + </s:element> + <s:element name="WriteBlogPostResponse"> + <s:complexType /> + </s:element> + </s:schema> + </wsdl:types> + <wsdl:message name="WriteBlogPostSoapIn"> + <wsdl:part name="parameters" element="tns:WriteBlogPost" /> + </wsdl:message> + <wsdl:message name="WriteBlogPostSoapOut"> + <wsdl:part name="parameters" element="tns:WriteBlogPostResponse" /> + </wsdl:message> + <wsdl:portType name="PostWriterWebServiceSoap"> + <wsdl:operation name="WriteBlogPost"> + <wsdl:input message="tns:WriteBlogPostSoapIn" /> + <wsdl:output message="tns:WriteBlogPostSoapOut" /> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PostWriterWebServiceSoap" type="tns:PostWriterWebServiceSoap"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="WriteBlogPost"> + <soap:operation soapAction="http://tempuri.org/WriteBlogPost" style="document" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:binding name="PostWriterWebServiceSoap12" type="tns:PostWriterWebServiceSoap"> + <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="WriteBlogPost"> + <soap12:operation soapAction="http://tempuri.org/WriteBlogPost" style="document" /> + <wsdl:input> + <soap12:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap12:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PostWriterWebService"> + <wsdl:port name="PostWriterWebServiceSoap" binding="tns:PostWriterWebServiceSoap"> + <soap:address location="http://localhost/TestAltNet/PostWriterWebService.asmx" /> + </wsdl:port> + <wsdl:port name="PostWriterWebServiceSoap12" binding="tns:PostWriterWebServiceSoap12"> + <soap12:address location="http://localhost/TestAltNet/PostWriterWebService.asmx" /> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Service References/PortalSitefinity/Reference.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,148 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.225 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Agendas.Blog.PortalSitefinity { + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="PortalSitefinity.PostWriterWebServiceSoap")] + public interface PostWriterWebServiceSoap { + + // CODEGEN: Generating message contract since element name securityToken from namespace http://tempuri.org/ is not marked nillable + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/WriteBlogPost", ReplyAction="*")] + Agendas.Blog.PortalSitefinity.WriteBlogPostResponse WriteBlogPost(Agendas.Blog.PortalSitefinity.WriteBlogPostRequest request); + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] + public partial class WriteBlogPostRequest { + + [System.ServiceModel.MessageBodyMemberAttribute(Name="WriteBlogPost", Namespace="http://tempuri.org/", Order=0)] + public Agendas.Blog.PortalSitefinity.WriteBlogPostRequestBody Body; + + public WriteBlogPostRequest() { + } + + public WriteBlogPostRequest(Agendas.Blog.PortalSitefinity.WriteBlogPostRequestBody Body) { + this.Body = Body; + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")] + public partial class WriteBlogPostRequestBody { + + [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] + public string securityToken; + + [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)] + public string blogName; + + [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)] + public string postTitle; + + [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=3)] + public string postHtmlContent; + + [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=4)] + public string postAuthor; + + [System.Runtime.Serialization.DataMemberAttribute(Order=5)] + public bool setPublicationDate; + + public WriteBlogPostRequestBody() { + } + + public WriteBlogPostRequestBody(string securityToken, string blogName, string postTitle, string postHtmlContent, string postAuthor, bool setPublicationDate) { + this.securityToken = securityToken; + this.blogName = blogName; + this.postTitle = postTitle; + this.postHtmlContent = postHtmlContent; + this.postAuthor = postAuthor; + this.setPublicationDate = setPublicationDate; + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] + public partial class WriteBlogPostResponse { + + [System.ServiceModel.MessageBodyMemberAttribute(Name="WriteBlogPostResponse", Namespace="http://tempuri.org/", Order=0)] + public Agendas.Blog.PortalSitefinity.WriteBlogPostResponseBody Body; + + public WriteBlogPostResponse() { + } + + public WriteBlogPostResponse(Agendas.Blog.PortalSitefinity.WriteBlogPostResponseBody Body) { + this.Body = Body; + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.Runtime.Serialization.DataContractAttribute()] + public partial class WriteBlogPostResponseBody { + + public WriteBlogPostResponseBody() { + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface PostWriterWebServiceSoapChannel : Agendas.Blog.PortalSitefinity.PostWriterWebServiceSoap, System.ServiceModel.IClientChannel { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class PostWriterWebServiceSoapClient : System.ServiceModel.ClientBase<Agendas.Blog.PortalSitefinity.PostWriterWebServiceSoap>, Agendas.Blog.PortalSitefinity.PostWriterWebServiceSoap { + + public PostWriterWebServiceSoapClient() { + } + + public PostWriterWebServiceSoapClient(string endpointConfigurationName) : + base(endpointConfigurationName) { + } + + public PostWriterWebServiceSoapClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public PostWriterWebServiceSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public PostWriterWebServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + Agendas.Blog.PortalSitefinity.WriteBlogPostResponse Agendas.Blog.PortalSitefinity.PostWriterWebServiceSoap.WriteBlogPost(Agendas.Blog.PortalSitefinity.WriteBlogPostRequest request) { + return base.Channel.WriteBlogPost(request); + } + + public void WriteBlogPost(string securityToken, string blogName, string postTitle, string postHtmlContent, string postAuthor, bool setPublicationDate) { + Agendas.Blog.PortalSitefinity.WriteBlogPostRequest inValue = new Agendas.Blog.PortalSitefinity.WriteBlogPostRequest(); + inValue.Body = new Agendas.Blog.PortalSitefinity.WriteBlogPostRequestBody(); + inValue.Body.securityToken = securityToken; + inValue.Body.blogName = blogName; + inValue.Body.postTitle = postTitle; + inValue.Body.postHtmlContent = postHtmlContent; + inValue.Body.postAuthor = postAuthor; + inValue.Body.setPublicationDate = setPublicationDate; + Agendas.Blog.PortalSitefinity.WriteBlogPostResponse retVal = ((Agendas.Blog.PortalSitefinity.PostWriterWebServiceSoap)(this)).WriteBlogPost(inValue); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Service References/PortalSitefinity/Reference.svcmap Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="644f3d46-8f85-47a9-b8fd-d73d60a7d9c7" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap"> + <ClientOptions> + <GenerateAsynchronousMethods>false</GenerateAsynchronousMethods> + <EnableDataBinding>true</EnableDataBinding> + <ExcludedTypes /> + <ImportXmlTypes>false</ImportXmlTypes> + <GenerateInternalTypes>false</GenerateInternalTypes> + <GenerateMessageContracts>false</GenerateMessageContracts> + <NamespaceMappings /> + <CollectionMappings /> + <GenerateSerializableTypes>true</GenerateSerializableTypes> + <Serializer>Auto</Serializer> + <UseSerializerForFaults>true</UseSerializerForFaults> + <ReferenceAllAssemblies>true</ReferenceAllAssemblies> + <ReferencedAssemblies /> + <ReferencedDataContractTypes /> + <ServiceContractMappings /> + </ClientOptions> + <MetadataSources> + <MetadataSource Address="http://localhost/TestAltNet/PostWriterWebService.asmx" Protocol="http" SourceId="1" /> + </MetadataSources> + <Metadata> + <MetadataFile FileName="PostWriterWebService.wsdl" MetadataType="Wsdl" ID="63e1ae81-6c06-4259-a563-7a6d97d9afae" SourceId="1" SourceUrl="http://localhost/TestAltNet/PostWriterWebService.asmx?wsdl" /> + <MetadataFile FileName="PostWriterWebService.disco" MetadataType="Disco" ID="09da924a-04ae-46ee-80f8-06e6ac979958" SourceId="1" SourceUrl="http://localhost/TestAltNet/PostWriterWebService.asmx?disco" /> + </Metadata> + <Extensions> + <ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" /> + <ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" /> + </Extensions> +</ReferenceGroup> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Service References/PortalSitefinity/configuration.svcinfo Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot"> + <behaviors /> + <bindings> + <binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" messageEncoding="Text" name="PostWriterWebServiceSoap" textEncoding="utf-8" transferMode="Buffered"><readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192" /><security mode="None"><message algorithmSuite="Default" clientCredentialType="UserName" /><transport clientCredentialType="None" proxyCredentialType="None" realm="" /></security></Data>" bindingType="basicHttpBinding" name="PostWriterWebServiceSoap" /> + </bindings> + <endpoints> + <endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost/TestAltNet/PostWriterWebService.asmx" binding="basicHttpBinding" bindingConfiguration="PostWriterWebServiceSoap" contract="PortalSitefinity.PostWriterWebServiceSoap" name="PostWriterWebServiceSoap" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost/TestAltNet/PostWriterWebService.asmx" binding="basicHttpBinding" bindingConfiguration="PostWriterWebServiceSoap" contract="PortalSitefinity.PostWriterWebServiceSoap" name="PostWriterWebServiceSoap" />" contractName="PortalSitefinity.PostWriterWebServiceSoap" name="PostWriterWebServiceSoap" /> + </endpoints> +</configurationSnapshot> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Service References/PortalSitefinity/configuration91.svcinfo Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="utf-8"?> +<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="Ga08cyTtTuCmaKuG7jW0IamUFY4="> + <bindingConfigurations> + <bindingConfiguration bindingType="basicHttpBinding" name="PostWriterWebServiceSoap"> + <properties> + <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>PostWriterWebServiceSoap</serializedValue> + </property> + <property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>00:01:00</serializedValue> + </property> + <property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>00:01:00</serializedValue> + </property> + <property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>00:10:00</serializedValue> + </property> + <property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>00:01:00</serializedValue> + </property> + <property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>False</serializedValue> + </property> + <property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>False</serializedValue> + </property> + <property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>StrongWildcard</serializedValue> + </property> + <property path="/maxBufferSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>65536</serializedValue> + </property> + <property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>524288</serializedValue> + </property> + <property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>65536</serializedValue> + </property> + <property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>Text</serializedValue> + </property> + <property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue> + </property> + <property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>32</serializedValue> + </property> + <property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>8192</serializedValue> + </property> + <property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>16384</serializedValue> + </property> + <property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>4096</serializedValue> + </property> + <property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>16384</serializedValue> + </property> + <property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.BasicHttpSecurityElement</serializedValue> + </property> + <property path="/security/mode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.BasicHttpSecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>None</serializedValue> + </property> + <property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.HttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.HttpTransportSecurityElement</serializedValue> + </property> + <property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>None</serializedValue> + </property> + <property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>None</serializedValue> + </property> + <property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue> + </property> + <property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>Never</serializedValue> + </property> + <property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>TransportSelected</serializedValue> + </property> + <property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>(Collection)</serializedValue> + </property> + <property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpMessageSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.BasicHttpMessageSecurityElement</serializedValue> + </property> + <property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.BasicHttpMessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>UserName</serializedValue> + </property> + <property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>Default</serializedValue> + </property> + <property path="/textEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.Text.UTF8Encoding</serializedValue> + </property> + <property path="/transferMode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>Buffered</serializedValue> + </property> + <property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>True</serializedValue> + </property> + </properties> + </bindingConfiguration> + </bindingConfigurations> + <endpoints> + <endpoint name="PostWriterWebServiceSoap" contract="PortalSitefinity.PostWriterWebServiceSoap" bindingType="basicHttpBinding" address="http://localhost/TestAltNet/PostWriterWebService.asmx" bindingConfiguration="PostWriterWebServiceSoap"> + <properties> + <property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>http://localhost/TestAltNet/PostWriterWebService.asmx</serializedValue> + </property> + <property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>basicHttpBinding</serializedValue> + </property> + <property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>PostWriterWebServiceSoap</serializedValue> + </property> + <property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>PortalSitefinity.PostWriterWebServiceSoap</serializedValue> + </property> + <property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue> + </property> + <property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue><Header /></serializedValue> + </property> + <property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue> + </property> + <property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue> + </property> + <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue> + </property> + <property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue> + </property> + <property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue> + </property> + <property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue> + </property> + <property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue> + </property> + <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>My</serializedValue> + </property> + <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>LocalMachine</serializedValue> + </property> + <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>FindBySubjectDistinguishedName</serializedValue> + </property> + <property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>False</serializedValue> + </property> + <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue>PostWriterWebServiceSoap</serializedValue> + </property> + <property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + <property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <serializedValue /> + </property> + </properties> + </endpoint> + </endpoints> +</SavedWcfConfigurationInformation> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/app.config Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <system.serviceModel> + <bindings> + <basicHttpBinding> + <binding name="PostWriterWebServiceSoap" closeTimeout="00:01:00" + openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" + allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" + maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" + messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" + useDefaultWebProxy="true"> + <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" + maxBytesPerRead="4096" maxNameTableCharCount="16384" /> + <security mode="None"> + <transport clientCredentialType="None" proxyCredentialType="None" + realm="" /> + <message clientCredentialType="UserName" algorithmSuite="Default" /> + </security> + </binding> + </basicHttpBinding> + </bindings> + <client> + <endpoint address="http://localhost/TestAltNet/PostWriterWebService.asmx" + binding="basicHttpBinding" bindingConfiguration="PostWriterWebServiceSoap" + contract="PortalSitefinity.PostWriterWebServiceSoap" name="PostWriterWebServiceSoap" /> + </client> + </system.serviceModel> +</configuration> \ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Sat Jun 04 19:41:40 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Sat Jun 04 22:46:06 2011 -0300 @@ -62,7 +62,9 @@ <HintPath>..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath> </Reference> <Reference Include="System" /> + <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> + <Reference Include="System.ServiceModel" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> @@ -70,6 +72,8 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Blog\PostWriterWebServiceAdapterTests.cs" /> + <Compile Include="Blog\PublicadorTests.cs" /> <Compile Include="Cruds\EventoCrud.cs" /> <Compile Include="Cruds\EventoCrudNhTests.cs" /> <Compile Include="DateTimeFormattingTests.cs" /> @@ -85,6 +89,10 @@ <Compile Include="Workflows\WorkflowTests.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> @@ -107,7 +115,9 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <None Include="App.config" /> + <None Include="App.config"> + <SubType>Designer</SubType> + </None> <None Include="packages.config" /> </ItemGroup> <ItemGroup>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Tests/Blog/PostWriterWebServiceAdapterTests.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,69 @@ +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 Agendas.Blog.Impl; +using AltNetHispano.Agendas.Domain; +using Moq; +using NUnit.Framework; + +namespace AltNetHispano.Agendas.Tests.Blog +{ + [TestFixture] + public class PostWriterWebServiceAdapterTests + { + [SetUp] + public void ClearAppSettings() + { + ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = ""; + ConfigurationManager.AppSettings["PublicadorBlog.BlogName"] = ""; + ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = ""; + } + + [Test] + [ExpectedException(typeof(EndpointNotFoundException))] + public void Si_la_url_es_invalida_debe_lanzar_excepcion() + { + ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx"; + ConfigurationManager.AppSettings["PublicadorBlog.BlogName"] = "dummy"; + ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = "dummy"; + + var srv = new PostWriterWebServiceAdapter(); + srv.WriteBlogPost(null, null, null, false); + } + + [Test] + [ExpectedException(typeof(PostWriterServiceUrlNotFoundException))] + public void Si_la_url_no_esta_configurada_debe_lanzar_excepcion() + { + var srv = new PostWriterWebServiceAdapter(); + srv.WriteBlogPost(null, null, null, false); + } + + [Test] + [ExpectedException(typeof(BlogNameNotFoundException))] + public void Si_el_nombre_del_blog_no_esta_configurado_debe_lanzar_excepcion() + { + ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx"; + ConfigurationManager.AppSettings["PublicadorBlog.BlogWriterMasterKey"] = "dummy"; + + var srv = new PostWriterWebServiceAdapter(); + srv.WriteBlogPost(null, null, null, false); + } + + [Test] + [ExpectedException(typeof(BlogWriterMasterKeyNotFoundException))] + public void Si_la_master_key_no_esta_configurada_debe_lanzar_excepcion() + { + ConfigurationManager.AppSettings["PublicadorBlog.PostWriterServiceUrl"] = "http://dummy/dummy.aspx"; + + var srv = new PostWriterWebServiceAdapter(); + srv.WriteBlogPost(null, null, null, false); + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Tests/Blog/PublicadorTests.cs Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Agendas.Blog; +using Agendas.Blog.Impl; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Repositories.Memory; +using Moq; +using NUnit.Framework; + +namespace AltNetHispano.Agendas.Tests.Blog +{ + [TestFixture] + public class PublicadorTests + { + [SetUp] + public void SetearUsuario() + { + var seguridad = new Mock<ISeguridad>(); + seguridad.Setup(s => s.GetUserName()).Returns("neluz"); + IdentityContext.Init(seguridad.Object, new PersonaRepository()); + } + + [Test] + public void El_publicador_debe_disparar_los_writers_segun_la_accion_de_cada_track() + { + var eventoAgendar = Evento.Agendar(null, null, DateTime.MinValue, null); + var eventoPublicar = Evento.Agendar(null, null, DateTime.MinValue, null); + + var agendarPostWriter = new Mock<IPostWriter>(); + agendarPostWriter.Setup(writer => writer.WritePost(eventoAgendar)); + + var publicarPostWriter = new Mock<IPostWriter>(); + publicarPostWriter.Setup(writer => writer.WritePost(eventoPublicar)); + + var factory = new Mock<IPostWriterFactory>(); + factory.Setup(f => f.GetPostWriter(Accion.Agendar)).Returns(agendarPostWriter.Object); + factory.Setup(f => f.GetPostWriter(Accion.Publicar)).Returns(publicarPostWriter.Object); + + var publicador = new BlogPublicador(factory.Object); + publicador.Publicar(new List<Track> + { + new Track(eventoAgendar, Accion.Agendar), + new Track(eventoPublicar, Accion.Publicar) + }); + + factory.Verify(f => f.GetPostWriter(Accion.Agendar), Times.Once()); + factory.Verify(f => f.GetPostWriter(Accion.Publicar), Times.Once()); + + agendarPostWriter.Verify(pw => pw.WritePost(eventoAgendar), Times.Once()); + publicarPostWriter.Verify(pw => pw.WritePost(eventoPublicar), Times.Once()); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PostWriterWebService blog/PostWriterWebService.asmx Sat Jun 04 22:46:06 2011 -0300 @@ -0,0 +1,93 @@ +<%@ WebService Language="C#" Class="PostWriterWebService" %> + +using System; +using System.Configuration; +using System.Globalization; +using System.Linq; +using System.Security.Cryptography; +using System.Web; +using System.Web.Services; +using System.Web.Services.Protocols; +using Telerik.Blogs; + +[WebService(Namespace = "http://tempuri.org/")] +[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] +// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. +// [System.Web.Script.Services.ScriptService] +public class PostWriterWebService : System.Web.Services.WebService { + + [WebMethod] + public void WriteBlogPost(string securityToken, string blogName, string postTitle, string postHtmlContent, string postAuthor, bool setPublicationDate) + { + checkSecurityToken(securityToken); + writePost(blogName, postTitle, postHtmlContent, postAuthor, setPublicationDate); + } + + private void checkSecurityToken(string securityToken) + { + if (string.IsNullOrEmpty(securityToken)) throw new ArgumentNullException("securityToken"); + + var now = DateTime.UtcNow; + now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, 0); + + var masterKey = System.Configuration.ConfigurationManager.AppSettings["BlogWriterMasterKey"]; + if (string.IsNullOrEmpty(masterKey)) + throw new Exception("Master key not found"); + + var token1 = buildToken(masterKey, now.AddMinutes(-1)); + var token2 = buildToken(masterKey, now); + var token3 = buildToken(masterKey, now.AddMinutes(1)); + + if (!securityToken.Equals(token1) && !securityToken.Equals(token2) && !securityToken.Equals(token3)) + throw new Exception("Invalid security token"); + } + + private string buildToken(string key, DateTime time) + { + var aux = key + time.ToString(CultureInfo.InvariantCulture); + + var enc = System.Text.Encoding.ASCII.GetEncoder(); + + var data = new byte[aux.Length]; + enc.GetBytes(aux.ToCharArray(), 0, aux.Length, data, 0, true); + + var md5 = new MD5CryptoServiceProvider(); + var result = md5.ComputeHash(data); + + return BitConverter.ToString(result).Replace("-", "").ToLower(); + } + + private void writePost(string blogName, string postTitle, string postHtmlContent, string postAuthor, bool setPublicationDate) + { + if (string.IsNullOrEmpty(blogName)) throw new ArgumentNullException("blogName"); + if (string.IsNullOrEmpty(postTitle)) throw new ArgumentNullException("postTitle"); + if (string.IsNullOrEmpty(postHtmlContent)) throw new ArgumentNullException("postHtmlContent"); + if (string.IsNullOrEmpty(postAuthor)) throw new ArgumentNullException("postAuthor"); + + try + { + var manager = new BlogManager(); + + var blogs = manager.GetBlogs(); + var blog = (blogs.Cast<IBlog>()).SingleOrDefault(b => b.Name.Equals(blogName)); + + if (blog == null) + throw new Exception(string.Format("Blog '{0}' no encontrado", blogName)); + + var postContent = manager.Content.CreateContent("text/html"); + + postContent.ParentID = blog.ID; + postContent.Content = postHtmlContent; + postContent.SetMetaData("Author", postAuthor); + postContent.SetMetaData("Title", postTitle); + if (setPublicationDate) + postContent.SetMetaData("Publication_Date", DateTime.Now); + + manager.Content.SaveContent(postContent); + } + catch (Exception e) + { + throw new Exception("Ocurrio un error creando el post", e); + } + } +} \ No newline at end of file