Package hudson.util

Examples of hudson.util.DescribableList$Owner


        f.setAccessible( true );
        f.set( publisher.getDescriptor(), "ashlux@gmail.com" );
       
        build =  mock(AbstractBuild.class);
        AbstractProject project = mock(AbstractProject.class);
        DescribableList publishers = mock(DescribableList.class);
        when(publishers.get(ExtendedEmailPublisher.class)).thenReturn(publisher);
        when(project.getPublishersList()).thenReturn(publishers);
        when(build.getProject()).thenReturn(project);
    }
View Full Code Here


            list.add(getMapper().fromDBObject(optionalExtraInfo.getSubClass(), dbObj, getMapper().createEntityCache()));
        }

        Saveable owner = null; // TODO figure out how to associate the deserialized project here

        return new DescribableList(owner, list);
    }
View Full Code Here

    @Override
    public Object encode(Object value, MappedField optionalExtraInfo) {
        if (value == null) return null;

        DescribableList describableList = (DescribableList) value;

        BasicDBList convertedList = new BasicDBList();

        for(Object obj : describableList.toList()) {
            convertedList.add(getMapper().toDBObject(obj));
        }

        return convertedList;
    }
View Full Code Here

    @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

    @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);
        assertNotNull(container);
        assertSame(property, container);
    }
View Full Code Here

    @Test
    public void testGetContainerNoMetadataOnNodeCreate() 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);
        MetadataParent container = CliUtils.getContainer("theNode", null, null, true);
        assertNotNull(container);

        verify(describableList).add(same(container));
        assertSame(node, Whitebox.getInternalState(container, "node"));
View Full Code Here

          LOG.info("unable to launch job "+jn+", because it's not a Project, but just "+it.getClass());
      }else{
        // TODO 8: would like to have AbstractProject here, but it doesn't have BuildWrappers.
          Project p = (Project)it;
       
        DescribableList wrappers = p.getBuildWrappersList();
        JenkowBuildWrapper wrapper = new JenkowBuildWrapper();
        if (!wrappers.contains(wrapper.getDescriptor())) wrappers.add(wrapper);
       
        p.scheduleBuild2(jenkins.getQuietPeriod(),new WorkflowCause("triggered by workflow"),ja);
        return;
      }
    }
View Full Code Here

    public HealthReport getBuildHealth() {
        if (health != null) {
            return health;
        }
        //try to get targets from root project (for maven modules targets are null)
        DescribableList rootpublishers = owner.getProject().getRootProject().getPublishersList();

        if (rootpublishers != null) {
            CoberturaPublisher publisher = (CoberturaPublisher) rootpublishers.get(CoberturaPublisher.class);
            if (publisher != null) {
                healthyTarget = publisher.getHealthyTarget();
                unhealthyTarget = publisher.getUnhealthyTarget();
            }
        }
View Full Code Here

    /**
     * Verify {@link DescribableListProjectProperty#getDefaultValue()} method.
     */
    @Test
    public void testGetDefaultValue() {
        DescribableList defaultValue = property.getDefaultValue();
        assertNotNull(defaultValue);
        //Default value should be initialized and stored as original value
        assertTrue(property.getOriginalValue() == defaultValue);
        assertFalse(property.isOverridden());
    }
View Full Code Here

     * Verify {@link CopyOnWriteListProjectProperty#getOriginalValue()} method.
     */
    @Test
    public void testGetOriginalValue() {
        //Original value is not initialized. Default value will be used instead. Shouldn't be null
        DescribableList originalValue = property.getOriginalValue();
        assertNotNull(originalValue);
        //Value was set, so return it without modification
        assertTrue(originalValue == property.getOriginalValue());
    }
View Full Code Here

TOP

Related Classes of hudson.util.DescribableList$Owner

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.