use of jenkins.scm.api.metadata.ObjectMetadataAction in project blueocean-plugin by jenkinsci.
the class CachesTest method testBranchCacheLoaderWithNoPrimaryInstanceMetadataAction.
@Test
public void testBranchCacheLoaderWithNoPrimaryInstanceMetadataAction() throws Exception {
ObjectMetadataAction metadataAction = new ObjectMetadataAction("A cool branch", "A very cool change", "http://example.com/branches/cool-branch");
when(job.getAction(ObjectMetadataAction.class)).thenReturn(metadataAction);
when(job.getFullName()).thenReturn("cool-branch");
Caches.BranchCacheLoader loader = new Caches.BranchCacheLoader(jenkins);
BranchImpl.Branch branch = loader.load(job.getFullName());
assertNotNull(branch);
assertFalse(branch.isPrimary());
assertEquals("http://example.com/branches/cool-branch", branch.getUrl());
}
use of jenkins.scm.api.metadata.ObjectMetadataAction in project blueocean-plugin by jenkinsci.
the class BranchMetadataTest method testBranchInfo.
@Test
public void testBranchInfo() {
assertNull(branch.getBranch());
ObjectMetadataAction oma = new ObjectMetadataAction("My Branch", "A feature branch", "https://path/to/branch");
when(job.getAction(ObjectMetadataAction.class)).thenReturn(oma);
when(job.getAction(PrimaryInstanceMetadataAction.class)).thenReturn(new PrimaryInstanceMetadataAction());
Caches.BRANCH_METADATA.invalidateAll();
assertEquals("https://path/to/branch", branch.getBranch().getUrl());
assertTrue(branch.getBranch().isPrimary());
}
use of jenkins.scm.api.metadata.ObjectMetadataAction in project blueocean-plugin by jenkinsci.
the class BranchMetadataTest method testGetURL.
@Test
public void testGetURL() {
assertNull(branch.getBranch());
ObjectMetadataAction oma = new ObjectMetadataAction("My Branch", "A feature branch", "https://path/to/branch");
when(job.getAction(ObjectMetadataAction.class)).thenReturn(oma);
Caches.BRANCH_METADATA.invalidateAll();
assertNotNull(branch.getBranch());
assertFalse(branch.getBranch().isPrimary());
assertEquals("https://path/to/branch", branch.getBranch().getUrl());
}
Aggregations