public void Publish_Getter() { using (var connection = this.Container.Resolve <ConnectionManager>()) using (var queueMananger = connection.CreateQueueManager()) using (var exchangeMananger = connection.CreateExchangeManager()) using (var publisher = new BinaryPublisher("test", connection.CreatePublishManager(), this.Logger)) { exchangeMananger.Create(Templates.TemporaryExchange("test", ExchangeType.Topic)); var info = queueMananger.Create(Templates.UnitTestQueue()); queueMananger.Bind(new QueueBindingConfiguration { Action = BindingAction.Bind, DestinationQueue = info.Name, SourceExchange = "test", Topic = Constants.AllTopics }); Thread.Sleep(500); var t1 = publisher.Publish(Encoding.UTF8.GetBytes("asdf1")); var t2 = publisher.Publish(Encoding.UTF8.GetBytes("asdf2"), "topic"); t1.Wait(); t2.Wait(); using (var getter = new BinaryRetriever(info.Name, false, connection.CreateMessageRetrievalManager(), this.Logger)) { var r1 = getter.Retrieve(); Assert.IsNotNull(r1); Assert.AreEqual("asdf1", Encoding.UTF8.GetString(r1.Content)); getter.Ack(r1.DeliveryTag, false); var r2 = getter.Retrieve(); Assert.IsNotNull(r2); Assert.AreEqual("asdf2", Encoding.UTF8.GetString(r2.Content)); getter.Ack(r2.DeliveryTag, false); } } }
public void TestMD5Hash() { var source = "tcm:1109-29182-4_customer-detail-carousel-automfg-534x308_2357561535297132.jpg"; var hash = BinaryPublisher.MD5Hash(source); Assert.AreEqual("0A9C432007DB54E3ED3F940E7D4573B7", hash); }
protected override void TransformComponent(Dynamic.Component component) { binaryPublisher = new BinaryPublisher(Package, Engine); // call helper function to publish all relevant multimedia components // that could be: // - the current component // - any component linked to the current component // - any component linked to that (the number of levels is configurable in a parameter) PublishAllBinaries(component); }
/// <summary> /// Create a BuildManager (can only be instantiated from an SDL Web template) /// </summary> /// <param name="package">SDL Web publishing package</param> /// <param name="engine">SDL Web publishing engine</param> public BuildManager(Package package, Engine engine) { BuildProperties = new BuildProperties(package); BinaryPublisher = new BinaryPublisher(package, engine); }
public virtual string PublishBinariesInRichTextField(string v) { return(BinaryPublisher.PublishBinariesInRichTextField(v, BuildProperties)); }
public virtual void PublishMultimediaComponent(Component component) { BinaryPublisher.PublishMultimediaComponent(component, BuildProperties); }
public virtual string PublishMultimediaComponent(Component component) { return(BinaryPublisher.PublishMultimediaComponent(component.Id, BuildProperties)); }