Package hudson.model

Examples of hudson.model.Hudson


     *
     * @throws Exception if so.
     */
    @Test
    public void testFromJson() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        MockUtils.mockMetadataValueDescriptors(hudson);
        String name = "nameTest";
        String description = "descrText";
        Calendar value = Calendar.getInstance();
        boolean exposed = true;
View Full Code Here


     *
     * @throws Exception if so.
     */
    @Test
    public void testToJson() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        MockUtils.mockMetadataValueDescriptors(hudson);
        String name = "nameTest";
        String description = "descrText";

        String stringName = "stringNameTest";
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test
    public void testFromJson() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        MockUtils.mockMetadataValueDescriptors(hudson);
        String name = "nameTest";
        String description = "descrText";
        boolean exposed = true;

View Full Code Here

     *
     * @return The mocked Hudson object.
     */
    public static Hudson mockHudson() {
        PowerMockito.mockStatic(Hudson.class);
        Hudson instance = PowerMockito.mock(Hudson.class);
        PowerMockito.when(Hudson.getInstance()).thenReturn(instance);
        when(instance.getInitLevel()).thenReturn(InitMilestone.STARTED);
        return instance;
    }
View Full Code Here

     *
     * @throws Exception if so and fail.
     */
    @Before
    public void prepareSomeStuff() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        MockUtils.mockMetadataValueDescriptors(hudson);

        container = mock(MetadataContainer.class);
        acl = PowerMockito.mock(ACL.class);
        when(container.getACL()).thenReturn(acl);
View Full Code Here

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

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoMetadataException.class)
    public void testGetContainerNoMetadataOnNode() 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);
        CliUtils.getContainer("theNode", null, null, false);
    }
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test()
    public void testGetContainerOnNode() 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);
        MetadataNodeProperty property = mock(MetadataNodeProperty.class);
        when(describableList.get(MetadataNodeProperty.class)).thenReturn(property);
        MetadataParent container = CliUtils.getContainer("theNode", null, null, false);
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoMetadataException.class)
    public void testGetContainerNoPropertiesOnNode() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        Node node = mock(Node.class);
        when(hudson.getNode("theNode")).thenReturn(node);
        when(node.getNodeProperties()).thenReturn(null);
        CliUtils.getContainer("theNode", null, null, false);
    }
View Full Code Here

     *
     * @throws Exception if so.
     */
    @Test(expected = CliUtils.NoMetadataException.class)
    public void testGetContainerNoPropertiesOnNodeCreate() throws Exception {
        Hudson hudson = MockUtils.mockHudson();
        Node node = mock(Node.class);
        when(hudson.getNode("theNode")).thenReturn(node);
        when(node.getNodeProperties()).thenReturn(null);
        CliUtils.getContainer("theNode", null, null, true);
    }
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.