use of com.baidu.hugegraph.structure.auth.Project in project incubator-hugegraph-toolchain by apache.
the class ProjectAPI method addGraphs.
public Project addGraphs(Object projectId, Set<String> graphs) {
Project project = new Project();
project.graphs(graphs);
RestResult result = this.client.put(this.path(), formatEntityId(projectId), project, ImmutableMap.of("action", ACTION_ADD_GRAPH));
return result.readObject(Project.class);
}
use of com.baidu.hugegraph.structure.auth.Project in project incubator-hugegraph-toolchain by apache.
the class ProjectApiTest method createProject.
private static Project createProject(String name, Set<String> graphs) {
Project project = new Project(name);
project = api.create(project);
project = api.addGraphs(project.id(), graphs);
return project;
}
use of com.baidu.hugegraph.structure.auth.Project in project incubator-hugegraph-toolchain by apache.
the class ProjectApiTest method testAddGraph.
@Test
public void testAddGraph() {
Project project = createProject("project_test");
api.addGraphs(project, ImmutableSet.of("test_graph"));
project = getProject(project);
Assert.assertEquals(1, project.graphs().size());
Assert.assertTrue(project.graphs().contains("test_graph"));
api.addGraphs(project, ImmutableSet.of("test_graph1"));
project = getProject(project);
Assert.assertEquals(2, project.graphs().size());
Assert.assertTrue(project.graphs().contains("test_graph1"));
}
use of com.baidu.hugegraph.structure.auth.Project in project incubator-hugegraph-toolchain by apache.
the class ProjectApiTest method testCreate.
@Test
public void testCreate() {
Project paramsProject = new Project("project_test", "project_description");
Project createdProject = api.create(paramsProject);
Assert.assertEquals(paramsProject.name(), createdProject.name());
Assert.assertEquals(paramsProject.description(), createdProject.description());
}
use of com.baidu.hugegraph.structure.auth.Project in project incubator-hugegraph-toolchain by apache.
the class ProjectApiTest method testList.
@Test
public void testList() {
Project project1 = createProject("project_test1");
Project project2 = createProject("project_test2");
Project project3 = createProject("project_test3");
List<Project> allProject = api.list(API.NO_LIMIT);
Assert.assertTrue(allProject.contains(project1));
Assert.assertTrue(allProject.contains(project2));
Assert.assertTrue(allProject.contains(project3));
List<Project> projects = api.list(1);
Assert.assertEquals(1, projects.size());
Project project = projects.get(0);
Assert.assertTrue(StringUtils.isNotEmpty(project.adminGroup()));
Assert.assertTrue(StringUtils.isNotEmpty(project.opGroup()));
Assert.assertTrue(StringUtils.isNotEmpty(project.target()));
Assert.assertTrue(StringUtils.isNotEmpty(project.creator()));
Assert.assertNotNull(project.createTime());
Assert.assertNotNull(project.updateTime());
}
Aggregations