Starting working on

[Task #6119] Provide CatalogueResolver: get/resolve a link to a CKAN Entity

Incremented pom version at 1.9.0

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@135250 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-12-02 15:59:04 +00:00
parent 9f4671130d
commit 9a5e0679a8
13 changed files with 690 additions and 43 deletions

View File

@ -44,9 +44,19 @@
</Changeset>
<Changeset component="org.gcube.data-transfer.uri-resolver.1-7-0"
date="2016-06-09">
<Change>[Feature #4207] Uri Resolver upgrade: it must support new Geonetwork Manager
<Change>[Feature #4207] Uri Resolver upgrade: it must support new
Geonetwork Manager
</Change>
<Change>[Task #4250] Geonetwork Resolver upgrade: it must return only "private" Metadata Ids for CKAN harversting
<Change>[Task #4250] Geonetwork Resolver upgrade: it must return only
"private" Metadata Ids for CKAN harversting
</Change>
</Changeset>
<Changeset component="org.gcube.data-transfer.uri-resolver.1-8-0"
date="2016-10-26">
<Change>Removed scope provider from several resolver</Change>
</Changeset>
<Changeset component="org.gcube.data-transfer.uri-resolver.1-9-0"
date="2016-12-2">
<Change>[Task #6119] Provide CatalogueResolver: get/resolve a link to a CKAN Entity</Change>
</Changeset>
</ReleaseNotes>

View File

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>uri-resolver</artifactId>
<version>1.8.0-SNAPSHOT</version>
<version>1.9.0-SNAPSHOT</version>
<packaging>war</packaging>
<description>The URI Resolver is an HTTP URI resolver implemented as an HTTP servlet which gives access trough HTTP to different protocols URIs. </description>
@ -41,6 +41,13 @@
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-core</artifactId>

View File

@ -40,19 +40,22 @@ public class ApplicationProfileReader {
private String appId;
private String scope;
private ApplicationProfile applicationProfile;
private boolean useRootScope = false;
/**
* Instantiates a new application profile reader.
*
* @param scope - the scope to be searched
* @param secondaryType the secondary type
* @param portletClassName - the AppId of generic resource
* @param scope - the scope where to search the Application Profile
* @param secondaryType the secondary type of Application Profile
* @param portletClassName - the AppId of Generic Resource
* @param useRootScope the use root scope, if true the root scope is used to discovery the Application Profile, otherwise scope is used
*/
public ApplicationProfileReader(String scope, String secondaryType, String portletClassName) {
public ApplicationProfileReader(String scope, String secondaryType, String portletClassName, boolean useRootScope) {
this.scope = scope;
this.secondaryType = secondaryType;
this.appId = portletClassName;
this.useRootScope = useRootScope;
this.applicationProfile = readProfileFromInfrastrucure();
}
@ -79,15 +82,15 @@ public class ApplicationProfileReader {
try {
originalScope = ScopeProvider.instance.get();
String infra = ScopeUtil.getInfrastructureNameFromScope(scope);
ScopeProvider.instance.set(infra);
logger.info("Trying to fetch ApplicationProfile in the infra scope: "+infra+", SecondaryType: " + secondaryType + ", AppId: " + appId);
String discoveryScope = useRootScope?ScopeUtil.getInfrastructureNameFromScope(scope):scope;
ScopeProvider.instance.set(discoveryScope);
logger.info("Trying to fetch ApplicationProfile in the infra scope: "+discoveryScope+", SecondaryType: " + secondaryType + ", AppId: " + appId);
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType + ", AppId: " + appId +" is not registered in the infra scope: "+infra);
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType + ", AppId: " + appId +" is not registered in the infra scope: "+discoveryScope);
else {
String elem = appProfile.get(0);
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();

View File

@ -0,0 +1,76 @@
/**
*
*/
package org.gcube.datatransfer.resolver.catalogue;
import java.util.HashMap;
import java.util.Map;
/**
* The Class CatalogueEntityRequest.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Dec 2, 2016
*/
public class CatalogueEntityRequest {
Map<String,String> parameters = new HashMap<String, String>();
/**
* Instantiates a new catalogue entity request.
*/
public CatalogueEntityRequest() {
}
/**
* Adds the parameter to request.
*
* @param key the key
* @param value the value
*/
public void addParameterToRequest(String key, String value) {
this.parameters.put(key, value);
}
/**
* @return the parameters
*/
public Map<String, String> getParameters() {
return parameters;
}
/**
* Gets the value of parameter.
*
* @param key the key
* @return the value of parameter
*/
public String getValueOfParameter(String key) {
return this.parameters.get(key);
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CatalogueEntityRequest [parameters=");
builder.append(parameters);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,79 @@
/**
*
*/
package org.gcube.datatransfer.resolver.catalogue;
/**
* The Class CatalogueParameter.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Dec 2, 2016
*/
public class CatalogueParameter {
private String key;
private boolean mandatory;
/**
* Instantiates a new catalogue parameter.
*
* @param key the key
* @param mandatory the mandatory
*/
public CatalogueParameter(String key, boolean mandatory) {
this.key = key;
this.mandatory = mandatory;
}
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @return the mandatory
*/
public boolean isMandatory() {
return mandatory;
}
/**
* @param key the key to set
*/
public void setKey(String key) {
this.key = key;
}
/**
* @param mandatory the mandatory to set
*/
public void setMandatory(boolean mandatory) {
this.mandatory = mandatory;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CatalogueParameter [key=");
builder.append(key);
builder.append(", mandatory=");
builder.append(mandatory);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,45 @@
/**
*
*/
package org.gcube.datatransfer.resolver.catalogue;
/**
* The Interface CatalogueRequestParameter.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Dec 2, 2016
*/
public enum CatalogueRequestParameter {
GCUBE_SCOPE("gcube_scope",true),
ENTITY_CONTEXT("entity_context",true),
ENTITY_NAME("entity_name",true),
QUERY_STRING("query_string",false);
private String key;
private boolean mandatory;
/**
*
*/
private CatalogueRequestParameter(String key, boolean isMandatory) {
this.key = key;
this.mandatory = isMandatory;
}
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @return the mandatory
*/
public boolean isMandatory() {
return mandatory;
}
}

View File

@ -0,0 +1,239 @@
/**
*
*/
package org.gcube.datatransfer.resolver.catalogue;
import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.io.IOUtils;
import org.gcube.common.encryption.StringEncrypter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class GisResolver.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 7, 2016
*/
public class CatalogueResolver extends HttpServlet{
private static final long serialVersionUID = -8273405286016095823L;
private static final String TEXT_PALIN_CHARSET_UTF_8 = "text/palin;charset=UTF-8";
public static final String UTF_8 = "UTF-8";
/** The logger. */
private static final Logger logger = LoggerFactory.getLogger(CatalogueResolver.class);
/* (non-Javadoc)
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
/*String scope = cer.getValueOfParameter(CatalogueRequestParameter.GCUBE_SCOPE.getKey());
logger.info("Using scope "+scope+ " to search Ckan Portlet URL from IS");
ScopeProvider.instance.set(scope);
String ckanPorltetUrl = CkanPorltetApplicationProfile.getPortletUrlFromInfrastrucure();
if(ckanPorltetUrl == null || ckanPorltetUrl.isEmpty()){
sendError(null, HttpStatus.SC_INTERNAL_SERVER_ERROR, "An error occurred during discovery Data Catalogue URL, try again later");
return;
}*/
}
/* (non-Javadoc)
* @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
CatalogueEntityRequest cer = new CatalogueEntityRequest();
try{
String jsonRequest = IOUtils.toString(req.getInputStream());
// jsonRequest = "{" +
// "\"gcube_scope\" : \"/gcube\"," +
// "\"entity_context\" : \"dataset\"," +
// "\"entity_name\" : \"sarda-sarda\"" +
// "}";
//// String test = "{" +
//// "\"gcube_scope\" : \"/gcube\"," +
//// "\"entity_context\" : \"dataset\"," +
//// "\"entity_name\" : \"sarda-sarda\"," +
//// "\"query\" : {\"key1\" : \"value1\", \"key2\":\"value2\"}" +
//
//
//// "}";
logger.debug("Read json request: "+jsonRequest);
JSONObject inputJson = new JSONObject(jsonRequest);
for (CatalogueRequestParameter parameter : CatalogueRequestParameter.values()) {
try{
switch (parameter) {
case QUERY_STRING:
//TODO must be implemented
JSONArray queryString = inputJson.getJSONArray(parameter.getKey());
break;
default:
String value = inputJson.getString(parameter.getKey());
logger.debug("Read value: "+value+", for parameter: "+parameter.getKey());
cer.addParameterToRequest(parameter.getKey(), value);
break;
}
}catch(Exception e){
String error = "";
try {
if(parameter.isMandatory()){
error = parameter.getKey() +" not found";
sendError(null, HttpStatus.SC_BAD_REQUEST, error);
return;
}
else
logger.debug("Not Mandatory parameter: "+parameter.getKey()+", not found, I goes on");
}catch (IOException e1) {
//silent
}
}
}
}catch(JSONException e){
try {
logger.error("Json passed is malformed: ", e);
sendError(null, HttpStatus.SC_BAD_REQUEST, "Json passed is malformed");
}
catch (IOException e1) {
//silent
}
return;
}
try{
String buildLink = getServletContextURL(req);
String query = UrlEncoderUtil.encodeQuery(cer.getParameters());
logger.info("Builded query string: "+query);
String encriptedQuery = StringEncrypter.getEncrypter().encrypt(query);
logger.info("Encrypted query: "+encriptedQuery);
String encodedQuery = base64EncodeStringURLSafe(encriptedQuery);
buildLink+="?"+encodedQuery;
logger.info("Writing link: "+buildLink);
resp.setContentType(TEXT_PALIN_CHARSET_UTF_8);
resp.setCharacterEncoding(UTF_8);
resp.getWriter().write(buildLink);
}catch(Exception e){
try {
logger.error("An internal error is occurred: ", e);
sendError(null, HttpStatus.SC_INTERNAL_SERVER_ERROR, "An error occurred during generating Data Catalogue Link, try again later");
return;
}
catch (IOException e1) {
//silent
}
}
}
/**
* Send error.
*
* @param response the response
* @param status the status
* @param message the message
* @throws IOException Signals that an I/O exception has occurred.
*/
protected static void sendError(HttpServletResponse response, int status, String message) throws IOException{
logger.error("error message: "+message);
logger.info("writing response...");
if(response==null)
return;
response.setStatus(status);
StringReader sr = new StringReader(message);
IOUtils.copy(sr, response.getOutputStream());
logger.info("response writed");
response.flushBuffer();
}
/**
* Gets the servlet context url.
*
* @param req the req
* @return the servlet context url
*/
public String getServletContextURL(HttpServletRequest req) {
String scheme = req.getScheme(); // http
String serverName = req.getServerName(); // hostname.com
int serverPort = req.getServerPort(); // 80
String contextPath = req.getContextPath(); // /mywebapp
// Reconstruct original requesting URL
StringBuffer url = new StringBuffer();
url.append(scheme).append("://").append(serverName);
if (serverPort != 80 && serverPort != 443)
url.append(":").append(serverPort);
if(contextPath!=null)
url.append(":").append(contextPath);
String uToS = url.toString();
logger.debug("returning servlet context URL: "+uToS);
return uToS;
}
/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) {
}
/**
* Base64 encode string url safe.
*
* @param s the s
* @return the string
*/
public static String base64EncodeStringURLSafe(String s) {
try {
return Base64.encodeBase64URLSafeString(s.getBytes(UTF_8));
}
catch (UnsupportedEncodingException e) {
logger.error("Failed to decode the String", e);
logger.error("Returning input string: " + s);
return s;
}
}
}

View File

@ -0,0 +1,82 @@
/**
*
*/
package org.gcube.datatransfer.resolver.catalogue;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.StringReader;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datatransfer.resolver.applicationprofile.ApplicationProfileNotFoundException;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
/**
* The Class GetCkanPorltet.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Dec 2, 2016
*/
public class CkanPorltetApplicationProfile {
private static final Logger logger = LoggerFactory.getLogger(CkanPorltetApplicationProfile.class);
private final static String APPLICATION_PROFILE_NAME = "CkanPortlet";
/**
* Gets the portlet url from infrastrucure.
*
* @return the portlet url from infrastrucure
* @throws Exception
*/
public static String getPortletUrlFromInfrastrucure() throws Exception {
String scope = ScopeProvider.instance.get();
logger.debug("Trying to fetch applicationProfile profile from the infrastructure for " +
APPLICATION_PROFILE_NAME + " scope: " + scope);
try {
Query q =
new QueryBox(
"for $profile in collection('/db/Profiles/GenericResource')//Resource " +
"where $profile/Profile/SecondaryType/string() eq 'ApplicationProfile' and $profile/Profile/Name/string() " +
" eq '" +
APPLICATION_PROFILE_NAME +
"'" +
"return $profile");
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException(
"Your applicationProfile is not registered in the infrastructure");
else {
String elem = appProfile.get(0);
DocumentBuilder docBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
XPathHelper helper = new XPathHelper(node);
List<String> currValue = null;
currValue =
helper.evaluate("/Resource/Profile/Body/url/text()");
if (currValue != null && currValue.size() > 0) {
logger.debug("CKAN Portlet url found is " + currValue.get(0));
return currValue.get(0);
}
}
}
catch (Exception e) {
throw new Exception("Error while trying to fetch applicationProfile profile for name "+APPLICATION_PROFILE_NAME+"from the infrastructure, using scope: "+scope);
}
return null;
}
}

View File

@ -0,0 +1,87 @@
/**
*
*/
package org.gcube.datatransfer.resolver.catalogue;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* The Class UrlEncoderUtil.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Dec 2, 2016
*/
public class UrlEncoderUtil {
public static String charset = "UTF-8";
public static Logger logger = Logger.getLogger(UrlEncoderUtil.class);
/**
* Encode query.
*
* @param parameters the parameters
* @return the string
*/
public static String encodeQuery(String... parameters){
String query = "";
for (String string : parameters) {
try {
query+=URLEncoder.encode(string, charset)+"&";
} catch (UnsupportedEncodingException e) {
logger.error(e);
return query;
}
}
return removeLastChar(query);
}
/**
* Encode query.
*
* @param parameters the parameters
* @return the string
*/
public static String encodeQuery(Map<String, String> parameters){
String query = "";
if(parameters==null)
return query;
for (String key : parameters.keySet()) {
try {
query+=String.format(key+"=%s", URLEncoder.encode(parameters.get(key), charset))+"&";
} catch (UnsupportedEncodingException e) {
logger.error(e);
return query;
}
}
return removeLastChar(query);
}
/**
* Removes the last char.
*
* @param string the string
* @return the string
*/
public static String removeLastChar(String string){
if(string == null)
return null;
if(string.length()>0)
return string.substring(0, string.length()-1);
return string;
}
}

View File

@ -162,7 +162,7 @@ public class GisResolver extends HttpServlet{
if(gisViewerAppPropertyReader==null)
resetGisViewerAppEndPoint();
ApplicationProfileReader reader = new ApplicationProfileReader(scope, gisViewerAppPropertyReader.getGenericResource(), gisViewerAppPropertyReader.getAppId());
ApplicationProfileReader reader = new ApplicationProfileReader(scope, gisViewerAppPropertyReader.getGenericResource(), gisViewerAppPropertyReader.getAppId(), true);
String url = reader.getApplicationProfile().getUrl();
cachedGisViewerApplHostname.put(scope, url);
logger.info("Updated GisViewerApplication cache! Scope "+scope+" linking "+url);

View File

@ -266,23 +266,22 @@ public class HttpResolver extends HttpServlet {
doGet(request,response);
}
/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) {
String fileName = "COL_taxa.taf.gz";
String smpPath = "smp://Share/89971b8f-a993-4e7b-9a95-8d774cb68a99/Work+Packages/WP+6+-+Virtual+Research+Environments+Deployment+and+Operation/T6.2+Resources+and+Tools/COMET-Species-Matching-Engine/YASMEEN/1.2.0/Data/BiOnymTAF/COL_taxa.taf.gz";
try {
System.out.println(validateItemName(smpPath, fileName));
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// /**
// * The main method.
// *
// * @param args the arguments
// */
// public static void main(String[] args) {
//
// String fileName = "COL_taxa.taf.gz";
// String smpPath = "smp://Share/89971b8f-a993-4e7b-9a95-8d774cb68a99/Work+Packages/WP+6+-+Virtual+Research+Environments+Deployment+and+Operation/T6.2+Resources+and+Tools/COMET-Species-Matching-Engine/YASMEEN/1.2.0/Data/BiOnymTAF/COL_taxa.taf.gz";
// try {
// System.out.println(validateItemName(smpPath, fileName));
// }
// catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
}

View File

@ -21,6 +21,13 @@
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>catalogue</servlet-name>
<display-name>catalogue</display-name>
<servlet-class>org.gcube.datatransfer.resolver.catalogue.CatalogueResolver</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>id</servlet-name>
<display-name>id</display-name>
@ -34,7 +41,7 @@
<servlet-class>org.gcube.datatransfer.resolver.gis.GisResolver</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>geonetwork</servlet-name>
<display-name>geonetwork</display-name>
@ -52,14 +59,19 @@
<url-pattern>/gis</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>catalogue</servlet-name>
<url-pattern>/catalogue</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>id</servlet-name>
<url-pattern>/id</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>geonetwork</servlet-name>
<url-pattern>/geonetwork</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -1,6 +1,7 @@
import it.geosolutions.geonetwork.util.GNSearchRequest;
import it.geosolutions.geonetwork.util.GNSearchResponse;
import org.gcube.common.encryption.StringEncrypter;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
import org.gcube.spatial.data.geonetwork.GeoNetworkPublisher;
@ -9,7 +10,6 @@ import org.gcube.spatial.data.geonetwork.LoginLevel;
import org.gcube.spatial.data.geonetwork.configuration.Configuration;
import org.gcube.spatial.data.geonetwork.model.Account;
import org.gcube.spatial.data.geonetwork.model.Account.Type;
import org.junit.Test;
/**
*
@ -20,18 +20,18 @@ public class GeonetworkQueryTest {
private static final int MAX = 10;
private String[] scopes = {"/gcube/devsec"};
//private String[] scopes = {"/gcube/devNext/NextNext"};
private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab", "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab"};
private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab"};
private LoginLevel loginLevel = LoginLevel.SCOPE;
private LoginLevel loginLevel = LoginLevel.ADMIN;
private Type accountType = Type.CKAN;
private Type accountType = Type.SCOPE;
// @Test
//@Test
public void getCount() throws Exception{
try{
for(String scope:scopes){
for(String scope:scopesProd){
ScopeProvider.instance.set(scope);
GeoNetworkPublisher reader=GeoNetwork.get();
@ -39,12 +39,20 @@ public class GeonetworkQueryTest {
Configuration config = reader.getConfiguration();
Account account=config.getScopeConfiguration().getAccounts().get(accountType);
System.out.println("User: "+account.getUser()+", Pwd: "+account.getPassword());
//System.out.println("User: "+account.getUser()+", Pwd: "+account.getPassword());
System.out.println("Admin: "+config.getAdminAccount().getUser()+", Pwd: "+config.getAdminAccount().getPassword());
try{
String decryptedPassword = StringEncrypter.getEncrypter().decrypt(account.getPassword());
System.out.println("Decrypted Password: "+decryptedPassword);
}catch(Exception e){
System.out.println("ignoring exception during pwd decrypting");
}
// req.addParam("keyword", "Thredds");
final GNSearchRequest req=new GNSearchRequest();
req.addParam(GNSearchRequest.Param.any,"Thredds");
// req.addParam(GNSearchRequest.Param.any,"Thredds");
GNSearchResponse resp = reader.query(req);
int publicCount=resp.getCount();
reader.login(loginLevel);
@ -74,7 +82,7 @@ public class GeonetworkQueryTest {
}
@Test
// @Test
public void getCountProd() throws Exception{
try{
for(String scope:scopesProd){