package org.gcube.portlets.widgets.ckandatapublisherwidget.client; import java.util.ArrayList; import java.util.List; import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.exceptions.UserNotFoundException; import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException; import eu.trentorise.opendata.jackan.CheckedCkanClient; import eu.trentorise.opendata.jackan.CkanClient; import eu.trentorise.opendata.jackan.model.CkanUser; public class Tests { //@Test public static void test() throws WorkspaceFolderNotFoundException, InternalErrorException, HomeNotFoundException, UserNotFoundException { // String username ="costantino.perciante"; // ScopeProvider.instance.set("/gcube/devsec/devVRE"); // // Workspace ws = HomeLibrary // .getHomeManagerFactory() // .getHomeManager() // .getHome(username).getWorkspace(); // // System.out.println("Created workspace reference"); // // WorkspaceFolder rootFolder = ws.getRoot(); // System.out.println("Root folder has id " + rootFolder.getId()); // // List children = rootFolder.getChildren(); // // for (WorkspaceItem workspaceItem : children) { // System.out.println("Children with name " + workspaceItem.getName() + " and id " + workspaceItem.getId()); // } // get the url and the api key of the user String ckanPortalUrl = "https://ckan-d-d4s.d4science.org/"; String apiKey = "803ada7f-2080-493f-8a99-3e593e880d94"; List result = new ArrayList(); CheckedCkanClient checkedClient = new CheckedCkanClient(ckanPortalUrl, apiKey); CkanClient client = new CkanClient(ckanPortalUrl); List list = client.getUserList(); for (CkanUser ckanUser : list) { System.out.println("User -> " + ckanUser.getId() + " with fullname " + ckanUser.getFullname() + " and name " + ckanUser.getName() + " password " + ckanUser.getPassword()); } } public static void main(String[] args) { // try { // test(); // } catch (WorkspaceFolderNotFoundException | InternalErrorException // | HomeNotFoundException | UserNotFoundException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } } }