@GET @Path("all") @Produces(MediaType.APPLICATION_JSON) public UsersUI getAllUsers() throws IOException { final UsersUI users = new UsersUI(); for (final User userConfig : userService.getAllUsers(null)) { final UserName userName = new UserName(userConfig.getUserName()); users.add(new UserUI(new UserResourcePath(userName), userName, userConfig)); } return users; }
private CheckPoint checkPoint() throws Exception { CheckPoint checkPoint = new CheckPoint(); NamespaceService namespaceService = newNamespaceService(); UserService userService = l(UserService.class); JobsService jobsService = l(JobsService.class); checkPoint.sources = namespaceService.getSources(); checkPoint.spaces = namespaceService.getSpaces(); checkPoint.homes = namespaceService.getHomeSpaces(); checkPoint.users = Arrays.asList(Iterables.toArray(userService.getAllUsers(10000), User.class)); checkPoint.datasets = Lists.newArrayList(); checkPoint.virtualDatasetVersions = Lists.newArrayList(); checkPoint.accelerations = Lists.newArrayList(); /** DX-4498 for (NamespaceKey ds : namespaceService.getAllDatasets(new NamespaceKey(""))) { DatasetConfig datasetConfig = namespaceService.getDataset(ds); checkPoint.datasets.add(datasetConfig); checkPoint.virtualDatasetVersions.addAll( Arrays.asList(Iterables.toArray(datasetService.getAllVersions(new DatasetPath(ds.getPathComponents())), VirtualDatasetUI.class))); if (datasetConfig.getAccelerationId() != null) { checkPoint.accelerations.add(accelerationService.getAccelerationById(new AccelerationId(datasetConfig.getAccelerationId()))); } } */ checkPoint.jobs = ImmutableList.copyOf(jobsService.getAllJobs(null, null, null, 0, Integer.MAX_VALUE, "tshiran")); return checkPoint; }
@Before public void setup() throws Exception { clearAllDataExceptUser(); final UserService userService = l(UserService.class); // clear test users for (User userConfig: userService.getAllUsers(10000)) { if (userConfig.getUserName().startsWith(USERNAME_PREFIX)) { try { userService.deleteUser(userConfig.getUserName(), userConfig.getVersion()); } catch (UserNotFoundException e) { // ignore search index may have user thats not in kvstore. } } } }