Skip to content

Commit

Permalink
Problema de acceso a wsdl externos con Travis arreglado
Browse files Browse the repository at this point in the history
  • Loading branch information
aeraln committed Jan 26, 2015
1 parent 70f16de commit fbc6537
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.junit.AfterClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand All @@ -26,6 +28,17 @@
public class SOAPinputsTest
{

@BeforeClass
public static void setUp() throws Exception {
ServerStarter.startWebServer(9001);
}

@AfterClass
public static void tearDown() throws Exception {
ServerStarter.stopAll();
}


@Test
public void testDoGet()
{
Expand All @@ -52,7 +65,7 @@ public void testDoPost() throws Exception
ServletConfig config = mock(ServletConfig.class);
ServletContext context = mock(ServletContext.class);
RequestDispatcher dispatcher = mock(RequestDispatcher.class);
SoapService service = new SoapService("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
SoapService service = new SoapService("http://localhost:9001/Tesseract302.xml");


when(config.getServletContext()).thenReturn(context);
Expand Down Expand Up @@ -87,7 +100,7 @@ public void testDoPostDisplay() throws Exception
ServletConfig config = mock(ServletConfig.class);
ServletContext context = mock(ServletContext.class);
RequestDispatcher dispatcher = mock(RequestDispatcher.class);
SoapService service = new SoapService("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
SoapService service = new SoapService("http://localhost:9001/Tesseract302.xml");


when(config.getServletContext()).thenReturn(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.junit.AfterClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand All @@ -27,7 +29,17 @@
* @author Impact
*/
public class SOAPresultsTest
{
{

@BeforeClass
public static void setUp() throws Exception {
ServerStarter.startWebServer(9001);
}

@AfterClass
public static void tearDown() throws Exception {
ServerStarter.stopAll();
}

/**
* Test of doGet method, of class SOAPresults.
Expand Down Expand Up @@ -64,7 +76,7 @@ public void testDoPost() throws Exception
File testFile = new File(url.getFile());
when(context.getRealPath("/")).thenReturn(testFile.getParent());

SoapService service = new SoapService("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
SoapService service = new SoapService("http://localhost:9001/Tesseract302.xml");
when(sesion.getAttribute("serviceObject")).thenReturn(service);
when(request.getParameter("operationName")).thenReturn("tesseract");
when(request.getParameterValues("input")).thenReturn(new String[]{"input"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.junit.AfterClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import org.mockito.Mockito;

/**
Expand All @@ -29,7 +31,17 @@
*/
public class WSDLinfoTest extends Mockito
{


@BeforeClass
public static void setUp() throws Exception {
ServerStarter.startWebServer(9001);
}

@AfterClass
public static void tearDown() throws Exception {
ServerStarter.stopAll();
}

/**
* Test of init method, of class WSDLinfo.
*/
Expand Down Expand Up @@ -68,7 +80,7 @@ public void testDoGet()
when(config.getServletContext()).thenReturn(context);
when(context.getRequestDispatcher("/interface.jsp")).thenReturn(dispatcher);
when(request.getParameter("wsId")).thenReturn(null);
when(request.getParameter("wsdlURL")).thenReturn("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
when(request.getParameter("wsdlURL")).thenReturn("http://localhost:9001/Tesseract302.xml");
when(request.getParameter("wsName")).thenReturn("nombre");
when(request.getParameter("user")).thenReturn(Security.encrypt("usuario",key));
when(request.getParameter("pass")).thenReturn(Security.encrypt("password",key));
Expand Down Expand Up @@ -109,7 +121,7 @@ public void testDoPost() throws Exception
when(config.getServletContext()).thenReturn(context);
when(context.getRequestDispatcher("/interface.jsp")).thenReturn(dispatcher);
when(request.getParameter("wsId")).thenReturn(null);
when(request.getParameter("wsdlURL")).thenReturn("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
when(request.getParameter("wsdlURL")).thenReturn("http://localhost:9001/Tesseract302.xml");
when(request.getParameter("wsName")).thenReturn("nombre");
when(request.getParameter("user")).thenReturn(Security.encrypt("usuario",key));
when(request.getParameter("pass")).thenReturn(Security.encrypt("password",key));
Expand Down Expand Up @@ -146,8 +158,8 @@ public void testDoGetId()

when(config.getServletContext()).thenReturn(context);
when(context.getRequestDispatcher("/interface.jsp")).thenReturn(dispatcher);
when(request.getParameter("wsId")).thenReturn("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
when(request.getParameter("wsdlURL")).thenReturn("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
when(request.getParameter("wsId")).thenReturn("http://localhost:9001/Tesseract302.xml");
when(request.getParameter("wsdlURL")).thenReturn("http://localhost:9001/Tesseract302.xml");
when(request.getParameter("wsName")).thenReturn("nombre");
when(request.getParameter("user")).thenReturn(Security.encrypt("usuario",key));
when(request.getParameter("pass")).thenReturn(Security.encrypt("password",key));
Expand Down Expand Up @@ -187,8 +199,8 @@ public void testDoPostId() throws Exception

when(config.getServletContext()).thenReturn(context);
when(context.getRequestDispatcher("/interface.jsp")).thenReturn(dispatcher);
when(request.getParameter("wsId")).thenReturn("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
when(request.getParameter("wsdlURL")).thenReturn("http://impact.dlsi.ua.es/services/Tesseract302?wsdl");
when(request.getParameter("wsId")).thenReturn("http://localhost:9001/Tesseract302.xml");
when(request.getParameter("wsdlURL")).thenReturn("http://localhost:9001/Tesseract302.xml");
when(request.getParameter("wsName")).thenReturn("nombre");
when(request.getParameter("user")).thenReturn(Security.encrypt("usuario",key));
when(request.getParameter("pass")).thenReturn(Security.encrypt("password",key));
Expand Down
196 changes: 196 additions & 0 deletions interfaces/web/wsdl-client/src/test/resources/Tesseract302.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://impact-project.eu/iif/service" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:axd="http://org.apache.axis2/xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impact-project.eu/iif/service">
<wsdl:types>
<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impact-project.eu/iif/service">
<xsd:simpleType name="langmodType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="afr" />
<xsd:enumeration value="ara" />
<xsd:enumeration value="aze" />
<xsd:enumeration value="bel" />
<xsd:enumeration value="ben" />
<xsd:enumeration value="bul" />
<xsd:enumeration value="cat" />
<xsd:enumeration value="ces" />
<xsd:enumeration value="chi_sim" />
<xsd:enumeration value="chi_tra" />
<xsd:enumeration value="chr" />
<xsd:enumeration value="dan" />
<xsd:enumeration value="dan-frak" />
<xsd:enumeration value="deu" />
<xsd:enumeration value="deu-frak" />
<xsd:enumeration value="ell" />
<xsd:enumeration value="eng" />
<xsd:enumeration value="enm" />
<xsd:enumeration value="epo" />
<xsd:enumeration value="equ" />
<xsd:enumeration value="est" />
<xsd:enumeration value="eus" />
<xsd:enumeration value="fin" />
<xsd:enumeration value="fra" />
<xsd:enumeration value="frk" />
<xsd:enumeration value="frm" />
<xsd:enumeration value="glg" />
<xsd:enumeration value="grc" />
<xsd:enumeration value="heb" />
<xsd:enumeration value="hin" />
<xsd:enumeration value="hrv" />
<xsd:enumeration value="hun" />
<xsd:enumeration value="ind" />
<xsd:enumeration value="isl" />
<xsd:enumeration value="ita" />
<xsd:enumeration value="ita-old" />
<xsd:enumeration value="jpn" />
<xsd:enumeration value="kan" />
<xsd:enumeration value="kor" />
<xsd:enumeration value="lat-lid" />
<xsd:enumeration value="lav" />
<xsd:enumeration value="lit" />
<xsd:enumeration value="mal" />
<xsd:enumeration value="mkd" />
<xsd:enumeration value="mlt" />
<xsd:enumeration value="msa" />
<xsd:enumeration value="nld" />
<xsd:enumeration value="nor" />
<xsd:enumeration value="osd" />
<xsd:enumeration value="pol" />
<xsd:enumeration value="por" />
<xsd:enumeration value="ron" />
<xsd:enumeration value="rus" />
<xsd:enumeration value="slk" />
<xsd:enumeration value="slk-frak" />
<xsd:enumeration value="slv" />
<xsd:enumeration value="spa" />
<xsd:enumeration value="spa-old" />
<xsd:enumeration value="srp" />
<xsd:enumeration value="swe" />
<xsd:enumeration value="swe-frak" />
<xsd:enumeration value="tha" />
<xsd:enumeration value="tgl" />
<xsd:enumeration value="tur" />
<xsd:enumeration value="ukr" />
<xsd:enumeration value="vie" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="tesseractRequestType">
<xsd:sequence>
<xsd:element default="http://www.digitisation.eu/wp-content/themes/unite/downloads/439978.tif" name="input" type="xsd:anyURI">
<xsd:annotation>
<xsd:documentation>URL reference to input file</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element default="spa" name="langmod" type="tns:langmodType">
<xsd:annotation>
<xsd:documentation>Language module used by Tesseract</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="tesseractRequest" type="tns:tesseractRequestType" />
<xsd:complexType name="tesseractResponseType">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" type="tns:tesseractReturnType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tesseractReturnType">
<xsd:sequence>
<xsd:element minOccurs="0" name="result" type="tns:tesseractResultType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tesseractResultType">
<xsd:sequence>
<xsd:element minOccurs="0" name="output" type="xsd:anyURI">
<xsd:annotation>
<xsd:documentation>URL reference to output file</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="success" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>Success/failure of process execution</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="returncode" type="xsd:int">
<xsd:annotation>
<xsd:documentation>Returncode of the underlying command line application</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="time" type="xsd:int">
<xsd:annotation>
<xsd:documentation>Execution time in milliseconds</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="log" type="xsd:string">
<xsd:annotation>
<xsd:documentation>Process execution log</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="message" type="xsd:string">
<xsd:annotation>
<xsd:documentation>Process execution message</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="tesseractResponse" type="tns:tesseractResponseType" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="tesseractRequest">
<wsdl:part name="tesseractRequest" element="tns:tesseractRequest" />
</wsdl:message>
<wsdl:message name="tesseractResponse">
<wsdl:part name="tesseractResponse" element="tns:tesseractResponse" />
</wsdl:message>
<wsdl:portType name="Tesseract302PortType">
<wsdl:operation name="tesseract">
<wsdl:documentation>Perform OCR on TIFF image file</wsdl:documentation>
<wsdl:input message="tns:tesseractRequest" wsaw:Action="urn:tesseract" />
<wsdl:output message="tns:tesseractResponse" wsaw:Action="//schemas.xmlsoap.org/wsdl/IMPACTTesseract302ServicePortType/tesseractResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Tesseract302Soap11Binding" type="tns:Tesseract302PortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="tesseract">
<soap:operation soapAction="urn:tesseract" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="Tesseract302Soap12Binding" type="tns:Tesseract302PortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="tesseract">
<soap12:operation soapAction="urn:tesseract" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="Tesseract302HttpBinding" type="tns:Tesseract302PortType">
<http:binding verb="POST" />
<wsdl:operation name="tesseract">
<http:operation location="tesseract" />
<wsdl:input>
<mime:content type="text/xml" part="parameters" />
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Tesseract302">
<wsdl:port name="Tesseract302HttpSoap11Endpoint" binding="tns:Tesseract302Soap11Binding">
<soap:address location="http://impact.dlsi.ua.es/services/Tesseract302.Tesseract302HttpSoap11Endpoint" />
</wsdl:port>
<wsdl:port name="Tesseract302HttpSoap12Endpoint" binding="tns:Tesseract302Soap12Binding">
<soap12:address location="http://impact.dlsi.ua.es/services/Tesseract302.Tesseract302HttpSoap12Endpoint" />
</wsdl:port>
<wsdl:port name="Tesseract302HttpEndpoint" binding="tns:Tesseract302HttpBinding">
<http:address location="http://impact.dlsi.ua.es/services/Tesseract302.Tesseract302HttpEndpoint" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

0 comments on commit fbc6537

Please sign in to comment.