package org.gcube.datatransfer.test; //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; //import org.gcube.spatial.data.geonetwork.GeoNetworkReader; //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.opengis.metadata.Metadata; // //import it.geosolutions.geonetwork.util.GNSearchRequest; //import it.geosolutions.geonetwork.util.GNSearchResponse; // ///** // * // * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it // * Aug 31, 2016 // */ //public class GeonetworkQueryTest { // // private static final int MAX = 10; // // private static final String UUID = "8a878105-ef06-4b1f-843f-120fc525b22b"; // // //private String[] scopesProd = {"/gcube/devsec/devVRE"}; // // //private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps/SIASPA"}; // // //private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps/fisheriesandecosystematmii"}; // // //private String[] scopesProd = {"/d4science.research-infrastructures.eu/D4Research"}; // // //private String[] scopesProd = {"/d4science.research-infrastructures.eu"}; // // //private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas"}; // // //private String[] scopesProd = {"/d4science.research-infrastructures.eu/D4Research/Blue-Datathon"}; // private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab"}; // // private LoginLevel loginLevel = LoginLevel.CKAN; // // private Type accountType = Type.SCOPE; // // private String textToSearch = "geo_fea"; // // //@Test // public void getCount() throws Exception{ // try{ // for(String scope:scopesProd){ // ScopeProvider.instance.set(scope); // GeoNetworkPublisher reader=GeoNetwork.get(); // // Configuration config = reader.getConfiguration(); // Account account=config.getScopeConfiguration().getAccounts().get(accountType); // // //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"); // GNSearchResponse resp = reader.query(req); // int publicCount=resp.getCount(); // reader.login(loginLevel); // int totalCount=reader.query(req).getCount(); // System.out.println("SCOPE "+scope+" found "+totalCount+" (public : "+publicCount+", private :"+(totalCount-publicCount)+")"); // if(totalCount==0) // return; // /*try{ // int last = totalCount>MAX?totalCount:MAX; // for(int i=0; iMAX?totalCount:MAX; //// //// for(int i=0; i