org.apache.xmlrpc.client.XmlRpcClient Java Examples

The following examples show how to use org.apache.xmlrpc.client.XmlRpcClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Pingtest.java    From jivejdon with Apache License 2.0 8 votes vote down vote up
public static void main(String[] args) throws UnknownHostException, SocketException {
	try {
		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

		config.setServerURL(new URL("http://ping.baidu.com/ping/RPC2"));
		config.setUserAgent("jdon.com");
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);
		Object[] params = new Object[] { "jdon", "http://www.jdon.com/", "http://www.jdon.com/47686",
				 "http://www.jdon.com/rss" };
		String pMethodName = "weblogUpdates.extendedPing";
		Object result = client.execute(pMethodName, params);

		System.out.println(result);
	} catch (Exception e) {
		
	}
	
}
 
Example #2
Source File: ApiGetVersions.java    From sync-service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
	config.setEnabledForExtensions(true);
	config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
	XmlRpcClient client = new XmlRpcClient();
	client.setConfig(config);

	Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "887611628764801051" };
																		// strFileId

	long startTotal = System.currentTimeMillis();
	String strResponse = (String) client.execute("XmlRpcSyncHandler.getVersions", params);

	System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));

	long totalTime = System.currentTimeMillis() - startTotal;
	System.out.println("Total level time --> " + totalTime + " ms");
}
 
Example #3
Source File: ApiPutMetadataFolder.java    From sync-service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
		config.setEnabledForExtensions(true);
		config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);

		Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "hola5", null};
																			// strFolderName, strParentId

		long startTotal = System.currentTimeMillis();
		String strResponse = (String) client.execute("XmlRpcSyncHandler.putMetadataFolder", params);

		System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));

		long totalTime = System.currentTimeMillis() - startTotal;
		System.out.println("Total level time --> " + totalTime + " ms");
	}
 
Example #4
Source File: ApiGetMetadata.java    From sync-service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
		config.setEnabledForExtensions(true);
		config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);
		
		String strUserId = "159a1286-33df-4453-bf80-cff4af0d97b0";
		String strItemId = "100";
		String strIncludeList = "true";
		String strIncludeDeleted = "true";
		String strIncludeChunks = "true";
		String strVersion = "null";
		
		Object[] params = new Object[] { strUserId, strItemId, strIncludeList, strIncludeDeleted, strIncludeChunks, strVersion};

		long startTotal = System.currentTimeMillis();
		String strResponse = (String) client.execute("XmlRpcSyncHandler.getMetadata", params);

		System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));

		long totalTime = System.currentTimeMillis() - startTotal;
		System.out.println("Total level time --> " + totalTime + " ms");
	}
 
Example #5
Source File: ApiPutMetadataFile.java    From sync-service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
		config.setEnabledForExtensions(true);
		config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);

		String[] chunks = new String[] {"1111", "2222", "3333"};
		Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "test.txt", "", "", "111111", "10", "Text", chunks};
																			// strFileName, strParentId, strOverwrite, strChecksum, strFileSize,
																			// strMimetype, strChunks

		long startTotal = System.currentTimeMillis();
		String strResponse = (String) client.execute("XmlRpcSyncHandler.putMetadataFile", params);

		System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));

		long totalTime = System.currentTimeMillis() - startTotal;
		System.out.println("Total level time --> " + totalTime + " ms");
	}
 
Example #6
Source File: ApiRestoreMetadata.java    From sync-service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
		config.setEnabledForExtensions(true);
		config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);

		Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "887611628764801051", "2"};
																			// strFileId, strVersion

		long startTotal = System.currentTimeMillis();
		String strResponse = (String) client.execute("XmlRpcSyncHandler.restoreMetadata", params);

		System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));

		long totalTime = System.currentTimeMillis() - startTotal;
		System.out.println("Total level time --> " + totalTime + " ms");
	}
 
Example #7
Source File: ApiDeleteMetadataFile.java    From sync-service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
		config.setEnabledForExtensions(true);
		config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);

		Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "-4573748213815439639"};
																			// strFileId

		long startTotal = System.currentTimeMillis();
		String strResponse = (String) client.execute("XmlRpcSyncHandler.deleteMetadataFile", params);

		System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));

		long totalTime = System.currentTimeMillis() - startTotal;
		System.out.println("Total level time --> " + totalTime + " ms");
	}
 
Example #8
Source File: ApiCreateFolder.java    From sync-service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
		config.setEnabledForExtensions(true);
		config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);
		
		String strUserId = "159a1286-33df-4453-bf80-cff4af0d97b0";
		String strFolderName = "folder1";
		String strParentId = "null";
		
		Object[] params = new Object[] { strUserId, strFolderName, strParentId};

		long startTotal = System.currentTimeMillis();
		String strResponse = (String) client.execute("XmlRpcSyncHandler.createFolder", params);

		System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));

		long totalTime = System.currentTimeMillis() - startTotal;
		System.out.println("Total level time --> " + totalTime + " ms");
	}
 
Example #9
Source File: DemoDbGetter.java    From openerp-java-api with Apache License 2.0 6 votes vote down vote up
private static boolean testConnection(DemoDbInfo infos) {
	// Try to connect to that DB to check it is still available
	final XmlRpcClient client = new XmlRpcClient();
	final XmlRpcClientConfigImpl common_config = new XmlRpcClientConfigImpl();
	try {
		String protocolAsString = infos.protocol == RPCProtocol.RPC_HTTP ? "http://" : "https://"; 
		common_config.setServerURL(
				new URL(String.format("%s%s:%s/xmlrpc/2/common", protocolAsString, infos.host, infos.port)));

		int uid = (int) client.execute(common_config, "authenticate",
				new Object[] { infos.db, infos.username, infos.password, new Object[] {} });
		// Informations are valid if user could log in.
		return uid != 0;

	} catch (MalformedURLException e1) {
		// Previously saved data is causing this...
		// We will have to request a new demo db
		return false;
	} catch (XmlRpcException e) {
		// Connection to previous demo db failed somehow, we will have
		// to request a new one...
		return false;
	}
}
 
Example #10
Source File: BlogPingClient.java    From jivejdon with Apache License 2.0 6 votes vote down vote up
public void blogPing(String serverUrl, String Title, String blogUrl, String UrlChanges,
					 String UrlRSS) {
	try {
		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

		config.setServerURL(new URL(serverUrl));
		config.setUserAgent("jdon.com");
		XmlRpcClient client = new XmlRpcClient();
		client.setConfig(config);
		Object[] params = new Object[]{Title, blogUrl, UrlChanges, UrlRSS};
		String pMethodName = "weblogUpdates.extendedPing";
		Object result = client.execute(pMethodName, params);

		logger.info(result);
	} catch (Exception e) {
		logger.error(e);
	}
}
 
Example #11
Source File: ConnectionTest.java    From cloudstack with Apache License 2.0 5 votes vote down vote up
@Override
public Object callTimeoutInSec(String method, List<?> params, int timeout,
        boolean debug) throws XmlRpcException {
    XmlRpcStreamConfig config = new XmlRpcHttpRequestConfigImpl();
    XmlRpcClient client = new XmlRpcClient();
    client.setTypeFactory(new RpcTypeFactory(client));
    XmlRpcResponseParser parser = new XmlRpcResponseParser(
            (XmlRpcStreamRequestConfig) config, client.getTypeFactory());
    XMLReader xr = SAXParsers.newXMLReader();
    xr.setContentHandler(parser);
    try {
        String result = null;
        if (getMethodResponse(method) != null) {
            result = getMethodResponse(method);
            LOGGER.debug("methodresponse call: " + method + " - " + params);
            LOGGER.trace("methodresponse reply: " + result);
        }
        if (result == null && multiRes.size() >= 0) {
            result = getResult();
            LOGGER.debug("getresult call: " + method + " - " + params);
            LOGGER.trace("getresult reply: " + result);
        }
        xr.parse(new InputSource(new StringReader(result)));
    } catch (Exception e) {
        throw new XmlRpcException("Exception: " + e.getMessage(), e);
    }
    if (parser.getErrorCode() != 0) {
        throw new XmlRpcException("Fault received[" + parser.getErrorCode()
                + "]: " + parser.getErrorMessage());
    }
    return parser.getResult();
}
 
Example #12
Source File: Confluence.java    From maven-confluence-plugin with Apache License 2.0 5 votes vote down vote up
protected Confluence(String endpoint, ConfluenceProxy proxyInfo ) throws URISyntaxException, MalformedURLException {
       this(new XmlRpcClient());
if (endpoint.endsWith("/")) {
           endpoint = endpoint.substring(0, endpoint.length() - 1);
       }

       endpoint = ConfluenceService.Protocol.XMLRPC.addTo(endpoint);
   
       final java.net.URI serviceURI = new java.net.URI(endpoint);

       XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
       clientConfig.setServerURL(serviceURI.toURL() );

       clientConfig.setEnabledForExtensions(true); // add this to support attachment upload

       client.setConfig( clientConfig );

       if( isProxyEnabled(proxyInfo, serviceURI) ) {
           
           final XmlRpcCommonsTransportFactory transportFactory = new XmlRpcCommonsTransportFactory( client );

           final HttpClient httpClient = new HttpClient();
           final HostConfiguration hostConfiguration = httpClient.getHostConfiguration();
           hostConfiguration.setProxy( proxyInfo.host, proxyInfo.port );
           hostConfiguration.setHost(serviceURI.getHost(), serviceURI.getPort(), serviceURI.toURL().getProtocol());

           if( !isNullOrEmpty(proxyInfo.userName) && !isNullOrEmpty(proxyInfo.password) ) {
               Credentials cred = new UsernamePasswordCredentials(proxyInfo.userName,proxyInfo.password);
               httpClient.getState().setProxyCredentials(AuthScope.ANY, cred);
           }

           transportFactory.setHttpClient( httpClient );
           client.setTransportFactory( transportFactory );
       }
   }
 
Example #13
Source File: Purchasing.java    From BowlerStudio with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void test() throws XmlRpcException, MalformedURLException {

	XmlRpcClient client = new XmlRpcClient();

	XmlRpcClientConfigImpl start_config = new XmlRpcClientConfigImpl();
	start_config.setServerURL(new URL("https://demo.odoo.com/start"));
	Map<String, String> info = (Map<String, String>) client.execute(start_config, "start", emptyList());

	String url = info.get("host"), db = info.get("database"), username = info.get("user"),
			password = info.get("password");
	XmlRpcClientConfigImpl common_config = new XmlRpcClientConfigImpl();
	common_config.setServerURL(new URL(String.format("%s/xmlrpc/2/common", url)));
	Map<String, String> serverInfo = (Map<String, String>) client.execute(common_config, "version", emptyList());

	int uid = (int) client.execute(common_config, "authenticate",
			new Object[] { db, username, password, emptyMap() });

	XmlRpcClient models = new XmlRpcClient() {
		{
			setConfig(new XmlRpcClientConfigImpl() {
				{
					setServerURL(new URL(String.format("%s/xmlrpc/2/object", url)));
				}
			});
		}
	};
	models.execute("execute_kw", new Object[] { db, uid, password, "res.partner", "check_access_rights",
			new Object[] { "read" }, new HashMap() {
				{
					put("raise_exception", false);
				}
			} });
	// https://sourceforge.net/p/openerpjavaapi/wiki/Home/
	

}
 
Example #14
Source File: XmlRpcTests.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
/**
 * Test Xml Rpc by java class call with a Object List
 * @throws Exception
 */
public void testXmlRpcRequest() throws Exception {
    XmlRpcClient client = this.getRpcClient(url, "admin", "ofbiz");
    Object[] params = new Object[] { 55.00, "message from xml-rpc client" };
    Map<String, Object> result = UtilGenerics.cast(client.execute("testScv", params));
    assertEquals("XML-RPC Service result success", "service done", result.get("resp"));
}
 
Example #15
Source File: PacmanUtils.java    From pacbot with Apache License 2.0 5 votes vote down vote up
public static XmlRpcClient getXMLRPCClient(String rpcUrl) throws MalformedURLException {

        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
        config.setServerURL(new URL(rpcUrl));
        XmlRpcClient client = new XmlRpcClient();
        client.setConfig(config);
        return client;
    }
 
Example #16
Source File: CitrixRequestWrapperTest.java    From cloudstack with Apache License 2.0 4 votes vote down vote up
@Test
public void testMaintainCommand() {
    // This test needs further work.

    final String uuid = "befc4dcd-f5c6-4015-8791-3c18622b7c7f";

    final Connection conn = Mockito.mock(Connection.class);
    final XsHost xsHost = Mockito.mock(XsHost.class);
    final XmlRpcClient client = Mockito.mock(XmlRpcClient.class);

    // final Host.Record hr = PowerMockito.mock(Host.Record.class);
    // final Host host = PowerMockito.mock(Host.class);

    final MaintainCommand maintainCommand = new MaintainCommand();

    final Map<String, Object> map = new Hashtable<String, Object>();
    map.put("Value", "Xen");

    final Map<String, Object> spiedMap = spy(map);

    final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
    assertNotNull(wrapper);

    when(citrixResourceBase.getConnection()).thenReturn(conn);
    when(citrixResourceBase.getHost()).thenReturn(xsHost);
    when(xsHost.getUuid()).thenReturn(uuid);
    when(conn.getSessionReference()).thenReturn("befc4dcd");

    try {
        final Object[] params = { Marshalling.toXMLRPC("befc4dcd"), Marshalling.toXMLRPC(uuid) };
        when(client.execute("host.get_by_uuid", new Object[] { "befc4dcd", uuid })).thenReturn(spiedMap);
        PowerMockito.when(conn, "dispatch", "host.get_by_uuid", params).thenReturn(spiedMap);
    } catch (final Exception e) {
        fail(e.getMessage());
    }

    // try {
    // PowerMockito.mockStatic(Host.class);
    // //BDDMockito.given(Host.getByUuid(conn,
    // xsHost.getUuid())).willReturn(host);
    // PowerMockito.when(Host.getByUuid(conn,
    // xsHost.getUuid())).thenReturn(host);
    // PowerMockito.verifyStatic(times(1));
    // } catch (final BadServerResponse e) {
    // fail(e.getMessage());
    // } catch (final XenAPIException e) {
    // fail(e.getMessage());
    // } catch (final XmlRpcException e) {
    // fail(e.getMessage());
    // }
    //
    // PowerMockito.mockStatic(Types.class);
    // PowerMockito.when(Types.toHostRecord(spiedMap)).thenReturn(hr);
    // PowerMockito.verifyStatic(times(1));
    //
    // try {
    // PowerMockito.mockStatic(Host.Record.class);
    // when(host.getRecord(conn)).thenReturn(hr);
    // verify(host, times(1)).getRecord(conn);
    // } catch (final BadServerResponse e) {
    // fail(e.getMessage());
    // } catch (final XenAPIException e) {
    // fail(e.getMessage());
    // } catch (final XmlRpcException e) {
    // fail(e.getMessage());
    // }

    final Answer answer = wrapper.execute(maintainCommand, citrixResourceBase);

    assertFalse(answer.getResult());
}
 
Example #17
Source File: ScriptXmlRpcClient.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Constructor (see fields description)
 */
public ScriptXmlRpcClient(Process process) {
    this.impl = new XmlRpcClient();
    this.process = process;
}
 
Example #18
Source File: cfXMLRPC.java    From openbd-core with GNU General Public License v3.0 4 votes vote down vote up
public cfTagReturnType render(cfSession _Session) throws cfmRunTimeException {
  String server	= getDynamic( _Session, "SERVER").getString();
  String method	= getDynamic( _Session, "METHOD").getString();
  cfData params	= getDynamic( _Session, "PARAMS");


//-- Create the return structure, and prefill it in with debug data
cfStructData	xmlrpc = new cfStructData();
xmlrpc.setData("server", 	new cfStringData(server) );
xmlrpc.setData("method", 	new cfStringData(method) );


  //-- The params must be an array
  if ( params.getDataType() != cfData.CFARRAYDATA ){
	xmlrpc.setData("success", cfBooleanData.FALSE);
	xmlrpc.setData("error", 	new cfStringData("PARAMS must be an array type") );
	_Session.setData("xmlrpc", xmlrpc);
	return cfTagReturnType.NORMAL;
}

  //-- Clean up the server
  if ( !server.toLowerCase().startsWith("http://") )
    server	= "http://" + server;

  try{
  	XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
      config.setServerURL(new URL(server));
      XmlRpcClient client = new XmlRpcClient();
      client.setConfig(config);

 	//-- Need to convert the CFML structure into a Java structure
   Vector javaParamsV 		= (Vector) tagUtils.convertCFtoJava( params, java.util.Vector.class );
   Object[] javaParams     = new Object[javaParamsV.size()];
   for(int i=0; i<javaParams.length; i++)
   	javaParams[i] = javaParamsV.get(i);

      Object xmlResult 			= client.execute(method,javaParams);

    xmlrpc.setData("result", 	tagUtils.convertToCfData( xmlResult ) );
    xmlrpc.setData("success", cfBooleanData.TRUE);

  }catch(Exception E){
    xmlrpc.setData("success", cfBooleanData.FALSE);
    xmlrpc.setData("error", 	new cfStringData(E.getMessage()) );
  }

  _Session.setData("xmlrpc", xmlrpc);

  return cfTagReturnType.NORMAL;
}
 
Example #19
Source File: DemoDbGetter.java    From openerp-java-api with Apache License 2.0 4 votes vote down vote up
private static DemoDbInfo getNewDemoDb() throws XmlRpcException {
	System.out.println("Requesting new demo db from https://demo.odoo.com/start");
	final XmlRpcClient client = new XmlRpcClient();

	final XmlRpcClientConfigImpl start_config = new XmlRpcClientConfigImpl();
	try {
		start_config.setServerURL(new URL("https://demo.odoo.com/start"));
		String methodName = "start";
		Object[] params = new Object[] {};
		@SuppressWarnings("unchecked")
		final Map<String, String> info = (Map<String, String>) client.execute(start_config, methodName, params);

		String url = info.get("host");
		final String db = info.get("database");
		final String username = info.get("user");
		final String password = info.get("password");

		RPCProtocol protocol;
		Integer port;

		if (url.startsWith(HTTPS_PROTOCOL)) {
			protocol = RPCProtocol.RPC_HTTPS;
			url = url.substring(HTTPS_PROTOCOL.length());
			port = 443;
		} else {
			protocol = RPCProtocol.RPC_HTTP;
			url = url.substring(HTTP_PROTOCOL.length());
			port = 80;
		}

		int lastIndexOfColon = url.lastIndexOf(':');
		if (lastIndexOfColon != -1) {
			// Port specified in the url
			String portString = url.substring(lastIndexOfColon + 1);
			if (portString != null && !portString.isEmpty()) {
				port = Integer.parseInt(portString);
			}
			url = url.substring(0, lastIndexOfColon - 1);
		}

		return new DemoDbInfo(protocol, url, port, db, username, password);
	} catch (MalformedURLException e) {
		// Won't happen, as "https://demo.odoo.com/start" is a valid URL...
		return null;
	}
}
 
Example #20
Source File: Confluence.java    From maven-confluence-plugin with Apache License 2.0 4 votes vote down vote up
protected Confluence(XmlRpcClient client) {
    this.client = client;
}
 
Example #21
Source File: CitrixRequestWrapperTest.java    From cosmic with Apache License 2.0 4 votes vote down vote up
@Test
public void testMaintainCommand() {
    // This test needs further work.

    final String uuid = "befc4dcd-f5c6-4015-8791-3c18622b7c7f";

    final Connection conn = Mockito.mock(Connection.class);
    final XsHost xsHost = Mockito.mock(XsHost.class);
    final XmlRpcClient client = Mockito.mock(XmlRpcClient.class);

    // final Host.Record hr = PowerMockito.mock(Host.Record.class);
    // final Host host = PowerMockito.mock(Host.class);

    final MaintainCommand maintainCommand = new MaintainCommand();

    final Map<String, Object> map = new Hashtable<>();
    map.put("Value", "Xen");

    final Map<String, Object> spiedMap = spy(map);

    final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
    assertNotNull(wrapper);

    when(this.citrixResourceBase.getConnection()).thenReturn(conn);
    when(this.citrixResourceBase.getHost()).thenReturn(xsHost);
    when(xsHost.getUuid()).thenReturn(uuid);
    when(conn.getSessionReference()).thenReturn("befc4dcd");

    try {
        final Object[] params = {Marshalling.toXMLRPC("befc4dcd"), Marshalling.toXMLRPC(uuid)};
        when(client.execute("host.get_by_uuid", new Object[]{"befc4dcd", uuid})).thenReturn(spiedMap);
        PowerMockito.when(conn, "dispatch", "host.get_by_uuid", params).thenReturn(spiedMap);
    } catch (final Exception e) {
        fail(e.getMessage());
    }

    // try {
    // PowerMockito.mockStatic(Host.class);
    // //BDDMockito.given(Host.getByUuid(conn,
    // xsHost.getUuid())).willReturn(host);
    // PowerMockito.when(Host.getByUuid(conn,
    // xsHost.getUuid())).thenReturn(host);
    // PowerMockito.verifyStatic(times(1));
    // } catch (final BadServerResponse e) {
    // fail(e.getMessage());
    // } catch (final XenAPIException e) {
    // fail(e.getMessage());
    // } catch (final XmlRpcException e) {
    // fail(e.getMessage());
    // }
    //
    // PowerMockito.mockStatic(Types.class);
    // PowerMockito.when(Types.toHostRecord(spiedMap)).thenReturn(hr);
    // PowerMockito.verifyStatic(times(1));
    //
    // try {
    // PowerMockito.mockStatic(Host.Record.class);
    // when(host.getRecord(conn)).thenReturn(hr);
    // verify(host, times(1)).getRecord(conn);
    // } catch (final BadServerResponse e) {
    // fail(e.getMessage());
    // } catch (final XenAPIException e) {
    // fail(e.getMessage());
    // } catch (final XmlRpcException e) {
    // fail(e.getMessage());
    // }

    final Answer answer = wrapper.execute(maintainCommand, this.citrixResourceBase);

    assertFalse(answer.getResult());
}