use of io.jenkins.blueocean.rest.factory.BlueOceanUrlMapper in project blueocean-plugin by jenkinsci.
the class StatePreloaderTest method test.
@Test
public void test() throws IOException, ExecutionException, InterruptedException, SAXException {
// Create a project and run a build on it.
FreeStyleProject freestyleProject = j.createProject(FreeStyleProject.class, "freestyle");
FreeStyleBuild run = freestyleProject.scheduleBuild2(0).get();
j.waitForCompletion(run);
// Lets request the activity page for that project. The page should
// contain some prefetched javascript for the pipeline
// details + the runs on the page
Assert.assertTrue(BlueOceanUrlMapper.all().size() > 0);
BlueOceanUrlMapper mapper = BlueOceanUrlMapper.all().get(0);
String projectBlueUrl = j.jenkins.getRootUrl() + mapper.getUrl(freestyleProject);
Document doc = Jsoup.connect(projectBlueUrl + "/activity/").get();
String script = doc.select("head script").toString();
Assert.assertTrue(script.contains(String.format("setState('prefetchdata.%s',", PipelineStatePreloader.class.getSimpleName())));
Assert.assertTrue(script.contains(String.format("setState('prefetchdata.%s',", PipelineActivityStatePreloader.class.getSimpleName())));
Assert.assertTrue(script.contains("\"restUrl\":\"/blue/rest/organizations/jenkins/pipelines/freestyle/runs/?start=0&limit=26\""));
}
Aggregations