Package com.microsoft.windowsazure.management.websites.models

Examples of com.microsoft.windowsazure.management.websites.models.ServerFarmGetResponse


    public void getServerFarmSuccess() throws Exception {
        String webSpaceName = "eastuswebspace";
        String serverFarmName = "";

        // Act
        ServerFarmGetResponse serverFarmGetResponse = webSiteManagementClient.getServerFarmsOperations().get(webSpaceName, serverFarmName);

        // Assert
        Assert.assertEquals(200, serverFarmGetResponse.getStatusCode());
        Assert.assertNotNull(serverFarmGetResponse.getRequestId());
    }
View Full Code Here


                }
                throw ex;
            }
           
            // Create Result
            ServerFarmGetResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new ServerFarmGetResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element serverFarmElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServerFarm");
            if (serverFarmElement != null) {
                Element currentNumberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "CurrentNumberOfWorkers");
                if (currentNumberOfWorkersElement != null) {
                    int currentNumberOfWorkersInstance;
                    currentNumberOfWorkersInstance = DatatypeConverter.parseInt(currentNumberOfWorkersElement.getTextContent());
                    result.setCurrentNumberOfWorkers(currentNumberOfWorkersInstance);
                }
               
                Element currentWorkerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "CurrentWorkerSize");
                if (currentWorkerSizeElement != null) {
                    ServerFarmWorkerSize currentWorkerSizeInstance;
                    currentWorkerSizeInstance = ServerFarmWorkerSize.valueOf(currentWorkerSizeElement.getTextContent());
                    result.setCurrentWorkerSize(currentWorkerSizeInstance);
                }
               
                Element nameElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement != null) {
                    String nameInstance;
                    nameInstance = nameElement.getTextContent();
                    result.setName(nameInstance);
                }
               
                Element numberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "NumberOfWorkers");
                if (numberOfWorkersElement != null) {
                    int numberOfWorkersInstance;
                    numberOfWorkersInstance = DatatypeConverter.parseInt(numberOfWorkersElement.getTextContent());
                    result.setNumberOfWorkers(numberOfWorkersInstance);
                }
               
                Element workerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "WorkerSize");
                if (workerSizeElement != null) {
                    ServerFarmWorkerSize workerSizeInstance;
                    workerSizeInstance = ServerFarmWorkerSize.valueOf(workerSizeElement.getTextContent());
                    result.setWorkerSize(workerSizeInstance);
                }
               
                Element statusElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "Status");
                if (statusElement != null) {
                    ServerFarmStatus statusInstance;
                    statusInstance = ServerFarmStatus.valueOf(statusElement.getTextContent());
                    result.setStatus(statusInstance);
                }
            }
           
            result.setStatusCode(statusCode);
            if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
                result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
            }
           
            if (shouldTrace) {
                CloudTracing.exit(invocationId, result);
            }
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.management.websites.models.ServerFarmGetResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.