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

Examples of com.microsoft.windowsazure.management.websites.models.ServerFarmListResponse$ServerFarm


    @Test
    public void listServerFarmSuccess() throws Exception {
        String webSpaceName = "eastuswebspace";
      
        // Act
        ServerFarmListResponse serverFarmListResponse = webSiteManagementClient.getServerFarmsOperations().list(webSpaceName);

        // Assert
        Assert.assertEquals(200, serverFarmListResponse.getStatusCode());
        Assert.assertNotNull(serverFarmListResponse.getRequestId());
       
         ArrayList<ServerFarmListResponse.ServerFarm> serverFarmslist = serverFarmListResponse.getServerFarms();
           for (ServerFarmListResponse.ServerFarm serverFarm : serverFarmslist) {
                // Assert              
             Assert.assertNotNull(serverFarm.getCurrentWorkerSize());
             Assert.assertEquals("Default1", serverFarm.getName())
             Assert.assertNotNull(serverFarm.getStatus());
View Full Code Here


                }
                throw ex;
            }
           
            // Create Result
            ServerFarmListResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new ServerFarmListResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element serverFarmsSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServerFarms");
            if (serverFarmsSequenceElement != null) {
                for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serverFarmsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ServerFarm").size(); i1 = i1 + 1) {
                    org.w3c.dom.Element serverFarmsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serverFarmsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ServerFarm").get(i1));
                    ServerFarmListResponse.ServerFarm serverFarmInstance = new ServerFarmListResponse.ServerFarm();
                    result.getServerFarms().add(serverFarmInstance);
                   
                    Element currentNumberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "CurrentNumberOfWorkers");
                    if (currentNumberOfWorkersElement != null) {
                        int currentNumberOfWorkersInstance;
                        currentNumberOfWorkersInstance = DatatypeConverter.parseInt(currentNumberOfWorkersElement.getTextContent());
                        serverFarmInstance.setCurrentNumberOfWorkers(currentNumberOfWorkersInstance);
                    }
                   
                    Element currentWorkerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "CurrentWorkerSize");
                    if (currentWorkerSizeElement != null) {
                        ServerFarmWorkerSize currentWorkerSizeInstance;
                        currentWorkerSizeInstance = ServerFarmWorkerSize.valueOf(currentWorkerSizeElement.getTextContent());
                        serverFarmInstance.setCurrentWorkerSize(currentWorkerSizeInstance);
                    }
                   
                    Element nameElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "Name");
                    if (nameElement != null) {
                        String nameInstance;
                        nameInstance = nameElement.getTextContent();
                        serverFarmInstance.setName(nameInstance);
                    }
                   
                    Element numberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "NumberOfWorkers");
                    if (numberOfWorkersElement != null) {
                        int numberOfWorkersInstance;
                        numberOfWorkersInstance = DatatypeConverter.parseInt(numberOfWorkersElement.getTextContent());
                        serverFarmInstance.setNumberOfWorkers(numberOfWorkersInstance);
                    }
                   
                    Element workerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "WorkerSize");
                    if (workerSizeElement != null) {
                        ServerFarmWorkerSize workerSizeInstance;
                        workerSizeInstance = ServerFarmWorkerSize.valueOf(workerSizeElement.getTextContent());
                        serverFarmInstance.setWorkerSize(workerSizeInstance);
                    }
                   
                    Element statusElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "Status");
                    if (statusElement != null) {
                        ServerFarmStatus statusInstance;
                        statusInstance = ServerFarmStatus.valueOf(statusElement.getTextContent());
                        serverFarmInstance.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.ServerFarmListResponse$ServerFarm

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.