*) soap api

- adding function to get and set message forwarding
   - adding new testclass 


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2878 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent ee4d4e8567
commit c7bea4addb

@ -68,11 +68,13 @@ public class AdminService extends AbstractService {
* Used Plasmaswitchboard config properties
* ===================================================================== */
private static final String _10_HTTPD = "10_httpd";
private static final String _62_REMOTETRIGGEREDCRAWL_BUSYSLEEP = "62_remotetriggeredcrawl_busysleep";
private static final String _62_REMOTETRIGGEREDCRAWL = "62_remotetriggeredcrawl";
private static final String RESTART = "restart";
// peer properties
private static final String PORT = "port";
private static final String PEER_NAME = "peerName";
private static final String RESTART = "restart";
// remote proxy properties
private static final String REMOTE_PROXY_USE = "remoteProxyUse";
private static final String REMOTE_PROXY_USE4SSL = "remoteProxyUse4SSL";
private static final String REMOTE_PROXY_USE4YACY = "remoteProxyUse4Yacy";
@ -81,12 +83,24 @@ public class AdminService extends AbstractService {
private static final String REMOTE_PROXY_USER = "remoteProxyUser";
private static final String REMOTE_PROXY_PORT = "remoteProxyPort";
private static final String REMOTE_PROXY_HOST = "remoteProxyHost";
// remote triggered crawl properties
private static final String CRAWL_RESPONSE = "crawlResponse";
private static final String _62_REMOTETRIGGEREDCRAWL_BUSYSLEEP = "62_remotetriggeredcrawl_busysleep";
private static final String _62_REMOTETRIGGEREDCRAWL = "62_remotetriggeredcrawl";
// index transfer properties
private static final String INDEX_RECEIVE_BLOCK_BLACKLIST = "indexReceiveBlockBlacklist";
private static final String ALLOW_RECEIVE_INDEX = "allowReceiveIndex";
private static final String ALLOW_DISTRIBUTE_INDEX_WHILE_CRAWLING = "allowDistributeIndexWhileCrawling";
private static final String ALLOW_DISTRIBUTE_INDEX = "allowDistributeIndex";
// message forwarding properties
private static final String MSG_FORWARDING_TO = "msgForwardingTo";
private static final String MSG_FORWARDING_CMD = "msgForwardingCmd";
private static final String MSG_FORWARDING_ENABLED = "msgForwardingEnabled";
private static final String MSG_FORWARDING = "msgForwarding";
/* =====================================================================
* Used XML Templates
@ -473,7 +487,7 @@ public class AdminService extends AbstractService {
public Document getTransferProperties() throws AxisFault, ParserConfigurationException {
// extracting the message context
extractMessageContext(true);
extractMessageContext(AUTHENTICATION_NEEDED);
// creating XML document
Element xmlElement = null;
@ -498,4 +512,75 @@ public class AdminService extends AbstractService {
return xmlDoc;
}
/**
*
* @param enableForwarding
* @param forwardingCommand
* @param forwardingTo
* @throws AxisFault
*
* @link <a href="http://localhost:8080/Settings_p.html?page=messageForwarding">Peer Configuration - Message Forwarding</a>
*/
public void setMessageForwarding(
Boolean enableForwarding,
String forwardingCommand,
String forwardingTo
) throws AxisFault {
// extracting the message context
extractMessageContext(AUTHENTICATION_NEEDED);
// index Distribution on/off
if (enableForwarding != null) {
this.switchboard.setConfig(MSG_FORWARDING_ENABLED, enableForwarding.toString());
}
if (forwardingCommand != null) {
this.switchboard.setConfig(MSG_FORWARDING_CMD, forwardingCommand);
}
if (forwardingTo != null) {
this.switchboard.setConfig(MSG_FORWARDING_TO, forwardingTo);
}
}
/**
*
* @return a XML document of the following format
* <pre>
* &lt;?xml version="1.0" encoding="UTF-8"?&gt;
* &lt;msgForwarding&gt;
* &lt;msgForwardingEnabled&gt;false&lt;/msgForwardingEnabled&gt;
* &lt;msgForwardingCmd&gt;/usr/sbin/sendmail&lt;/msgForwardingCmd&gt;
* &lt;msgForwardingTo&gt;root@localhost&lt;/msgForwardingTo&gt;
* &lt;/msgForwarding&gt;
* </pre>
* @throws AxisFault
* @throws ParserConfigurationException
*
* @link <a href="http://localhost:8080/Settings_p.html?page=messageForwarding">Peer Configuration - Message Forwarding</a>
*/
public Document getMessageForwarding() throws AxisFault, ParserConfigurationException {
// extracting the message context
extractMessageContext(AUTHENTICATION_NEEDED);
// creating XML document
Element xmlElement = null;
Document xmlDoc = createNewXMLDocument(MSG_FORWARDING);
Element xmlRoot = xmlDoc.getDocumentElement();
xmlElement = xmlDoc.createElement(MSG_FORWARDING_ENABLED);
xmlElement.appendChild(xmlDoc.createTextNode(Boolean.toString(this.switchboard.getConfigBool(MSG_FORWARDING_ENABLED,false))));
xmlRoot.appendChild(xmlElement);
xmlElement = xmlDoc.createElement(MSG_FORWARDING_CMD);
xmlElement.appendChild(xmlDoc.createTextNode(this.switchboard.getConfig(MSG_FORWARDING_CMD,"")));
xmlRoot.appendChild(xmlElement);
xmlElement = xmlDoc.createElement(MSG_FORWARDING_TO);
xmlElement.appendChild(xmlDoc.createTextNode(this.switchboard.getConfig(MSG_FORWARDING_TO,"")));
xmlRoot.appendChild(xmlElement);
return xmlDoc;
}
}

@ -122,7 +122,7 @@ public class BlacklistService extends AbstractService {
// check if the blacklist already exists
if (blacklistExists(blacklistName))
throw new AxisFault("Blacklist with name '" + blacklistName + "' already exist.");
throw new AxisFault("Blacklist with name '" + blacklistName + "' already exist.");
// creating the new file
createBlacklistFile(blacklistName);

@ -1,175 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://yacy:8080/soap/admin" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://yacy:8080/soap/admin" xmlns:intf="http://yacy:8080/soap/admin" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--WSDL created by Apache Axis version: 1.2RC2
Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http://yacy:8080/soap/admin" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://xml.apache.org/xml-soap"/><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType name="ArrayOf_soapenc_string"><complexContent><restriction base="soapenc:Array"><attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:string[]"/></restriction></complexContent></complexType></schema></wsdl:types>
<wsdl:definitions targetNamespace="http://yacy:8080/soap/admin" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://yacy:8080/soap/admin" xmlns:intf="http://yacy:8080/soap/admin" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)--><wsdl:types><schema targetNamespace="http://yacy:8080/soap/admin" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://xml.apache.org/xml-soap"/><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType name="ArrayOf_xsd_string"><complexContent><restriction base="soapenc:Array"><attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/></restriction></complexContent></complexType></schema></wsdl:types>
<wsdl:message name="setTransferPropertiesResponse">
</wsdl:message>
<wsdl:message name="shutdownPeerResponse">
</wsdl:message>
<wsdl:message name="setMessageForwardingResponse">
</wsdl:message>
<wsdl:message name="createNewXMLDocumentRequest">
<wsdl:part name="rootElementName" type="soapenc:string"/>
<wsdl:part name="rootElementName" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="getMessageForwardingRequest">
</wsdl:message>
<wsdl:message name="enableRemoteProxyRequest">
<wsdl:part name="enableProxy" type="xsd:boolean"/>
</wsdl:message>
<wsdl:message name="setPeerNameRequest">
<wsdl:part name="newName" type="soapenc:string"/>
<wsdl:part name="newName" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="getConfigPropertyRequest">
<wsdl:part name="key" type="soapenc:string"/>
<wsdl:part name="key" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="getTransferPropertiesRequest">
</wsdl:message>
<wsdl:message name="setRemoteProxyResponse">
</wsdl:message>
<wsdl:message name="getConfigPropertyListRequest">
</wsdl:message>
<wsdl:message name="enableRemoteProxyResponse">
</wsdl:message>
<wsdl:message name="getConfigPropertiesResponse">
<wsdl:part name="getConfigPropertiesReturn" type="impl:ArrayOf_soapenc_string"/>
<wsdl:part name="getConfigPropertiesReturn" type="impl:ArrayOf_xsd_string"/>
</wsdl:message>
<wsdl:message name="createNewXMLDocumentResponse">
<wsdl:part name="createNewXMLDocumentReturn" type="apachesoap:Document"/>
</wsdl:message>
<wsdl:message name="getConfigPropertiesRequest">
<wsdl:part name="keys" type="impl:ArrayOf_soapenc_string"/>
<wsdl:part name="keys" type="impl:ArrayOf_xsd_string"/>
</wsdl:message>
<wsdl:message name="getVersionRequest">
</wsdl:message>
<wsdl:message name="setPeerPortResponse">
</wsdl:message>
<wsdl:message name="setTransferPropertiesRequest">
<wsdl:part name="indexDistribution" type="soapenc:boolean"/>
<wsdl:part name="indexDistributeWhileCrawling" type="soapenc:boolean"/>
<wsdl:part name="indexReceive" type="soapenc:boolean"/>
<wsdl:part name="indexReceiveBlockBlacklist" type="soapenc:boolean"/>
<wsdl:part name="indexDistribution" type="xsd:boolean"/>
<wsdl:part name="indexDistributeWhileCrawling" type="xsd:boolean"/>
<wsdl:part name="indexReceive" type="xsd:boolean"/>
<wsdl:part name="indexReceiveBlockBlacklist" type="xsd:boolean"/>
</wsdl:message>
<wsdl:message name="getMessageForwardingResponse">
<wsdl:part name="getMessageForwardingReturn" type="apachesoap:Document"/>
</wsdl:message>
<wsdl:message name="getConfigPropertyListResponse">
<wsdl:part name="getConfigPropertyListReturn" type="apachesoap:Document"/>
</wsdl:message>
<wsdl:message name="setPeerPortRequest">
<wsdl:part name="newPort" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="getTransferPropertiesResponse">
<wsdl:part name="getTransferPropertiesReturn" type="apachesoap:Document"/>
</wsdl:message>
<wsdl:message name="getConfigPropertyResponse">
<wsdl:message name="setMessageForwardingRequest">
<wsdl:part name="enableForwarding" type="xsd:boolean"/>
<wsdl:part name="forwardingCommand" type="xsd:string"/>
<wsdl:part name="getConfigPropertyReturn" type="soapenc:string"/>
<wsdl:part name="forwardingTo" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="getConfigPropertyResponse">
<wsdl:part name="getConfigPropertyReturn" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="setPropertiesRequest">
<wsdl:part name="keys" type="impl:ArrayOf_soapenc_string"/>
<wsdl:part name="values" type="impl:ArrayOf_soapenc_string"/>
<wsdl:part name="keys" type="impl:ArrayOf_xsd_string"/>
<wsdl:part name="values" type="impl:ArrayOf_xsd_string"/>
</wsdl:message>
<wsdl:message name="setRemoteProxyRequest">
<wsdl:part name="enableRemoteProxy" type="soapenc:boolean"/>
<wsdl:part name="proxyHost" type="soapenc:string"/>
<wsdl:part name="enableRemoteProxy" type="xsd:boolean"/>
<wsdl:part name="proxyHost" type="xsd:string"/>
<wsdl:part name="proxyPort" type="xsd:int"/>
<wsdl:part name="proxyUserName" type="xsd:string"/>
<wsdl:part name="proxyPwd" type="xsd:string"/>
<wsdl:part name="noProxyList" type="xsd:string"/>
<wsdl:part name="useProxy4YaCy" type="xsd:boolean"/>
<wsdl:part name="useProxy4SSL" type="xsd:boolean"/>
<wsdl:part name="proxyPort" type="soapenc:int"/>
<wsdl:part name="proxyUserName" type="soapenc:string"/>
<wsdl:part name="proxyPwd" type="soapenc:string"/>
<wsdl:part name="noProxyList" type="soapenc:string"/>
<wsdl:part name="useProxy4YaCy" type="soapenc:boolean"/>
<wsdl:part name="useProxy4SSL" type="soapenc:boolean"/>
</wsdl:message>
<wsdl:message name="setConfigPropertyResponse">
</wsdl:message>
<wsdl:message name="setDistributedCrawlingRequest">
<wsdl:part name="enableRemoteTriggeredCrawls" type="soapenc:boolean"/>
<wsdl:part name="maximumAllowedPPM" type="soapenc:int"/>
<wsdl:part name="enableRemoteTriggeredCrawls" type="xsd:boolean"/>
<wsdl:part name="maximumAllowedPPM" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="getVersionResponse">
<wsdl:part name="getVersionReturn" type="apachesoap:Document"/>
</wsdl:message>
<wsdl:message name="setPropertiesResponse">
</wsdl:message>
<wsdl:message name="setPeerNameResponse">
</wsdl:message>
<wsdl:message name="setConfigPropertyRequest">
<wsdl:part name="key" type="soapenc:string"/>
<wsdl:part name="value" type="soapenc:string"/>
<wsdl:part name="key" type="xsd:string"/>
<wsdl:part name="value" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="setDistributedCrawlingResponse">
</wsdl:message>
<wsdl:message name="shutdownPeerRequest">
</wsdl:message>
<wsdl:portType name="AdminService">
<wsdl:operation name="setProperties" parameterOrder="keys values">
<wsdl:input message="impl:setPropertiesRequest" name="setPropertiesRequest"/>
<wsdl:output message="impl:setPropertiesResponse" name="setPropertiesResponse"/>
</wsdl:operation>
<wsdl:operation name="getVersion">
<wsdl:input message="impl:getVersionRequest" name="getVersionRequest"/>
<wsdl:output message="impl:getVersionResponse" name="getVersionResponse"/>
</wsdl:operation>
<wsdl:operation name="setConfigProperty" parameterOrder="key value">
<wsdl:input message="impl:setConfigPropertyRequest" name="setConfigPropertyRequest"/>
<wsdl:output message="impl:setConfigPropertyResponse" name="setConfigPropertyResponse"/>
</wsdl:operation>
<wsdl:operation name="getConfigProperty" parameterOrder="key">
<wsdl:input message="impl:getConfigPropertyRequest" name="getConfigPropertyRequest"/>
<wsdl:output message="impl:getConfigPropertyResponse" name="getConfigPropertyResponse"/>
</wsdl:operation>
<wsdl:operation name="getConfigProperties" parameterOrder="keys">
<wsdl:input message="impl:getConfigPropertiesRequest" name="getConfigPropertiesRequest"/>
<wsdl:output message="impl:getConfigPropertiesResponse" name="getConfigPropertiesResponse"/>
</wsdl:operation>
<wsdl:operation name="getConfigPropertyList">
<wsdl:input message="impl:getConfigPropertyListRequest" name="getConfigPropertyListRequest"/>
<wsdl:output message="impl:getConfigPropertyListResponse" name="getConfigPropertyListResponse"/>
</wsdl:operation>
<wsdl:operation name="setPeerName" parameterOrder="newName">
<wsdl:input message="impl:setPeerNameRequest" name="setPeerNameRequest"/>
<wsdl:output message="impl:setPeerNameResponse" name="setPeerNameResponse"/>
</wsdl:operation>
<wsdl:operation name="setPeerPort" parameterOrder="newPort">
<wsdl:input message="impl:setPeerPortRequest" name="setPeerPortRequest"/>
<wsdl:output message="impl:setPeerPortResponse" name="setPeerPortResponse"/>
</wsdl:operation>
<wsdl:operation name="enableRemoteProxy" parameterOrder="enableProxy">
<wsdl:input message="impl:enableRemoteProxyRequest" name="enableRemoteProxyRequest"/>
<wsdl:output message="impl:enableRemoteProxyResponse" name="enableRemoteProxyResponse"/>
</wsdl:operation>
<wsdl:operation name="setRemoteProxy" parameterOrder="enableRemoteProxy proxyHost proxyPort proxyUserName proxyPwd noProxyList useProxy4YaCy useProxy4SSL">
<wsdl:input message="impl:setRemoteProxyRequest" name="setRemoteProxyRequest"/>
<wsdl:output message="impl:setRemoteProxyResponse" name="setRemoteProxyResponse"/>
</wsdl:operation>
<wsdl:operation name="shutdownPeer">
<wsdl:input message="impl:shutdownPeerRequest" name="shutdownPeerRequest"/>
<wsdl:output message="impl:shutdownPeerResponse" name="shutdownPeerResponse"/>
</wsdl:operation>
<wsdl:operation name="setDistributedCrawling" parameterOrder="enableRemoteTriggeredCrawls maximumAllowedPPM">
<wsdl:input message="impl:setDistributedCrawlingRequest" name="setDistributedCrawlingRequest"/>
<wsdl:output message="impl:setDistributedCrawlingResponse" name="setDistributedCrawlingResponse"/>
</wsdl:operation>
<wsdl:operation name="setTransferProperties" parameterOrder="indexDistribution indexDistributeWhileCrawling indexReceive indexReceiveBlockBlacklist">
<wsdl:input message="impl:setTransferPropertiesRequest" name="setTransferPropertiesRequest"/>
<wsdl:output message="impl:setTransferPropertiesResponse" name="setTransferPropertiesResponse"/>
</wsdl:operation>
<wsdl:operation name="getTransferProperties">
<wsdl:input message="impl:getTransferPropertiesRequest" name="getTransferPropertiesRequest"/>
<wsdl:output message="impl:getTransferPropertiesResponse" name="getTransferPropertiesResponse"/>
</wsdl:operation>
<wsdl:operation name="setMessageForwarding" parameterOrder="enableForwarding forwardingCommand forwardingTo">
<wsdl:input message="impl:setMessageForwardingRequest" name="setMessageForwardingRequest"/>
<wsdl:output message="impl:setMessageForwardingResponse" name="setMessageForwardingResponse"/>
</wsdl:operation>
<wsdl:operation name="getMessageForwarding">
<wsdl:input message="impl:getMessageForwardingRequest" name="getMessageForwardingRequest"/>
<wsdl:output message="impl:getMessageForwardingResponse" name="getMessageForwardingResponse"/>
</wsdl:operation>
<wsdl:operation name="createNewXMLDocument" parameterOrder="rootElementName">
<wsdl:input message="impl:createNewXMLDocumentRequest" name="createNewXMLDocumentRequest"/>
<wsdl:output message="impl:createNewXMLDocumentResponse" name="createNewXMLDocumentResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="adminSoapBinding" type="impl:AdminService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="setProperties">
@ -177,9 +199,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="setPropertiesRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setPropertiesResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getVersion">
@ -187,9 +209,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="getVersionRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="getVersionResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setConfigProperty">
@ -197,9 +219,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="setConfigPropertyRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setConfigPropertyResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getConfigProperty">
@ -207,9 +229,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="getConfigPropertyRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="getConfigPropertyResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getConfigProperties">
@ -217,9 +239,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="getConfigPropertiesRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="getConfigPropertiesResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getConfigPropertyList">
@ -227,9 +249,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="getConfigPropertyListRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="getConfigPropertyListResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setPeerName">
@ -237,9 +259,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="setPeerNameRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setPeerNameResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setPeerPort">
@ -247,9 +269,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="setPeerPortRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setPeerPortResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="enableRemoteProxy">
@ -257,9 +279,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="enableRemoteProxyRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="enableRemoteProxyResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setRemoteProxy">
@ -267,9 +289,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="setRemoteProxyRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setRemoteProxyResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="shutdownPeer">
@ -277,9 +299,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="shutdownPeerRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="shutdownPeerResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setDistributedCrawling">
@ -287,9 +309,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="setDistributedCrawlingRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setDistributedCrawlingResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setTransferProperties">
@ -297,9 +319,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="setTransferPropertiesRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setTransferPropertiesResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getTransferProperties">
@ -307,9 +329,29 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="getTransferPropertiesRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="getTransferPropertiesResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setMessageForwarding">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="setMessageForwardingRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="setMessageForwardingResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getMessageForwarding">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getMessageForwardingRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="getMessageForwardingResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="createNewXMLDocument">
@ -317,9 +359,9 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:input name="createNewXMLDocumentRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://soap.anomic.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="createNewXMLDocumentResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://yacy:8080/soap/admin" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
@ -327,5 +369,6 @@ Built on Nov 16, 2004 (12:19:44 EST)--><wsdl:types><schema targetNamespace="http
<wsdl:port binding="impl:adminSoapBinding" name="admin">
<wsdlsoap:address location="http://yacy:8080/soap/admin"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

@ -0,0 +1,66 @@
package de.anomic.soap.services;
import java.rmi.RemoteException;
import java.util.HashMap;
import javax.xml.rpc.ServiceException;
import javax.xml.transform.TransformerException;
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import yacy.soap.admin.AdminService;
import yacy.soap.admin.AdminServiceServiceLocator;
import com.sun.org.apache.xpath.internal.XPathAPI;
public class AdminServiceTest extends AbstractServiceTest {
protected void createServiceClass() throws ServiceException {
// construct Soap object
AdminServiceServiceLocator locator = new AdminServiceServiceLocator();
locator.setadminEndpointAddress(getBaseServiceURL() + "admin");
service = locator.getadmin();
}
private HashMap getMessageForwardingProperties(Document xml) throws DOMException, TransformerException {
HashMap result = new HashMap();
result.put("msgForwardingEnabled",Boolean.valueOf(XPathAPI.selectSingleNode(xml,"/msgForwarding/msgForwardingEnabled").getTextContent()));
result.put("msgForwardingCmd",XPathAPI.selectSingleNode(xml,"/msgForwarding/msgForwardingCmd").getTextContent());
result.put("msgForwardingTo",XPathAPI.selectSingleNode(xml,"/msgForwarding/msgForwardingTo").getTextContent());
return result;
}
public void testMessageForwarding() throws RemoteException, TransformerException {
// backup old values
HashMap oldValues = getMessageForwardingProperties(((AdminService)service).getMessageForwarding());
// set new values
Boolean msgEnabled = Boolean.TRUE;
String msgCmd = "/usr/sbin/sendmail";
String msgTo = "yacy@localhost";
((AdminService)service).setMessageForwarding(msgEnabled.booleanValue(),msgCmd,msgTo);
// query configured properties
Document xml = ((AdminService)service).getMessageForwarding();
// check if values are equal
assertEquals(msgEnabled,Boolean.valueOf(XPathAPI.selectSingleNode(xml,"/msgForwarding/msgForwardingEnabled").getTextContent()));
assertEquals(msgCmd,XPathAPI.selectSingleNode(xml,"/msgForwarding/msgForwardingCmd").getTextContent());
assertEquals(msgTo,XPathAPI.selectSingleNode(xml,"/msgForwarding/msgForwardingTo").getTextContent());
// print it out
System.out.println(XMLUtils.DocumentToString(xml));
// set back to old values
((AdminService)service).setMessageForwarding(
((Boolean)oldValues.get("msgForwardingEnabled")).booleanValue(),
(String)oldValues.get("msgForwardingCmd"),
(String)oldValues.get("msgForwardingTo")
);
}
}

@ -8,6 +8,7 @@ public class ServiceTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for de.anomic.soap.services");
//$JUnit-BEGIN$
suite.addTestSuite(AdminServiceTest.class);
suite.addTestSuite(ShareServiceTest.class);
suite.addTestSuite(StatusServiceTest.class);
suite.addTestSuite(BlacklistServiceTest.class);

Loading…
Cancel
Save