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

Examples of com.sonyericsson.hudson.plugins.metadata.model.values.TreeNodeMetadataValue


     */
    public void testJobToBuildMetadataConversion() throws Exception {
        FreeStyleProject project = createFreeStyleProject("test1");
        project.getBuildersList().add(new Shell("echo hej"));
        JobProperty property = project.getProperty(MetadataJobProperty.class);
        TreeNodeMetadataValue tree =
                TreeStructureUtil.createPath("value", "description", false, false, "tree", "string");

        if (property == null) {
            property = new MetadataJobProperty();
            project.addProperty(property);
View Full Code Here


            }

            cleanGeneratedValues(property);

            TreeNodeMetadataValue[] tree = TreeStructureUtil.createTreePath("", "job-info", "last-saved");
            TreeNodeMetadataValue jobInfo = tree[0];
            TreeNodeMetadataValue lastSaved = tree[1];
            TreeStructureUtil.addValue(lastSaved, Calendar.getInstance(), "", true, false, "time");
            TreeStructureUtil.addValue(lastSaved, currentUser.getDisplayName(), "", "user", "display-name");
            TreeStructureUtil.addValue(lastSaved, currentUser.getFullName(), "", "user", "full-name");
            if (project instanceof MatrixConfiguration) {
                logger.log(Level.FINER, "Adding matrix combination data for {0}", project);
                MatrixConfiguration configuration = (MatrixConfiguration)project;
                TreeNodeMetadataValue[] path = TreeStructureUtil.createTreePath("", "matrix", "combination");
                TreeNodeMetadataValue matrixNode = path[0];
                TreeNodeMetadataValue combinationNode = path[1];
                Combination combination = configuration.getCombination();
                //ToString version of the combination in job-info.matrix.combination.value
                TreeStructureUtil.addValue(combinationNode, combination.toString(',', ':'), "", "value");
                //Each axis in job-info.matrix.combination.[name]=[value]
                for (Map.Entry<String, String> axis : combination.entrySet()) {
View Full Code Here

     * Sets up a tree of values and one of definitions, to simulate a real environment.
     */
    @Before
    public void setup() {
        TreeNodeMetadataValue[] startTree = TreeStructureUtil.createTreePath("", "root", "child1");
        TreeNodeMetadataValue treeValue = startTree[0];
        TreeStructureUtil.addValue(treeValue, "nonDefaultVal", "", "child1", "child12");
        values = new LinkedList<MetadataValue>();
        values.add(treeValue);
        StringMetadataDefinition stringDef = new StringMetadataDefinition("child12", "defaultVal");
        TreeNodeMetadataDefinition subTreeDef = new TreeNodeMetadataDefinition("child1");
View Full Code Here

     * @throws Exception if so.
     */
    @Test
    public void testBuildEnvironmentFor() throws Exception {

        TreeNodeMetadataValue allShouldBeExposed = new TreeNodeMetadataValue("allExposed", "");
        allShouldBeExposed.setExposeToEnvironment(true);
        StringMetadataValue exposedParentExposed = new StringMetadataValue(
                "exposedParentExposed", "", "exposedParentExposedValue", true);
        StringMetadataValue notExposedParentExposed = new StringMetadataValue(
                "notExposedParentExposed", "", "notExposedParentExposedValue", false);
        allShouldBeExposed.addChild(exposedParentExposed);
        allShouldBeExposed.addChild(notExposedParentExposed);

        TreeNodeMetadataValue allShouldNotBeExposed = new TreeNodeMetadataValue("notAllExposed", "");
        StringMetadataValue exposedParentNotExposed = new StringMetadataValue(
                "exposedParentNotExposed", "", "exposedParentNotExposedValue", true);
        StringMetadataValue notExposedParentNotExposed = new StringMetadataValue(
                "notExposedParentNotExposed", "", "notExposedParentNotExposedValue", false);
        allShouldBeExposed.addChild(exposedParentExposed);
        allShouldBeExposed.addChild(notExposedParentExposed);
        allShouldNotBeExposed.addChild(exposedParentNotExposed);
        allShouldNotBeExposed.addChild(notExposedParentNotExposed);

        MetadataBuildAction buildAction = new MetadataBuildAction();
        buildAction.addChild(allShouldBeExposed);
        buildAction.addChild(allShouldNotBeExposed);

View Full Code Here

        return list;
    }

    @Override
    public synchronized AbstractMetadataValue createValue(Object o) {
        TreeNodeMetadataValue val = new TreeNodeMetadataValue(this.getName(), this.getDescription());
        if (o instanceof MetadataValue) {
            val.addChild((MetadataValue)o);
        }
        val.setExposeToEnvironment(isExposedToEnvironment());
        return val;
    }
View Full Code Here

@Extension
public class StandardBuildMetadataContributor extends BuildMetadataContributor {

    @Override
    public List<MetadataValue> getMetaDataFor(AbstractBuild build) {
        TreeNodeMetadataValue buildNode = TreeStructureUtil.createPath(build.getResult().toString(), "",
                "build", "result");
        AbstractMetadataValue mdv = new NumberMetadataValue("ms", build.getDuration());
        mdv.setGenerated(true);
        TreeStructureUtil.addValue(buildNode, mdv, "duration");
        mdv = new StringMetadataValue("display", build.getDurationString());
View Full Code Here

     * @return the metadata.
     */
    private List<MetadataValue> getModuleData(MavenModule module) {
        ModuleName moduleName = module.getModuleName();
        TreeNodeMetadataValue[] path = TreeStructureUtil.createTreePath(null, "maven", "module");
        TreeNodeMetadataValue moduleNode = path[1];
        TreeStructureUtil.addValue(moduleNode, moduleName.groupId, "", "groupId");
        TreeStructureUtil.addValue(moduleNode, moduleName.artifactId, "", "artifactId");
        List<MetadataValue> list = new LinkedList<MetadataValue>();
        list.add(path[0]);
        return list;
View Full Code Here

     *
     * @throws Exception if so.
     */
    @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);

View Full Code Here

     */
    @Test
    public void testDoGet() throws Exception {

        StringMetadataValue metadataValue = new StringMetadataValue("owner", "bobby");
        TreeNodeMetadataValue node = new TreeNodeMetadataValue("container",
                Collections.<MetadataValue>singletonList(metadataValue));

        JSONObject jsonObject = node.toJson();

        when(request.getParameter(eq("job"))).thenReturn(job);
        PowerMockito.when(CliUtils.getContainer(null, job, null, false)).thenReturn(container);
        when(container.toJson()).thenReturn(jsonObject);

View Full Code Here

TOP

Related Classes of com.sonyericsson.hudson.plugins.metadata.model.values.TreeNodeMetadataValue

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.