use of org.hudsonci.api.model.IProjectProperty in project hudson-2.x by hudson.
the class MatrixProjectTest method testDoResetProjectPropertyTwoProperties.
@Test
public void testDoResetProjectPropertyTwoProperties() throws IOException {
final IProjectProperty filterProperty = createMock(StringProjectProperty.class);
final IProjectProperty resultProperty = createMock(ResultProjectProperty.class);
String input = MatrixProject.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME + PROPERTY_NAME_SEPARATOR + MatrixProject.TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME;
MatrixProject project = new MatrixProjectMock("parent") {
public IProjectProperty getProperty(String key) {
if (MatrixProject.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME.equals(key)) {
return filterProperty;
} else if (MatrixProject.TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME.equals(key)) {
return resultProperty;
} else {
return null;
}
}
};
filterProperty.resetValue();
resultProperty.resetValue();
replay(filterProperty, resultProperty);
project.doResetProjectProperty(input);
verify(filterProperty, resultProperty);
}
use of org.hudsonci.api.model.IProjectProperty 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);
}
}
}
use of org.hudsonci.api.model.IProjectProperty in project hudson-2.x by hudson.
the class Job method removeCascadingJobProperty.
/**
* Adds cascading JobProperty.
*
* @param cascadingJobPropertyKey key of cascading JobProperty.
*/
private void removeCascadingJobProperty(String cascadingJobPropertyKey) {
if (null != cascadingJobPropertyKey) {
IProjectProperty projectProperty = CascadingUtil.getProjectProperty(this, cascadingJobPropertyKey);
if (null != projectProperty) {
projectProperty.resetValue();
}
cascadingJobProperties.remove(cascadingJobPropertyKey);
}
}
use of org.hudsonci.api.model.IProjectProperty in project hudson-2.x by hudson.
the class Job method doResetProjectProperty.
/**
* Resets overridden properties to the values defined in parent.
*
* @param propertyName the name of the properties. It possible to pass several names
* separated with {@link #PROPERTY_NAME_SEPARATOR}.
* @throws java.io.IOException exception.
*/
public void doResetProjectProperty(@QueryParameter final String propertyName) throws IOException {
checkPermission(CONFIGURE);
for (String name : StringUtils.split(propertyName, PROPERTY_NAME_SEPARATOR)) {
final IProjectProperty property = getProperty(name);
if (null != property) {
property.resetValue();
}
}
save();
}
Aggregations