use of com.thinkbiganalytics.metadata.api.project.Project in project kylo by Teradata.
the class JcrProjectProviderTest method testFindProjectByName.
@Test(dependsOnMethods = "testCreateProject2")
public void testFindProjectByName() {
metadata.read(() -> {
Optional<Project> optional = projProvider.findProjectByName("Project2");
assertThat(optional.isPresent()).isTrue();
Project project = optional.get();
assertThat(project).extracting(Project::getSystemName, Project::getProjectName, Project::getDescription, Project::getContainerImage).containsExactly("ProjectName2", "Project Name 2", "This is a fully defined project", "kylo/nonExistentContainer");
}, MetadataAccess.SERVICE);
}
use of com.thinkbiganalytics.metadata.api.project.Project in project kylo by Teradata.
the class JcrProjectProviderTest method afterClass.
@AfterClass
public void afterClass() {
metadata.commit(() -> {
Collection<Project> projects = projProvider.getProjects();
for (Project project : projects) {
logger.info("Deleting remaing project '{}' after tests completed.", project);
projProvider.deleteProject(project);
}
}, MetadataAccess.SERVICE);
}
use of com.thinkbiganalytics.metadata.api.project.Project in project kylo by Teradata.
the class JcrProjectProviderTest method testCreateProject.
@Test
public void testCreateProject() throws Exception {
metadata.commit(() -> {
Project pj1 = this.projProvider.ensureProject("Project1");
assertThat(pj1).isNotNull();
/*Session session = metadata.getActiveSession();
JcrTools tools = new JcrTools();
tools.setDebug(true);
try {
tools.printSubgraph(session.getRootNode().getNode("metadata"));
} catch (RepositoryException e) {
e.printStackTrace();
}*/
}, MetadataAccess.SERVICE);
}
use of com.thinkbiganalytics.metadata.api.project.Project in project kylo by Teradata.
the class JcrProjectProviderTest method testCreateProject2.
@Test
public void testCreateProject2() throws Exception {
metadata.commit(() -> {
Project pj1 = this.projProvider.ensureProject("Project2");
assertThat(pj1).isNotNull();
pj1.setSystemName("ProjectName2");
pj1.setProjectName("Project Name 2");
pj1.setDescription("This is a fully defined project");
pj1.setContainerImage("kylo/nonExistentContainer");
}, MetadataAccess.SERVICE);
}
use of com.thinkbiganalytics.metadata.api.project.Project in project kylo by Teradata.
the class JcrProjectProvider method getMyEditableProjects.
@Override
public List<Project> getMyEditableProjects() {
UsernamePrincipal user = JcrMetadataAccess.getActiveUser();
logger.debug("user={}", user);
List<Project> projects = getProjects();
return projects.stream().filter(prj -> {
try {
prj.getAllowedActions().checkPermission(ProjectAccessControl.EDIT_PROJECT);
return true;
} catch (AccessControlException ace) {
return false;
}
}).collect(Collectors.toList());
}
Aggregations