X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fesr-server.git;a=blobdiff_plain;f=esr-mgr%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fesr%2Fexternalservice%2Faai%2FAaiCommon.java;h=25ed596ce227e5050c10db169a3ba221c5440eec;hp=c2088a14e6f91ae2f499c4348515bbe4cae1bb75;hb=9770fc1f6ba50a4607f248f37c100785007ba7e1;hpb=fa6dd60a45a093205ae55065f6de044c91493e60 diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java index c2088a1..25ed596 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java @@ -15,48 +15,18 @@ */ package org.onap.aai.esr.externalservice.aai; -import java.io.IOException; -import java.io.StringReader; -import com.sun.jersey.api.client.ClientResponse; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - public class AaiCommon { + + private AaiCommon() { + + } + + private static String AaiAuthenticationUser = "AAI"; + private static String AAI_AUTHENTICATION_PAASWORD = "AAI"; - private static String AAI_AUTHENTICATION_USER = "AAI"; - private static String AAI_AUTHENTICATION_PAASWORD = "AAI"; - private static String RESOURCE_VERSION_PARAM = "resource-version"; - -// public String getAuthenticationCredentials() { -// String usernameAndPassword = AAI_AUTHENTICATION_USER + ":" -// + AAI_AUTHENTICATION_PAASWORD; -// return "Basic " + java.util.Base64.getEncoder().encodeToString("AAI:AAI".getBytes()); -// } - - public String getResourceVersion(ClientResponse response) - throws ParserConfigurationException, SAXException, IOException { - String respData = response.getEntity(String.class); - - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - InputSource is = new InputSource(new StringReader(respData)); - Document doc = builder.parse(is); - - NodeList nodeList = doc.getDocumentElement().getChildNodes(); - for (int i = 0; i < nodeList.getLength(); i++) { - Node currentNode = nodeList.item(i); - if (currentNode.getNodeName().equals(RESOURCE_VERSION_PARAM)) { - return currentNode.getTextContent(); - } + public static String getAuthenticationCredentials() { + String usernameAndPassword = AaiAuthenticationUser + ":" + AAI_AUTHENTICATION_PAASWORD; + return "Basic " + java.util.Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()); } - return null; - } }