use of com.baidu.hugegraph.structure.auth.Project in project incubator-hugegraph-toolchain by apache.
the class ProjectApiTest method testRemoveGraph.
@Test
public void testRemoveGraph() {
Set<String> graphs = ImmutableSet.of("test_graph1", "test_graph2", "test_graph3");
Project project = createProject("project_test", graphs);
graphs = new HashSet<>(graphs);
Assert.assertTrue(graphs.containsAll(project.graphs()));
project = api.removeGraphs(project, ImmutableSet.of("test_graph1"));
graphs.remove("test_graph1");
Assert.assertTrue(graphs.containsAll(project.graphs()));
project = api.removeGraphs(project, ImmutableSet.of("test_graph2"));
graphs.remove("test_graph2");
Assert.assertTrue(graphs.containsAll(project.graphs()));
project = api.removeGraphs(project, ImmutableSet.of("test_graph3"));
graphs.remove("test_graph3");
Assert.assertEquals(0, graphs.size());
Assert.assertNull(project.graphs());
}
use of com.baidu.hugegraph.structure.auth.Project in project incubator-hugegraph-toolchain by apache.
the class AuthManager method deleteAll.
public void deleteAll() {
for (Belong belong : this.listBelongs()) {
this.deleteBelong(belong.id());
}
for (Access access : this.listAccesses()) {
this.deleteAccess(access.id());
}
for (User user : this.listUsers()) {
if (user.name().equals("admin")) {
continue;
}
this.deleteUser(user.id());
}
for (Group group : this.listGroups()) {
this.deleteGroup(group.id());
}
for (Target target : this.listTargets()) {
this.deleteTarget(target.id());
}
for (Project project : this.listProjects()) {
Set<String> graphs = project.graphs();
if (CollectionUtils.isNotEmpty(graphs)) {
this.projectRemoveGraphs(project.id(), graphs);
}
this.deleteProject(project.id());
}
}
Aggregations