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

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


        FreeStyleProject project = createFreeStyleProject("test1");
        project.getBuildersList().add(new SleepBuilder(1000));

        FreeStyleBuild build = buildAndAssertSuccess(project);

        MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
        assertNotNull(action);
        StringMetadataValue value = (StringMetadataValue)TreeStructureUtil.getPath(action, "build", "result");
        assertNotNull(value);
        assertEquals(Result.SUCCESS.toString(), value.getValue());
        assertNotNull(TreeStructureUtil.getPath(action, "build", "duration", "display"));
View Full Code Here


        }
        MetadataJobProperty metadataJobProperty = (MetadataJobProperty)property;
        metadataJobProperty.addChild(tree);

        FreeStyleBuild build = buildAndAssertSuccess(project);
        MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
        assertNotNull(action);

        StringMetadataValue buildValue = (StringMetadataValue)TreeStructureUtil.getPath(action, "tree", "string");
        StringMetadataValue jobValue = (StringMetadataValue)TreeStructureUtil.
                getPath(metadataJobProperty, "tree", "string");
View Full Code Here

    private static final Logger logger = Logger.getLogger(BuildContributorsController.class.getName());

    @Override
    public void onCompleted(AbstractBuild build, TaskListener listener) {
        logger.entering(BuildContributorsController.class.getName(), "onCompleted({0})", build);
        MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
        if (action == null) {
            action = new MetadataBuildAction();
            build.addAction(action);
        }
        listener.getLogger().println(Messages.BuildContributorsController_LogMessage_Collecting());
        logger.finest("Starting collection.");
        ExtensionList<BuildMetadataContributor> contributors = BuildMetadataContributor.all();
        for (BuildMetadataContributor contributor : contributors) {
            List<MetadataValue> values = contributor.getMetaDataFor(build);
            Collection<MetadataValue> leftovers = action.addChildren(values);
            if (leftovers != null && !leftovers.isEmpty()) {
                String pretty = "\n" + TreeStructureUtil.prettyPrint(leftovers, "\t");
                listener.getLogger().println(
                        Messages.BuildContributorsController_LogMessage_LeftOvers(pretty));
                logger.warning("Some metadata failed to be merged for build " + build + pretty);
View Full Code Here

        AbstractProject project = build.getProject();
        JobProperty property = project.getProperty(MetadataJobProperty.class);
        if (property == null) {
            return;
        }
        MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
        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()));
                logger.warning("Could not copy the job metadata: " + e.getMessage());
            }
View Full Code Here

            if (item != null && item instanceof AbstractProject) {
                AbstractProject project = (AbstractProject)item;
                if (build != null && build >= 0) {
                    Run buildByNumber = project.getBuildByNumber(build);
                    if (buildByNumber != null) {
                        MetadataBuildAction action = buildByNumber.getAction(MetadataBuildAction.class);
                        if (action != null) {
                            container = action;
                        } else if (createContainer) {
                            action = new MetadataBuildAction();
                            buildByNumber.addAction(action);
                            container = action;
                        } else {
                            throw new NoMetadataException("Build #" + build + " of job "
                                    + job + " has no associated metadata.");
View Full Code Here

        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);


        MetadataParent<MetadataValue> container = CliUtils.getContainer(null, "theJob", 1, false);
        assertNotNull(container);
View Full Code Here

TOP

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

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.