Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Testing a policy in BizTalk rules engine
- This topic has 3 replies, 1 voice, and was last updated 8 years, 3 months ago by
community-content.
-
AuthorPosts
-
-
September 14, 2006 at 8:41 AM #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..?
-
September 16, 2006 at 11:31 PM #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.
-
September 19, 2006 at 2:06 AM #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();
-
September 19, 2006 at 5:54 AM #15730Create 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;
}
}
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.