Package com.sonyericsson.hudson.plugins.metadata.model

Examples of com.sonyericsson.hudson.plugins.metadata.model.MetadataJobProperty


     */
    @Test
    public void testDoUpdateTreeWithReplace() throws Exception {
        TreeNodeMetadataValue path = TreeStructureUtil.createPath("Bobby", "description", "owner", "name");
        TreeStructureUtil.addValue(path, "Admin", "What is the owner", "type");
        MetadataJobProperty myContainer = spy(new MetadataJobProperty());
        when(myContainer.getACL()).thenReturn(acl);
        myContainer.addChild(path);

        String replace = TreeStructureUtil.createPath("Tomas", "description", "owner", "name").toJson().toString();


        JSONObject expectedJson = new JSONObject();
        expectedJson.put("type", "ok");
        expectedJson.put("errorCode", 0);
        expectedJson.put("message", "OK");

        when(request.getParameter(eq("job"))).thenReturn(job);
        when(request.getParameter(eq("data"))).thenReturn(replace);
        when(request.getParameter(eq("replace"))).thenReturn("true");
        PowerMockito.when(CliUtils.getContainer(null, job, null, true)).thenReturn(myContainer);

        action.doUpdate(request, response);

        verify(response, atLeastOnce()).setContentType(eq(CONTENT_TYPE));
        verify(out).print(eq(expectedJson.toString()));

        assertEquals(1, myContainer.getChildren().size());
        assertEquals(2, ((TreeNodeMetadataValue)myContainer.getChild("owner")).getChildren().size());
        assertEquals("Tomas", TreeStructureUtil.getPath(myContainer, "owner", "name").getValue());
    }
View Full Code Here


    @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

TOP

Related Classes of com.sonyericsson.hudson.plugins.metadata.model.MetadataJobProperty

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.