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

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


     */
    public void testMatrixConfiguration() throws Exception {
        MatrixProject matrix = this.createMatrixProject("myMatrix");
        matrix.getAxes().add(new TextAxis("Test1", "one", "two"));
        matrix.getAxes().add(new TextAxis("Test2", "A", "B"));
        MetadataJobProperty property = new MetadataJobProperty();
        property.addChild(TreeStructureUtil.createPath("hello", "my matrix description", false, false,
                "the", "world", "says"));
        matrix.addProperty(property);
        configRoundtrip(matrix);

        //give the controller some time to work on the separate thread
View Full Code Here


        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);
        }
        MetadataJobProperty metadataJobProperty = (MetadataJobProperty)property;
        metadataJobProperty.addChild(tree);

        FreeStyleBuild build = buildAndAssertSuccess(project);
        MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
        assertNotNull(action);
View Full Code Here

        FreeStyleProject project2 = createFreeStyleProject();
        List<MetadataValue> list = new LinkedList<MetadataValue>();
        StringMetadataValue value = new StringMetadataValue("name", "description", "value");
        list.add(value);

        MetadataJobProperty property = project.getProperty(MetadataJobProperty.class);
        assertNotNull(property);
        property.addChildren(list);
        MetadataViewJobFilter filter = new MetadataViewJobFilter("name=value");
        List<TopLevelItem> items = Hudson.getInstance().getItems();
        List<TopLevelItem> filter1 = filter.filter(null, items, Hudson.getInstance().getPrimaryView());
        assertEquals(2, items.size());
        assertEquals(1, filter1.size());
View Full Code Here

        FreeStyleProject project = createFreeStyleProject("open");
        FreeStyleProject project2 = createFreeStyleProject("secure");
        List<MetadataValue> list = new LinkedList<MetadataValue>();
        StringMetadataValue value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property = project.getProperty(MetadataJobProperty.class);
        property.addChildren(list);
        list = new LinkedList<MetadataValue>();
        value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property2 = project2.getProperty(MetadataJobProperty.class);
        property2.addChildren(list);

        MetadataViewJobFilter filter = new MetadataViewJobFilter("name=value");

        ListView view = new ListView("Test", hudson);
        view.getJobFilters().add(filter);
View Full Code Here

        FreeStyleProject project = createFreeStyleProject("open");
        FreeStyleProject project2 = createFreeStyleProject("secure");
        List<MetadataValue> list = new LinkedList<MetadataValue>();
        StringMetadataValue value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property = project.getProperty(MetadataJobProperty.class);
        property.addChildren(list);
        list = new LinkedList<MetadataValue>();
        value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property2 = project2.getProperty(MetadataJobProperty.class);
        property2.addChildren(list);

        //First search without ACL
        WebClient web = createWebClient();
        doTestSearch(web, "name=value", 2);
View Full Code Here

        if (action == null) {
            action = new MetadataBuildAction();
            build.addAction(action);
        }

        MetadataJobProperty metadataJobProperty = (MetadataJobProperty)property;
        logger.finest("Starting job to build metadata conversion.");
        for (MetadataValue value : metadataJobProperty.getChildren()) {
            try {
                action.addChild(value.clone());
            } catch (CloneNotSupportedException e) {
                listener.getLogger().println(
                        Messages.BuildContributorsController_LogMessage_CopyFailure(e.getMessage()));
View Full Code Here

    public List<TopLevelItem> searchQuery(List<TopLevelItem> all) throws Exception {
        List<TopLevelItem> matchedItems = new LinkedList<TopLevelItem>();
        for (TopLevelItem item : all) {
            if (item instanceof AbstractProject) {
                AbstractProject project = (AbstractProject)item;
                MetadataJobProperty property =
                        (MetadataJobProperty)project.getProperty(MetadataJobProperty.class);
                if (property != null) {
                    CommonTreeNodeStream nodes = new CommonTreeNodeStream(queryTree);
                    QueryWalker walker = new QueryWalker(nodes);
                    boolean matchStatus = walker.evaluate(property);
View Full Code Here

            if (!project.getRootDir().exists()) {
                return;
            }

            MetadataJobProperty property = getOrCreateProperty();
            if (property == null) {
                return;
            }

            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()) {
                    TreeStructureUtil.addValue(combinationNode, axis.getValue(), "", "axis", axis.getKey());
                }
                jobInfo.addChild(matrixNode);
            }
            logger.finer("Adding standard generated metadata");
            property.addChild(jobInfo);

            ExtensionList<JobMetadataContributor> contributors = JobMetadataContributor.all();
            for (JobMetadataContributor contributor : contributors) {
                List<MetadataValue> dataFor = contributor.getMetaDataFor(project);
                if (dataFor != null && !dataFor.isEmpty()) {
                    Collection<MetadataValue> leftover = property.addChildren(dataFor);
                    logger.warning("Failed to add the following contributor's[" + contributor + "] metadata to "
                            + project + "\n"
                            + TreeStructureUtil.prettyPrint(leftover, "\t"));
                }
            }
View Full Code Here

         * Finds the metadata property for the current project. If none is found a new gets created.
         *
         * @return the property for the current project.
         */
        private MetadataJobProperty getOrCreateProperty() {
            MetadataJobProperty property = (MetadataJobProperty)project.getProperty(MetadataJobProperty.class);
            if (property == null) {
                if (project.getParent() instanceof AbstractProject) {
                    property = createPropertyFromParent((AbstractProject)project.getParent());
                } else {
                    property = new MetadataJobProperty();
                }
                try {
                    project.addProperty(property);
                } catch (IOException e) {
                    logger.log(Level.SEVERE, "Failed to add the MetadataJobProperty to the project " + project, e);
View Full Code Here

         *
         * @param parent the parent containing metadata to inherit.
         * @return the property filled with goodies.
         */
        private MetadataJobProperty createPropertyFromParent(AbstractProject parent) {
            MetadataJobProperty property = new MetadataJobProperty();
            MetadataJobProperty parentProps = (MetadataJobProperty)parent.getProperty(MetadataJobProperty.class);
            if (parentProps != null) {
                if (logger.isLoggable(Level.FINER)) {
                    logger.log(Level.FINER, "Parent is a project with metadata, copy all user values"
                            + " from [{0}] to [{1}]",
                            new Object[]{project.getParent(), project});
                }
                property.addChildren(parentProps.getUserValues());
            }
            return property;
        }
View Full Code Here

TOP

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

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.