use of org.hudsonci.model.project.property.ExternalProjectProperty in project hudson-2.x by hudson.
the class DescribableListUtilTest method testConvertToProjectProperties3.
@Test
public void testConvertToProjectProperties3() throws IOException {
Hudson hudson = createMock(Hudson.class);
Mailer.DescriptorImpl descriptor = createMock(Mailer.DescriptorImpl.class);
String mailerName = "hudson-tasks-Mailer";
expect(descriptor.getJsonSafeClassName()).andReturn(mailerName);
expect(hudson.getDescriptorOrDie(Mailer.class)).andReturn(descriptor);
mockStatic(Hudson.class);
expect(Hudson.getInstance()).andReturn(hudson).anyTimes();
prepareJob();
DescribableList<Publisher, Descriptor<Publisher>> list = new DescribableList<Publisher, Descriptor<Publisher>>();
list.add(new Mailer());
Map<String, ExternalProjectProperty<Publisher>> map = DescribableListUtil.convertToProjectProperties(list, job);
assertNotNull(map);
assertEquals(map.size(), 1);
assertNotNull(map.get(mailerName));
assertEquals(map.get(mailerName).getValue().getClass(), Mailer.class);
}
use of org.hudsonci.model.project.property.ExternalProjectProperty in project hudson-2.x by hudson.
the class Job method doModifyCascadingProperty.
public synchronized void doModifyCascadingProperty(@QueryParameter(fixEmpty = true) String propertyName) {
if (null != propertyName) {
if (StringUtils.startsWith(propertyName, PROJECT_PROPERTY_KEY_PREFIX)) {
propertyName = StringUtils.substring(propertyName, 3);
propertyName = new StringBuilder(propertyName.length()).append(Character.toLowerCase((propertyName.charAt(0)))).append(propertyName.substring(1)).toString();
}
IProjectProperty property = getProperty(propertyName);
if (null != property && property instanceof ExternalProjectProperty) {
((ExternalProjectProperty) property).setModified(true);
}
}
}
Aggregations