Skip to content

Commit

Permalink
Fix autowiring test data.
Browse files Browse the repository at this point in the history
  • Loading branch information
markpollack committed Aug 14, 2008
1 parent cd7ee2a commit 6e5a741
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1089,12 +1089,11 @@ XmlObjectFactory xof
}

[Test]
[Ignore("FIX AUTOWIRING!")]
public void Autowire()
{
XmlObjectFactory xof = new XmlObjectFactory(new ReadOnlyXmlTestResource("autowire.xml", GetType()));
TestObject spouse = new TestObject("kerry", 0);
xof.RegisterSingleton("spouse", spouse);
xof.RegisterSingleton("Spouse", spouse);
DoTestAutowire(xof);
}

Expand All @@ -1121,21 +1120,23 @@ public void AutowireWithCtorArrayArgs()
#endif
}

[Test]
[Ignore("SPRNET-1005")]
public void AutowireWithParent()
{
XmlObjectFactory xof = new XmlObjectFactory(new ReadOnlyXmlTestResource("autowire.xml", GetType()));
DefaultListableObjectFactory lbf = new DefaultListableObjectFactory();
MutablePropertyValues pvs = new MutablePropertyValues();
pvs.Add("name", "kerry");
lbf.RegisterObjectDefinition("spouse", new RootObjectDefinition(typeof(TestObject), pvs));
pvs.Add("Name", "kerry");
lbf.RegisterObjectDefinition("Spouse", new RootObjectDefinition(typeof(TestObject), pvs));
xof.ParentObjectFactory = lbf;
DoTestAutowire(xof);
}

private void DoTestAutowire(XmlObjectFactory xof)
{
DependenciesObject rod1 = (DependenciesObject) xof.GetObject("rod1");
TestObject kerry = (TestObject) xof.GetObject("spouse");
TestObject kerry = (TestObject) xof.GetObject("Spouse");
// Should have been autowired
Assert.AreEqual(kerry, rod1.Spouse);

Expand Down Expand Up @@ -1172,7 +1173,7 @@ private void DoTestAutowire(XmlObjectFactory xof)

DependenciesObject rod5 = (DependenciesObject) xof.GetObject("rod5");
// Should not have been autowired
Assert.IsNotNull(rod5.Spouse);
Assert.IsNull(rod5.Spouse);

/* TODO include basc in
IObjectFactory appCtx = (IObjectFactory) xof.GetObject("childAppCtx");
Expand Down

0 comments on commit 6e5a741

Please sign in to comment.