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

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


    }
   
    @Test
    public void listWebSpaceSuccess() throws Exception {
        // Act
        WebSpacesListResponse webSpacesListResponse = webSiteManagementClient.getWebSpacesOperations().list();
        // Assert
        Assert.assertEquals(200,  webSpacesListResponse.getStatusCode());
        Assert.assertNotNull( webSpacesListResponse.getRequestId());

        ArrayList<WebSpacesListResponse.WebSpace> webSpacelist = webSpacesListResponse.getWebSpaces();
        for (WebSpacesListResponse.WebSpace  webspace : webSpacelist) {
            Assert.assertNotNull(webspace.getAvailabilityState());
            Assert.assertNotNull(webspace.getName());
        }
    }
View Full Code Here


                }
                throw ex;
            }
           
            // Create Result
            WebSpacesListResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new WebSpacesListResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element webSpacesSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "WebSpaces");
            if (webSpacesSequenceElement != null) {
                for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(webSpacesSequenceElement, "http://schemas.microsoft.com/windowsazure", "WebSpace").size(); i1 = i1 + 1) {
                    org.w3c.dom.Element webSpacesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(webSpacesSequenceElement, "http://schemas.microsoft.com/windowsazure", "WebSpace").get(i1));
                    WebSpacesListResponse.WebSpace webSpaceInstance = new WebSpacesListResponse.WebSpace();
                    result.getWebSpaces().add(webSpaceInstance);
                   
                    Element availabilityStateElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "AvailabilityState");
                    if (availabilityStateElement != null) {
                        WebSpaceAvailabilityState availabilityStateInstance;
                        availabilityStateInstance = WebSpaceAvailabilityState.valueOf(availabilityStateElement.getTextContent());
                        webSpaceInstance.setAvailabilityState(availabilityStateInstance);
                    }
                   
                    Element currentNumberOfWorkersElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "CurrentNumberOfWorkers");
                    if (currentNumberOfWorkersElement != null && (currentNumberOfWorkersElement.getTextContent() == null || currentNumberOfWorkersElement.getTextContent().isEmpty() == true) == false) {
                        boolean isNil = false;
                        Attr nilAttribute = currentNumberOfWorkersElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                        if (nilAttribute != null) {
                            isNil = "true".equals(nilAttribute.getValue());
                        }
                        if (isNil == false) {
                            int currentNumberOfWorkersInstance;
                            currentNumberOfWorkersInstance = DatatypeConverter.parseInt(currentNumberOfWorkersElement.getTextContent());
                            webSpaceInstance.setCurrentNumberOfWorkers(currentNumberOfWorkersInstance);
                        }
                    }
                   
                    Element currentWorkerSizeElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "CurrentWorkerSize");
                    if (currentWorkerSizeElement != null && (currentWorkerSizeElement.getTextContent() == null || currentWorkerSizeElement.getTextContent().isEmpty() == true) == false) {
                        boolean isNil2 = false;
                        Attr nilAttribute2 = currentWorkerSizeElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                        if (nilAttribute2 != null) {
                            isNil2 = "true".equals(nilAttribute2.getValue());
                        }
                        if (isNil2 == false) {
                            WebSpaceWorkerSize currentWorkerSizeInstance;
                            currentWorkerSizeInstance = WebSpaceWorkerSize.valueOf(currentWorkerSizeElement.getTextContent());
                            webSpaceInstance.setCurrentWorkerSize(currentWorkerSizeInstance);
                        }
                    }
                   
                    Element geoLocationElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "GeoLocation");
                    if (geoLocationElement != null) {
                        String geoLocationInstance;
                        geoLocationInstance = geoLocationElement.getTextContent();
                        webSpaceInstance.setGeoLocation(geoLocationInstance);
                    }
                   
                    Element geoRegionElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "GeoRegion");
                    if (geoRegionElement != null) {
                        String geoRegionInstance;
                        geoRegionInstance = geoRegionElement.getTextContent();
                        webSpaceInstance.setGeoRegion(geoRegionInstance);
                    }
                   
                    Element nameElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "Name");
                    if (nameElement != null) {
                        String nameInstance;
                        nameInstance = nameElement.getTextContent();
                        webSpaceInstance.setName(nameInstance);
                    }
                   
                    Element planElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "Plan");
                    if (planElement != null) {
                        String planInstance;
                        planInstance = planElement.getTextContent();
                        webSpaceInstance.setPlan(planInstance);
                    }
                   
                    Element statusElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "Status");
                    if (statusElement != null) {
                        WebSpaceStatus statusInstance;
                        statusInstance = WebSpaceStatus.valueOf(statusElement.getTextContent());
                        webSpaceInstance.setStatus(statusInstance);
                    }
                   
                    Element subscriptionElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "Subscription");
                    if (subscriptionElement != null) {
                        String subscriptionInstance;
                        subscriptionInstance = subscriptionElement.getTextContent();
                        webSpaceInstance.setSubscription(subscriptionInstance);
                    }
                   
                    Element workerSizeElement = XmlUtility.getElementByTagNameNS(webSpacesElement, "http://schemas.microsoft.com/windowsazure", "WorkerSize");
                    if (workerSizeElement != null && (workerSizeElement.getTextContent() == null || workerSizeElement.getTextContent().isEmpty() == true) == false) {
                        WebSpaceWorkerSize workerSizeInstance;
                        workerSizeInstance = WebSpaceWorkerSize.valueOf(workerSizeElement.getTextContent());
                        webSpaceInstance.setWorkerSize(workerSizeInstance);
                    }
                }
            }
           
            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.WebSpacesListResponse

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.