Testing a policy in BizTalk rules engine

Home Page Forums BizTalk 2004 – BizTalk 2010 Testing a policy in BizTalk rules engine

Viewing 3 reply threads
  • Author
    Posts
    • #15685

      I have a policy which has two facts, an XML schema and a .Net componet which implements the business actions.

      When I try to test the policy in the BRE composer, I can add an instance of my XML Schema, but when I try to add an instance of the .net class( which is deployed in GAC) , it sats..Specifying an instance of a .Net class is not supported..Use a fact creator or fact retriever..

      Can anyone please tell me how do I create a fact retriever to use my .net component..?

    • #15708

      If I remember correctly, you have to create an instance of your fact and pass it in.  This is done using a fact creator and needs to implement the correct interface.  I think there is a sample in the SDK on this… or maybe I found it in the help guide.

       

      Hope this helps.

    • #15726

      DebugTrackingInterceptor dti = new DebugTrackingInterceptor(@"C:\NISHIL\outputtrace.txt");

      //create an instance of the XML object

      dti = new DebugTrackingInterceptor(@"C:\NISHIL\outputtrace.txt");

      //create an instance of the XML object

      //create an instance of the XML object

      XmlDocument xd1 = new XmlDocument();

      xd1.Load(@"C:\NISHIL\Input.xml");

      TypedXmlDocument doc1 = new TypedXmlDocument("NishBizTest.Input", xd1);

      // create the array of short-term facts

      XmlDocument xd1 = new XmlDocument();

      xd1.Load(@"C:\NISHIL\Input.xml");

      TypedXmlDocument doc1 = new TypedXmlDocument("NishBizTest.Input", xd1);

      // create the array of short-term facts

      @"C:\NISHIL\Input.xml");

      TypedXmlDocument doc1 = new TypedXmlDocument("NishBizTest.Input", xd1);

      // create the array of short-term facts

      TypedXmlDocument doc1 = new TypedXmlDocument("NishBizTest.Input", xd1);

      // create the array of short-term facts

      // create the array of short-term facts

      object[] shortTermFacts = new object[1];

      shortTermFacts[0] = doc1;

      Policy policy = null;

      object[] shortTermFacts = new object[1];

      shortTermFacts[0] = doc1;

      Policy policy = null;

      Policy policy = null;

      policy = new Policy("NishBizTest");

      policy.Execute(shortTermFacts, dti);

      FileInfo finfo = new FileInfo(@"C:\NISHIL\Output.xml");

      StreamWriter writer = finfo.CreateText();

      writer.Write(doc1.Document.OuterXml);

      writer.Close();

      FileInfo finfo = new FileInfo(@"C:\NISHIL\Output.xml");

      StreamWriter writer = finfo.CreateText();

      writer.Write(doc1.Document.OuterXml);

      writer.Close();

      StreamWriter writer = finfo.CreateText();

      writer.Write(doc1.Document.OuterXml);

      writer.Close();

    • #15730
      Create a fact creator, then drop it in the GAC.  Then you can test via the Composer …
      public class MyFactCreator : IFactCreator
         {
            private object[] myFacts;
            public MyFactCreator()
            {
            }
            public object[] CreateFacts ( RuleSetInfo rulesetInfo )
            {
               myFacts = new object[1];
               myFacts.SetValue(new MySampleBusinessObject(),0);
               return myFacts;
            }
            public Type[] GetFactTypes (RuleSetInfo rulesetInfo)
            {
               return null;
            }
         }
Viewing 3 reply threads
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.