Package hudson.model

Examples of hudson.model.Hudson


     *
     * @throws Exception if so.
     */
    @Test
    public void testGetContainerNoMetadataOnNodeCreate() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        Node node = mock(Node.class);
        when(hudson.getNode("theNode")).thenReturn(node);
        DescribableList describableList = mock(DescribableList.class);
        when(node.getNodeProperties()).thenReturn(describableList);
        when(describableList.get(MetadataNodeProperty.class)).thenReturn(null);
        MetadataParent container = CliUtils.getContainer("theNode", null, null, true);
        assertNotNull(container);
View Full Code Here


     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoItemException.class)
    public void testGetContainerNoJob() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        when(hudson.getItem("fake")).thenReturn(null);
        CliUtils.getContainer(null, "fake", null, false);
    }
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test
    public void testGetContainerJob() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        FreeStyleProject project = mock(FreeStyleProject.class);
        when(hudson.getItem("fake")).thenReturn(project);
        MetadataJobProperty property = mock(MetadataJobProperty.class);
        when(project.getProperty(MetadataJobProperty.class)).thenReturn(property);
        MetadataParent<MetadataValue> container = CliUtils.getContainer(null, "fake", null, false);
        assertNotNull(container);
        assertSame(property, container);
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoItemException.class)
    public void testGetContainerItemButNoJob() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        TopLevelItem itemMock = mock(TopLevelItem.class);
        when(hudson.getItem("fake")).thenReturn(itemMock);
        CliUtils.getContainer(null, "fake", null, false);
    }
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoMetadataException.class)
    public void testGetContainerNoMetadataOnJob() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        FreeStyleProject project = mock(FreeStyleProject.class);
        when(hudson.getItem("theJob")).thenReturn(project);
        when(project.getProperty(MetadataJobProperty.class)).thenReturn(null);

        CliUtils.getContainer(null, "theJob", null, false);
    }
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoMetadataException.class)
    public void testGetContainerNoMetadataOnMatrixJob() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        MatrixProject project = mock(MatrixProject.class);
        when(hudson.getItem("theJob")).thenReturn(project);
        when(project.getProperty(MetadataJobProperty.class)).thenReturn(null);

        CliUtils.getContainer(null, "theJob", null, false);
    }
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test
    public void testGetContainerNoMetadataOnJobCreate() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        FreeStyleProject project = mock(FreeStyleProject.class);
        when(hudson.getItem("theJob")).thenReturn(project);
        when(project.getProperty(MetadataJobProperty.class)).thenReturn(null);
        MetadataParent<MetadataValue> container = CliUtils.getContainer(null, "theJob", null, true);
        assertNotNull(container);

        verify(project).addProperty(Matchers.<JobProperty>same((JobProperty)container));
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoMetadataException.class)
    public void testGetContainerNoMetadataOnBuild() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        FreeStyleProject project = mock(FreeStyleProject.class);
        when(hudson.getItem("theJob")).thenReturn(project);
        FreeStyleBuild build = mock(FreeStyleBuild.class);
        when(project.getBuildByNumber(1)).thenReturn(build);
        when(build.getAction(MetadataBuildAction.class)).thenReturn(null);


View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test()
    public void testGetContainerOnBuild() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        FreeStyleProject project = mock(FreeStyleProject.class);
        when(hudson.getItem("theJob")).thenReturn(project);
        FreeStyleBuild build = mock(FreeStyleBuild.class);
        when(project.getBuildByNumber(1)).thenReturn(build);
        MetadataBuildAction action = mock(MetadataBuildAction.class);
        when(build.getAction(MetadataBuildAction.class)).thenReturn(action);

View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoItemException.class)
    public void testGetContainerNoBuild() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        FreeStyleProject project = mock(FreeStyleProject.class);
        when(hudson.getItem("theJob")).thenReturn(project);
        when(project.getBuildByNumber(10)).thenReturn(null);

        CliUtils.getContainer(null, "theJob", 10, false);
    }
View Full Code Here

TOP

Related Classes of hudson.model.Hudson

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.