use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getPipelinesExtensionTest.
@Test
public void getPipelinesExtensionTest() throws Exception {
Project p = j.createProject(TestProject.class, "pipeline1");
j.assertBuildStatusSuccess(p.scheduleBuild2(0));
Map<String, Object> response = get("/organizations/jenkins/pipelines/pipeline1");
validatePipeline(p, response);
assertEquals("hello world!", response.get("hello"));
assertNotNull(response.get("latestRun"));
Map latestRun = (Map) response.get("latestRun");
assertEquals("pipeline1", latestRun.get("pipeline"));
assertEquals("TestBuild", latestRun.get("type"));
}
use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class ProfileApiTest method createUserFavouriteTest.
// TODO: migrate to FavoritesApiTest after PR receives initial approval (trying to cut down on PR noise)
@Test
public void createUserFavouriteTest() throws Exception {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
hudson.model.User user = User.get("alice");
user.setFullName("Alice Cooper");
Project p = j.createFreeStyleProject("pipeline1");
// String token = getJwtToken(j.jenkins,"alice", "alice");
Map map = new RequestBuilder(baseUrl).put("/organizations/jenkins/pipelines/pipeline1/favorite").authAlice().data(ImmutableMap.of("favorite", true)).build(Map.class);
validatePipeline(p, (Map) map.get("item"));
List l = new RequestBuilder(baseUrl).get("/users/" + user.getId() + "/favorites/").authAlice().build(List.class);
assertEquals(1, l.size());
Map pipeline = (Map) ((Map) l.get(0)).get("item");
validatePipeline(p, pipeline);
String href = getHrefFromLinks((Map) l.get(0), "self");
assertEquals("/blue/rest/organizations/jenkins/pipelines/pipeline1/favorite/", href);
map = new RequestBuilder(baseUrl).put(href.substring("/blue/rest".length())).authAlice().data(ImmutableMap.of("favorite", false)).build(Map.class);
validatePipeline(p, (Map) map.get("item"));
l = new RequestBuilder(baseUrl).get("/users/" + user.getId() + "/favorites/").authAlice().build(List.class);
assertEquals(0, l.size());
new RequestBuilder(baseUrl).get("/users/" + user.getId() + "/favorites/").auth("bob", "bob").status(403).build(String.class);
}
use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class BlueTrendTest method testTrendsIdCollision.
@Test
public void testTrendsIdCollision() throws Exception {
// verify the extension did register correctly
ExtensionList<BlueTrendFactory> extensionList = ExtensionList.lookup(BlueTrendFactory.class);
Assert.assertEquals(2, extensionList.size());
Project project = j.createProject(FreeStyleProject.class, "freestyle1");
BlueOrganization org = new OrganizationImpl("jenkins", j.jenkins);
BluePipeline pipeline = new AbstractPipelineImpl(org, project);
BlueTrendContainer trends = pipeline.getTrends();
BlueTrend trend = trends.get("junit");
Assert.assertEquals("junit", trend.getId());
Assert.assertEquals("JUnit", trend.getDisplayName());
}
use of hudson.model.Project in project blueocean-plugin by jenkinsci.
the class BlueTrendsApiTest method getTrendsListFreestyle.
@Test
public void getTrendsListFreestyle() throws IOException {
Project p = j.createProject(FreeStyleProject.class, "freestyle1");
List response = new RequestBuilder(baseUrl).get("/organizations/jenkins/pipelines/" + p.getName() + "/trends/").build(List.class);
Assert.assertNotNull(response);
}
use of hudson.model.Project in project violations-plugin by jenkinsci.
the class ViolationsReport method getLiveConfig.
/**
* get the configuration for this job.
*
* @return the configuration of the job.
*/
public ViolationsConfig getLiveConfig() {
AbstractProject<?, ?> abstractProject = build.getProject();
if (abstractProject instanceof Project) {
Project project = (Project) abstractProject;
ViolationsPublisher publisher = (ViolationsPublisher) project.getPublisher(ViolationsPublisher.DESCRIPTOR);
return publisher == null ? null : publisher.getConfig();
}
return null;
}
Aggregations