TestUtils.checkProblems(customBuilder);
checkScenario6and7Results("http://scenario6", true);
}
private void checkScenario6and7Results(String namespace, boolean nonWiring) {
Composite domainComposite = customBuilder.getDomainComposite();
// Should remove target= on ComponentB/reference2 (for Scenario 6) or
// CompositeC/reference2 (for Scenario 7), and add uri="http://foo.com/bar"
// to the <binding.ws> element on ComponentB/reference2
// For nonWiring, ComponentB/reference2 should have target=
// and no uri= should be added
Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
WebServiceBinding wsBinding = null;
for (ComponentReference reference : componentB.getReferences()) {
if ("reference2".equals(reference.getName())) {
if (!nonWiring) {
assert reference.getTargets().size() == 0;
} else {
assert reference.getTargets().size() == 1;
}
wsBinding = reference.getBinding(WebServiceBinding.class);
}
}
if (!nonWiring) {
assert "http://foo.com/bar".equals(wsBinding.getURI());
} else {
assert wsBinding.getURI() == null;
}
Definition def;
javax.wsdl.Service svc;
Port port;
if (!nonWiring) {
// Should create WSDL document for ComponentB/reference2 with endpoint uri="http://foo.com/bar"
def = wsBinding.getWSDLDocument();
svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
port = svc.getPort("Service3aPort");
assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
}
Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
if (!nonWiring) {
// Should add <binding.ws> to inner component reference ComponentD/reference3 with uri="http://foo.com/bar"
// Should set <interface.wsdl> on inner component reference ComponentD/reference3
wsBinding = null;
for (ComponentReference reference : componentD.getReferences()) {
if ("reference3".equals(reference.getName())) {
wsBinding = reference.getBinding(WebServiceBinding.class);
assert reference.getBindings().size() == 1;
assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract;
}
}
assert "http://foo.com/bar".equals(wsBinding.getURI());
// Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
def = wsBinding.getWSDLDocument();
svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
port = svc.getPort("Service3aPort");
assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
} else {
// Should not add <binding.ws> to any inner component references
for (ComponentReference reference : componentD.getReferences()) {
assert reference.getBinding(WebServiceBinding.class) == null;
}
}
// No references on CompositeC should have <binding.ws> or <interface.wsdl>, except for
// reference2 in Scenario 7
Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC"));
for (Reference reference : compositeC.getReferences()) {
if ("http://scenario7".equals(namespace) && "reference2".equals(reference.getName())) {
assert reference.getBinding(WebServiceBinding.class)!= null;
assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
} else {
assert reference.getBinding(WebServiceBinding.class) == null;