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

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


    @Test
    public void getWebSpaceSuccess() throws Exception {
        String webSpaceName = "eastuswebspace";

        // Act
        WebSpacesGetResponse webSpaceGetResponse = webSiteManagementClient.getWebSpacesOperations().get(webSpaceName);

        // Assert
        Assert.assertEquals(200, webSpaceGetResponse.getStatusCode());
        Assert.assertNotNull(webSpaceGetResponse.getRequestId());
       
        //Assert.assertEquals(3, webSpaceGetResponse.getCurrentNumberOfWorkers());
        //Assert.assertEquals(WebSpaceWorkerSize.Medium, webSpaceGetResponse.getCurrentWorkerSize());      
        //Assert.assertEquals("eastuswebspace", webSpaceGetResponse.getName()); 
//        Assert.assertEquals(WebSpaceStatus.Ready, webSpaceGetResponse.getStatus());
View Full Code Here


                }
                throw ex;
            }
           
            // Create Result
            WebSpacesGetResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new WebSpacesGetResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element webSpaceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "WebSpace");
            if (webSpaceElement != null) {
                Element availabilityStateElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "AvailabilityState");
                if (availabilityStateElement != null) {
                    WebSpaceAvailabilityState availabilityStateInstance;
                    availabilityStateInstance = WebSpaceAvailabilityState.valueOf(availabilityStateElement.getTextContent());
                    result.setAvailabilityState(availabilityStateInstance);
                }
               
                Element currentNumberOfWorkersElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "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());
                        result.setCurrentNumberOfWorkers(currentNumberOfWorkersInstance);
                    }
                }
               
                Element currentWorkerSizeElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "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());
                        result.setCurrentWorkerSize(currentWorkerSizeInstance);
                    }
                }
               
                Element geoLocationElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "GeoLocation");
                if (geoLocationElement != null) {
                    String geoLocationInstance;
                    geoLocationInstance = geoLocationElement.getTextContent();
                    result.setGeoLocation(geoLocationInstance);
                }
               
                Element geoRegionElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "GeoRegion");
                if (geoRegionElement != null) {
                    String geoRegionInstance;
                    geoRegionInstance = geoRegionElement.getTextContent();
                    result.setGeoRegion(geoRegionInstance);
                }
               
                Element nameElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement != null) {
                    String nameInstance;
                    nameInstance = nameElement.getTextContent();
                    result.setName(nameInstance);
                }
               
                Element planElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "Plan");
                if (planElement != null) {
                    String planInstance;
                    planInstance = planElement.getTextContent();
                    result.setPlan(planInstance);
                }
               
                Element statusElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "Status");
                if (statusElement != null) {
                    WebSpaceStatus statusInstance;
                    statusInstance = WebSpaceStatus.valueOf(statusElement.getTextContent());
                    result.setStatus(statusInstance);
                }
               
                Element subscriptionElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "Subscription");
                if (subscriptionElement != null) {
                    String subscriptionInstance;
                    subscriptionInstance = subscriptionElement.getTextContent();
                    result.setSubscription(subscriptionInstance);
                }
               
                Element workerSizeElement = XmlUtility.getElementByTagNameNS(webSpaceElement, "http://schemas.microsoft.com/windowsazure", "WorkerSize");
                if (workerSizeElement != null && (workerSizeElement.getTextContent() == null || workerSizeElement.getTextContent().isEmpty() == true) == false) {
                    WebSpaceWorkerSize workerSizeInstance;
                    workerSizeInstance = WebSpaceWorkerSize.valueOf(workerSizeElement.getTextContent());
                    result.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.WebSpacesGetResponse

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.