📄 serviceconnectionfixture.java
字号:
" </soapenv:Envelope>";
public static final String WORKING_NOMULTIREF = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + "\n" +
" <soapenv:Body>" + "\n" +
" <" + RESPONSE_CLASS_NAME + " soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" + "\n" +
" <ComplexFunctionReturn xsi:type=\"ns1:" + RESPONSE_CLASS_NAME + "\" xmlns:ns1=\"" + NAMESPACE +"\">" + "\n" +
" <longResponse xsi:type=\"xsd:long\">"+theLongResponse+"</longResponse>" + "\n" +
" <stringResponse xsi:type=\"xsd:string\">"+theStringResponse+"</stringResponse>" + "\n" +
" <"+ComplexResponse.INTEGER_REPONSE_NAME+" xsi:type=\"xsd:int\">" + theIntegerResponse + "</"+ComplexResponse.INTEGER_REPONSE_NAME+"> \n" +
" <"+ComplexResponse.BOOLEAN_RESPONSE_NAME+" xsi:type=\"xsd:boolean\">" + theBooleanResponse + "</"+ComplexResponse.BOOLEAN_RESPONSE_NAME+"> \n" +
" </ComplexFunctionReturn>" + "\n" +
" </" + RESPONSE_CLASS_NAME + ">" + "\n" +
" </soapenv:Body>" + "\n" +
"</soapenv:Envelope>";
public static final String WORKING_NOMULTIREF_REVERSED_RESPONSE_PARAMETERS = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + "\n" +
" <soapenv:Body>" + "\n" +
" <" + RESPONSE_CLASS_NAME + " soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" + "\n" +
" <ComplexFunctionReturn xsi:type=\"ns1:" + RESPONSE_CLASS_NAME + "\" xmlns:ns1=\"" + NAMESPACE +"\">" + "\n" +
" <stringResponse xsi:type=\"xsd:string\">"+theStringResponse+"</stringResponse>" + "\n" +
" <longResponse xsi:type=\"xsd:long\">"+theLongResponse+"</longResponse>" + "\n" +
" <"+ComplexResponse.INTEGER_REPONSE_NAME+" xsi:type=\"xsd:int\">" + theIntegerResponse + "</"+ComplexResponse.INTEGER_REPONSE_NAME+"> \n" +
" <"+ComplexResponse.BOOLEAN_RESPONSE_NAME+" xsi:type=\"xsd:boolean\">" + theBooleanResponse + "</"+ComplexResponse.BOOLEAN_RESPONSE_NAME+"> \n" +
" </ComplexFunctionReturn>" + "\n" +
" </" + RESPONSE_CLASS_NAME + ">" + "\n" +
" </soapenv:Body>" + "\n" +
"</soapenv:Envelope>";
public static final String HASH_TABLE_PARAMETERS ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + "\n" +
" <soapenv:Body>" + "\n" +
" <hashthingy n3:type=\"n2:Map\" xmlns:n2=\"http://xml.apache.org/xml-soap\" xmlns:n3=\"http://www.w3.org/2001/XMLSchema-instance\">\n"+
" <item>\n"+
" <key n3:type=\"n4:string\" xmlns:n4=\"http://www.w3.org/2001/XMLSchema\">key1</key>\n"+
" <value n3:type=\"n5:string\" xmlns:n5=\"http://www.w3.org/2001/XMLSchema\">value1</value>\n"+
" </item>\n"+
" </hashthingy>\n"+
" </soapenv:Body>" + "\n" +
"</soapenv:Envelope>";
public static final String HASH_TABLE_PARAMETERS_DUP ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + "\n" +
" <soapenv:Body>" + "\n" +
" <hashthingy n3:type=\"n2:Map\" xmlns:n2=\"http://xml.apache.org/xml-soap\" xmlns:n3=\"http://www.w3.org/2001/XMLSchema-instance\">\n"+
" <item>\n"+
" <key n3:type=\"n4:string\" xmlns:n4=\"http://www.w3.org/2001/XMLSchema\">key1</key>\n"+
" <value n3:type=\"n5:string\" xmlns:n5=\"http://www.w3.org/2001/XMLSchema\">value1</value>\n"+
" </item>\n"+
" <item>\n"+
" <key n3:type=\"n4:string\" xmlns:n4=\"http://www.w3.org/2001/XMLSchema\">key1</key>\n"+
" <value n3:type=\"n5:string\" xmlns:n5=\"http://www.w3.org/2001/XMLSchema\">value1</value>\n"+
" </item>\n"+
" <item>\n"+
" <key n3:null=\"true\" xmlns:n4=\"http://www.w3.org/2001/XMLSchema\"/>\n"+
" <value n3:type=\"n5:string\" xmlns:n5=\"http://www.w3.org/2001/XMLSchema\">blah</value>\n"+
" </item>\n"+
" <item>\n"+
" <key n3:type=\"n4:string\" xmlns:n4=\"http://www.w3.org/2001/XMLSchema\">another</key>\n"+
" <value n3:null=\"true\" xmlns:n5=\"http://www.w3.org/2001/XMLSchema\"/>\n"+
" </item>\n"+
" </hashthingy>\n"+
" </soapenv:Body>" + "\n" +
"</soapenv:Envelope>";
private ByteArrayInputStream inputStream;
public ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
public boolean connected;
public static InputStream hashTableWithDupAsStream() {
return messsageAsStream(HASH_TABLE_PARAMETERS_DUP);
}
public static InputStream hashTableAsStream() {
return messsageAsStream(HASH_TABLE_PARAMETERS);
}
public static InputStream faultStringAsStream() {
return messsageAsStream(FAULT_STRING);
}
public static InputStream createWorkingAsStream() {
return messsageAsStream(WORKING_STRING);
}
public static InputStream createWorkingNoMultirefAsStream() {
return messsageAsStream(WORKING_NOMULTIREF);
}
public static InputStream createWorkingNoMultirefAsStream_reversedResponseParameters() {
return messsageAsStream(WORKING_NOMULTIREF_REVERSED_RESPONSE_PARAMETERS);
}
public static InputStream createMultirefAsStream() {
return messsageAsStream(BROKEN_STRING);
}
private static InputStream messsageAsStream(String message) {
return new ByteArrayInputStream(message.getBytes());
}
public void setInputSring(String inputString) {
inputStream = new ByteArrayInputStream(inputString.getBytes());
}
public void connect() throws IOException {
connected = true;
}
public void disconnect() throws IOException {
throw new RuntimeException("ServiceConnectionFixture.disconnect is not implemented yet");
}
public void setRequestProperty(String propertyName, String value) throws IOException {
requestPropertyMap.put(propertyName, value);
}
public void setRequestMethod(String post) throws ProtocolException, IOException {
}
public OutputStream openOutputStream() throws IOException {
return outputStream;
}
public InputStream openInputStream() throws IOException {
return inputStream;
}
public InputStream getErrorStream() {
throw new RuntimeException("ServiceConnectionFixture.getErrorStream is not implemented yet");
}
public static void assertComplexResponseCorrect(ComplexResponse complexResponse) {
Assert.assertEquals("theStringResponse", complexResponse.stringResponse);
Assert.assertEquals(1234567890, complexResponse.longResponse);
}
public static InputStream createTwoDimensionalStringArrayResponseAsStream() {
return messsageAsStream(TWO_DIMENSIONAL_STRING_ARRAY);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -