git-svn-id: http://svn.research-infrastructures.eu/d4science/gcube/trunk/spatial-data/geonetwork@134220 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
56bed0b8ab
commit
faa020b51b
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.spatial.data.geonetwork.test;
|
package org.gcube.spatial.data.geonetwork.test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.spatial.data.geonetwork.GeoNetwork;
|
import org.gcube.spatial.data.geonetwork.GeoNetwork;
|
||||||
import org.gcube.spatial.data.geonetwork.GeoNetworkAdministration;
|
import org.gcube.spatial.data.geonetwork.GeoNetworkAdministration;
|
||||||
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
|
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
|
||||||
|
@ -16,21 +18,75 @@ import it.geosolutions.geonetwork.util.GNSearchRequest;
|
||||||
|
|
||||||
public class ScopeTests {
|
public class ScopeTests {
|
||||||
|
|
||||||
String[] scopes=new String[]{
|
// String[] scopes=new String[]{
|
||||||
// "/gcube",
|
//// "/gcube",
|
||||||
// "/gcube/devsec",
|
//// "/gcube/devsec",
|
||||||
// "/gcube/devsec/devVRE",
|
//// "/gcube/devsec/devVRE",
|
||||||
// "/gcube/devNext/NextNext"
|
//// "/gcube/devNext/NextNext"
|
||||||
|
//
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps/EcologicalModelling",
|
// "/d4science.research-infrastructures.eu/gCubeApps/EcologicalModelling",
|
||||||
"/d4science.research-infrastructures.eu/gCubeApps"
|
// "/d4science.research-infrastructures.eu/gCubeApps"
|
||||||
|
//
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
private static ArrayList<String> scopes=new ArrayList<String>();
|
||||||
|
static{
|
||||||
|
scopes.add("/gcube/devsec");
|
||||||
|
|
||||||
|
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/InfraScience");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ICES_TCRE");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/TabularDataLab");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/FARM/AquaMaps");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/PGFA-UFMT");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/FARM");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/EuBrazilOpenBio");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/EcologicalModelling");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-PSC");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ENVRIPlus");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ENVRI");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BOBLME_HilsaAWG");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ScalableDataMining");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/DESCRAMBLE");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/FAO_TunaAtlas");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/StocksAndFisheriesKB");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BlueCommons");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ICES_TCSSM");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BlueBRIDGE-EAB");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ARIADNE");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/OpenIt");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/AquacultureAtlasGeneration");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/Parthenos");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/IGDI");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/EGIEngage");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/RStudioLab");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/TimeSeries");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/TCom");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ICCAT_BFT-E");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/SoBigData.it");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BlueBridgeProject");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BlueUptake");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/gCube");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/KnowledgeBridging");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/EFG");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/StockAssessment");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/iSearch");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/ICOS_ETC");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/VesselActivitiesAnalyzer");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/BiOnym");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/SoBigData.eu");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/PerformanceEvaluationInAquaculture");
|
||||||
|
// scopes.add("/d4science.research-infrastructures.eu/gCubeApps/StrategicInvestmentAnalysis");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUtils(){
|
public void testUtils(){
|
||||||
|
|
||||||
for(String scope:scopes){
|
for(String scope:scopes){
|
||||||
TokenSetter.set(scope);
|
TokenSetter.set(scope);
|
||||||
System.out.println("Setted scope "+scope);
|
System.out.println("Setted scope "+scope);
|
||||||
|
@ -38,7 +94,7 @@ public class ScopeTests {
|
||||||
System.out.println("Parents"+ScopeUtils.getParentScopes());
|
System.out.println("Parents"+ScopeUtils.getParentScopes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConfigs() throws MissingConfigurationException, MissingServiceEndpointException, Exception{
|
public void testConfigs() throws MissingConfigurationException, MissingServiceEndpointException, Exception{
|
||||||
for(String scope:scopes){
|
for(String scope:scopes){
|
||||||
|
@ -50,20 +106,20 @@ public class ScopeTests {
|
||||||
System.out.println("CKAN : "+account.getUser()+" "+account.getPassword());;
|
System.out.println("CKAN : "+account.getUser()+" "+account.getPassword());;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration config=GeoNetwork.get().getConfiguration();
|
Configuration config=GeoNetwork.get().getConfiguration();
|
||||||
System.out.println(config.getAdminAccount().getUser()+" "+config.getAdminAccount().getPassword());
|
System.out.println(config.getAdminAccount().getUser()+" "+config.getAdminAccount().getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGNUsersAndGroups() throws Exception{
|
public void testGNUsersAndGroups() throws Exception{
|
||||||
TokenSetter.set(scopes[0]);
|
TokenSetter.set(scopes.get(0));
|
||||||
GeoNetworkAdministration admin=GeoNetwork.get();
|
GeoNetworkAdministration admin=GeoNetwork.get();
|
||||||
admin.login(LoginLevel.ADMIN);
|
admin.login(LoginLevel.ADMIN);
|
||||||
System.out.println(admin.getGroups());
|
System.out.println(admin.getGroups());
|
||||||
System.out.println(admin.getUsers());
|
System.out.println(admin.getUsers());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getCount() throws Exception{
|
public void getCount() throws Exception{
|
||||||
for(String scope:scopes){
|
for(String scope:scopes){
|
||||||
|
@ -72,10 +128,10 @@ public class ScopeTests {
|
||||||
final GNSearchRequest req=new GNSearchRequest();
|
final GNSearchRequest req=new GNSearchRequest();
|
||||||
req.addParam(GNSearchRequest.Param.any,"");
|
req.addParam(GNSearchRequest.Param.any,"");
|
||||||
int publicCount=reader.query(req).getCount();
|
int publicCount=reader.query(req).getCount();
|
||||||
|
|
||||||
reader.login(LoginLevel.CKAN);
|
reader.login(LoginLevel.CKAN);
|
||||||
int totalCount=reader.query(req).getCount();
|
int totalCount=reader.query(req).getCount();
|
||||||
|
|
||||||
reader.login(LoginLevel.ADMIN);
|
reader.login(LoginLevel.ADMIN);
|
||||||
int existingCount=reader.query(req).getCount();
|
int existingCount=reader.query(req).getCount();
|
||||||
System.out.println("SCOPE "+scope+" found "+totalCount+" (public access : "+publicCount+", local +"+(totalCount-publicCount)+", existing in instance : "+existingCount+")");
|
System.out.println("SCOPE "+scope+" found "+totalCount+" (public access : "+publicCount+", local +"+(totalCount-publicCount)+", existing in instance : "+existingCount+")");
|
||||||
|
|
Loading…
Reference in New Issue