Customizing mock URLs

The default behavior of the Mockifier is to generate addresses for the mocked receive locations and send ports that are derived from their names. It simply follows the convention:

        mock://localhost/<Receive Location Name | Send Port Name>

If you would like to have better structured and nicer looking mock URLs which make better sense there is an easy and convenient way of achieving this. The only thing you have to do is to specify value for the EndpointName attribute , and optionally for the Operation attribute of the Mock tag.

The general structure of a mock URL is following this convention:

        mock://localhost/<Endpoint name>/<Operation> , where Operation is optional

So in order to modify the URL used by the mock adapter in a given receive location or send port and the corresponding property in the *MockAddresses helper class you should simply define value for at least the EndpointName attribute. Please note that it can only contain characters that are valid for a physical path.

An example of this would look like this. Let's use as a base the receive location in the Getting started guide - ReceivePO_ERP_MSMQ. We would like the URL to be defined as mock://localhost/PurchaseOrderIn. This is achieved by mocking this receive location in the bindings file in the following way:

        <ReceiveLocation Name="ReceivePO_ERP_MSMQ" />
            <!-- <Mock EndpointName="PurchaseOrderIn" /> -->

This technique can be used as well in cases where the value of the system property BTS.InboundTransportLocation needs to have specific contents.

Last edited Dec 7, 2014 at 9:26 PM by cyberbyber, version 4