use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getFolderPipelineTest.
@Test
public void getFolderPipelineTest() throws IOException {
MockFolder folder = j.createFolder("folder1");
Project p = folder.createProject(FreeStyleProject.class, "test1");
Map response = get("/organizations/jenkins/pipelines/folder1/pipelines/test1");
validatePipeline(p, response);
}
use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method findAllPipelineTest.
@Test
public void findAllPipelineTest() throws IOException, ExecutionException, InterruptedException {
MockFolder folder1 = j.createFolder("folder1");
j.createFolder("afolder");
Project p1 = folder1.createProject(FreeStyleProject.class, "test1");
MockFolder folder2 = folder1.createProject(MockFolder.class, "folder2");
folder1.createProject(MockFolder.class, "folder3");
folder2.createProject(FreeStyleProject.class, "test2");
FreeStyleBuild b1 = (FreeStyleBuild) p1.scheduleBuild2(0).get();
List<Map> resp = get("/search?q=type:pipeline", List.class);
assertEquals(6, resp.size());
}
use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getPipelineTest.
@Test
public void getPipelineTest() throws IOException {
Project p = j.createFreeStyleProject("pipeline1");
Map<String, Object> response = get("/organizations/jenkins/pipelines/pipeline1");
validatePipeline(p, response);
String clazz = (String) response.get("_class");
response = get("/classes/" + clazz + "/");
assertNotNull(response);
List<String> classes = (List<String>) response.get("classes");
assertTrue(classes.contains("hudson.model.Job") && !classes.contains("org.jenkinsci.plugins.workflow.job.WorkflowJob") && !classes.contains("io.jenkins.blueocean.rest.model.BlueBranch"));
}
use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method PipelineSecureWithLoggedInUserPermissionTest.
@Test
public void PipelineSecureWithLoggedInUserPermissionTest() throws IOException, UnirestException {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
hudson.model.User user = User.get("alice");
user.setFullName("Alice Cooper");
MockFolder folder = j.createFolder("folder1");
Project p = folder.createProject(FreeStyleProject.class, "test1");
String token = getJwtToken(j.jenkins, "alice", "alice");
assertNotNull(token);
Map response = new RequestBuilder(baseUrl).get("/organizations/jenkins/pipelines/folder1/pipelines/test1").jwtToken(token).build(Map.class);
validatePipeline(p, response);
Map<String, Boolean> permissions = (Map<String, Boolean>) response.get("permissions");
assertTrue(permissions.get("create"));
assertTrue(permissions.get("start"));
assertTrue(permissions.get("stop"));
assertTrue(permissions.get("read"));
}
use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method deletePipelineTest.
/**
* TODO: latest stapler change broke delete, disabled for now
*/
@Test
@Ignore
public void deletePipelineTest() throws IOException {
Project p = j.createFreeStyleProject("pipeline1");
delete("/organizations/jenkins/pipelines/pipeline1/");
assertNull(j.jenkins.getItem(p.getName()));
}
Aggregations