// Path: api/src/main/java/org/opennms/core/wsman/exceptions/InvalidResourceURI.java
// public class InvalidResourceURI extends SOAPFault {
//     private static final long serialVersionUID = 2596542137169661371L;
// 
//     public InvalidResourceURI(Throwable cause) {
//         super(cause);
//     }
// }
// 
// Path: api/src/main/java/org/opennms/core/wsman/exceptions/UnauthorizedException.java
// public class UnauthorizedException extends HTTPException {
//     private static final long serialVersionUID = 8958931434340638066L;
// 
//     public UnauthorizedException(Throwable cause) {
//         super(cause);
//     }
// }


import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.findAll;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.opennms.core.wsman.exceptions.InvalidResourceURI;
import org.opennms.core.wsman.exceptions.UnauthorizedException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.github.tomakehurst.wiremock.stubbing.Scenario;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mycila.xmltool.XMLDoc;
import com.mycila.xmltool.XMLTag;
            if (child.getLocalName() == null || child.getTextContent() == null) {
                continue;
            }

            map.put(child.getLocalName(), child.getTextContent());
        }
        return map;
    }

    @Test
    public void canGet() throws FileNotFoundException, IOException {
        stubFor(post(urlEqualTo("/wsman"))
                .willReturn(aResponse()
                    .withHeader("Content-Type", "Content-Type: application/soap+xml; charset=utf-8")
                    .withBodyFile("get-response.xml")));

        Map<String, String> selectors = Maps.newHashMap();
        selectors.put("CreationClassName", "DCIM_ComputerSystem");
        selectors.put("Name", "srv:system");
        Node node = client.get("http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_ComputerSystem", selectors);

        dumpRequestsToStdout();

        assertNotNull(node);

        XMLTag tag = XMLDoc.from(node, true);
        int primaryStatus = Integer.valueOf(tag.gotoChild("n1:PrimaryStatus").getText());
        assertEquals(1, primaryStatus);
    }

// Path: api/src/main/java/org/opennms/core/wsman/exceptions/InvalidResourceURI.java
// public class InvalidResourceURI extends SOAPFault {
//     private static final long serialVersionUID = 2596542137169661371L;
// 
//     public InvalidResourceURI(Throwable cause) {
//         super(cause);
//     }
// }
// 
// Path: api/src/main/java/org/opennms/core/wsman/exceptions/UnauthorizedException.java
// public class UnauthorizedException extends HTTPException {
//     private static final long serialVersionUID = 8958931434340638066L;
// 
//     public UnauthorizedException(Throwable cause) {
//         super(cause);
//     }
// }


// Path: itests/src/main/java/org/opennms/core/wsman/AbstractWSManClientIT.java
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.findAll;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.opennms.core.wsman.exceptions.InvalidResourceURI;
import org.opennms.core.wsman.exceptions.UnauthorizedException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.github.tomakehurst.wiremock.stubbing.Scenario;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mycila.xmltool.XMLDoc;
import com.mycila.xmltool.XMLTag;

            if (child.getLocalName() == null || child.getTextContent() == null) {
                continue;
            }

            map.put(child.getLocalName(), child.getTextContent());
        }
        return map;
    }

    @Test
    public void canGet() throws FileNotFoundException, IOException {
        stubFor(post(urlEqualTo("/wsman"))
                .willReturn(aResponse()
                    .withHeader("Content-Type", "Content-Type: application/soap+xml; charset=utf-8")
                    .withBodyFile("get-response.xml")));

        Map<String, String> selectors = Maps.newHashMap();
        selectors.put("CreationClassName", "DCIM_ComputerSystem");
        selectors.put("Name", "srv:system");
        Node node = client.get("http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_ComputerSystem", selectors);

        dumpRequestsToStdout();

        assertNotNull(node);

        XMLTag tag = XMLDoc.from(node, true);
        int primaryStatus = Integer.valueOf(tag.gotoChild("n1:PrimaryStatus").getText());
        assertEquals(1, primaryStatus);
    }

    @Test(expected=UnauthorizedException.class)