value.setServiceBindingValueSourceConfig(new XSLTServiceBindingValueSourceConfig("test"));
Set<ServiceBindingMetadata> overrides = new HashSet<ServiceBindingMetadata>();
overrides.add(value);
Set<ServiceBindingSet> sbs = new HashSet<ServiceBindingSet>();
ServiceBindingSet setB = new ServiceBindingSet(B, "localhost", 0, overrides);
sbs.add(setB);
ServiceBindingManagementObject testee = new ServiceBindingManagementObject("test", sbs, set);
testee.start();
sbs = testee.getBindingSets();
assertEquals(1, sbs.size());
boolean found = false;
for (ServiceBindingSet sb : sbs)
{
for (ServiceBindingMetadata md : sb.getOverrideBindings())
{
if ("value-source".equals(md.getFullyQualifiedName()))
{
found = true;
assertEquals(XSLTServiceBindingValueSourceImpl.class.getName(), md.getServiceBindingValueSourceClassName());
Object config = md.getServiceBindingValueSourceConfig();
assertTrue(config instanceof XSLTServiceBindingValueSourceConfig);
assertEquals("test", ((XSLTServiceBindingValueSourceConfig) config).getXslt());
break;
}
}
assertTrue(found);
}
Map<String, Set<ServiceBinding>> bindingsMap = testee.getServiceBindings();
assertNotNull(bindingsMap);
Set<ServiceBinding> bindings = bindingsMap.get(B);
assertNotNull(bindings);
found = false;
for (ServiceBinding md : bindings)
{
if ("value-source".equals(md.getFullyQualifiedName()))
{
found = true;
assertEquals(XSLTServiceBindingValueSourceImpl.class.getName(), md.getServiceBindingValueSourceClassName());
Object config = md.getServiceBindingValueSourceConfig();
assertTrue(config instanceof XSLTServiceBindingValueSourceConfig);
assertEquals("test", ((XSLTServiceBindingValueSourceConfig) config).getXslt());
break;
}
}
assertTrue(found);
overrides = new HashSet<ServiceBindingMetadata>();
overrides.add(new ServiceBindingMetadata("value-source", null, null, 25));
// KEY POINT IN THE WHOLE TEST: we don't configure the value source stuff
setB = new ServiceBindingSet(B, "localhost", 0, overrides);
sbs = new HashSet<ServiceBindingSet>();
sbs.add(setB);
testee.setBindingSets(sbs);
sbs = testee.getBindingSets();