/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.wsdl.Binding;
import javax.wsdl.Definition;
import javax.wsdl.Port;
import javax.wsdl.Service;
import javax.wsdl.extensions.http.HTTPAddress;
import javax.wsdl.extensions.http.HTTPBinding;
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.wsdl.extensions.soap.SOAPBinding;
import javax.wsdl.extensions.soap12.SOAP12Address;
import javax.wsdl.extensions.soap12.SOAP12Binding;
import junit.framework.Assert;
import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
/**
* Tests the simplest form of the binding element without WSDL document
* described in section 2.3.2 of SCA Web Services Binding V1.00
*/
public class GeneratedWSDLTestCase {
protected static String compositeName = "nowsdlmultisoapbindings.composite";
protected static Definition cWSDL = null;
@BeforeClass
public static void init() throws Exception {
try {
System.out.println("Setting up");
ServiceFinder.init(compositeName);
cWSDL = ServiceFinder.getWSDLDefinition("CComponent", "CService");
} catch (Exception ex) {
ex.printStackTrace();
}
}
private Map getPorts(Definition wsdl, String service) {
String targetNamespace = wsdl.getTargetNamespace();
HashMap sMap = (HashMap) wsdl.getServices();
for (Iterator i = sMap.keySet().iterator(); i.hasNext();) {
Object k1 = i.next();
Service s = (Service) sMap.get(k1);
String qName = "{" + targetNamespace + "}" + service;
if (s.getQName().toString().equals(qName)) {
return s.getPorts();
}
// Don't why implmentation changed to add Service at the end of qname
if (s.getQName().toString().equals(qName + "Service")) {
return s.getPorts();
}
}
return null;
}
/**
* Lines 262-264:
* The WSDL service has one or more ports for each web service binding on
* the SCA service that has a SOAP requirement, or that refers to an
* existing WSDL binding, depending on the requirements of the web service
* binding. Each of those ports has a single binding.
* Each service has following bindings:
*