modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java | 7 ++-- modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDefinition.java | 4 +- modules/core/domain/src/main/java/org/rhq/core/domain/drift/Filter.java | 2 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java | 17 +++++++--- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizardInfoStep.java | 7 +++- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java | 9 ++--- 6 files changed, 30 insertions(+), 16 deletions(-)
New commits: commit cfe30b134dd06cca8d22c0eacdc994a6021a73f4 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Dec 9 14:21:28 2011 -0500
[Bug 755580 - Unable to add 2nd file-system drift] The drift definition name and description are no longer preset to the template name and description. The user will now need to enter a name. This should help prevent duplicate names, or mistakenly using the template's name. Also, the exception thrown on duplicate naming has been updated to indicate that that may in fact be the problem.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizardInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizardInfoStep.java index c7ad7ed..c2139c1 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizardInfoStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizardInfoStep.java @@ -36,6 +36,7 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.definition.ConfigurationTemplate; +import org.rhq.core.domain.drift.DriftConfigurationDefinition; import org.rhq.core.domain.drift.DriftDefinitionTemplate; import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep; import org.rhq.enterprise.gui.coregui.client.util.FormUtility; @@ -130,7 +131,11 @@ public class DriftAddDefinitionWizardInfoStep extends AbstractWizardStep {
DriftDefinitionTemplate selectedTemplate = templatesMap.get(key); wizard.setSelectedTemplate(selectedTemplate); - wizard.setNewStartingConfiguration(selectedTemplate.createConfiguration()); + Configuration startingConfig = selectedTemplate.createConfiguration(); + // don't propogate the template name or desc to the def, force the user to enter a name, and optionally, a def + startingConfig.remove(DriftConfigurationDefinition.PROP_NAME); + startingConfig.remove(DriftConfigurationDefinition.PROP_DESCRIPTION); + wizard.setNewStartingConfiguration(startingConfig); String description = selectedTemplate.getDescription(); description = (null == description) ? MSG.common_val_none() : description; form.getItem("Description").setValue(description); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java index 6af05d9..c06f7a4 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java @@ -589,12 +589,13 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote { }
try { - AgentClient agent = agentManager.getAgentClient(subjectManager.getOverlord(), driftDef.getResource().getId()); + AgentClient agent = agentManager.getAgentClient(subjectManager.getOverlord(), driftDef.getResource() + .getId()); DriftAgentService driftService = agent.getDriftAgentService(); driftService.pinSnapshot(driftDef.getResource().getId(), driftDef.getName(), snapshot); } catch (Exception e) { - log.warn("Unable to notify agent that DriftDefinition[driftDefinitionId: " + driftDefId + - ", driftDefinitionName: " + driftDef.getName() + "] has been pinned. The agent may be down.", e); + log.warn("Unable to notify agent that DriftDefinition[driftDefinitionId: " + driftDefId + + ", driftDefinitionName: " + driftDef.getName() + "] has been pinned. The agent may be down.", e); } }
@@ -745,7 +746,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote { break; } else { throw new IllegalArgumentException( - "You cannot change an existing drift definition's base directory or includes/excludes filters."); + "A new definition must have a unique name. An existing definition cannot update it's base directory or includes/excludes filters."); } } }
commit 5938a790c0aeb32865f4b115e721de22220ca100 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Dec 9 14:05:05 2011 -0500
[Bug 765592 - drift diff is different depending on order in which files are selected] Fixed, the new changes will now always get the "+" prefixes and the older will get the "-" prefixes.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java index f941c6f..b3de83f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java @@ -267,11 +267,18 @@ public class DriftCarouselView extends BookmarkableCarousel implements DetailsVi
public void executeAction(Object actionValue) {
- String id1 = selectedRecords.get(0).getAttribute(DriftDataSource.ATTR_ID); - String id2 = selectedRecords.get(1).getAttribute(DriftDataSource.ATTR_ID); - final String path = selectedRecords.get(0).getAttribute(DriftDataSource.ATTR_PATH); - - GWTServiceLookup.getDriftService().generateUnifiedDiffByIds(id1, id2, + Record record1 = selectedRecords.get(0); + Record record2 = selectedRecords.get(1); + final String path = record1.getAttribute(DriftDataSource.ATTR_PATH); + String id1 = record1.getAttribute(DriftDataSource.ATTR_ID); + String id2 = record2.getAttribute(DriftDataSource.ATTR_ID); + // regardless of selection order, compare the same way, showing newest changes with '+' signs + int version1 = record1.getAttributeAsInt(DriftDataSource.ATTR_CHANGESET_VERSION); + int version2 = record2.getAttributeAsInt(DriftDataSource.ATTR_CHANGESET_VERSION); + String diffOldId = (version1 < version2) ? id1 : id2; + String diffNewId = (version1 < version2) ? id2 : id1; + + GWTServiceLookup.getDriftService().generateUnifiedDiffByIds(diffOldId, diffNewId, new AsyncCallback<FileDiffReport>() { @Override public void onFailure(Throwable caught) {
commit 84c83f8760f6f37f7b7eed1b5e27346691901c11 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Dec 9 14:03:21 2011 -0500
[Bug 755673 - Adding new drift: includes/excludes - Path property required?] It's now optional. It will be set to "." by default in the GUI. But even if omitted will again get set to "." at the lower levels.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java index 9829480..2b21f03 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftConfigurationDefinition.java @@ -519,8 +519,8 @@ public class DriftConfigurationDefinition implements Serializable {
private static PropertyDefinitionSimple createIncludePath(boolean readOnly) { String name = PROP_PATH; - String description = "A file system path that can be a directory or a file. The path is assumed to be relative to the base directory of the drift definition."; - boolean required = true; + String description = "A file system directory path that is relative to (a sub-directory of) the base directory of the drift definition. The default is '.', the base directory itself."; + boolean required = false; PropertySimpleType type = PropertySimpleType.STRING;
PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); @@ -529,6 +529,7 @@ public class DriftConfigurationDefinition implements Serializable { pd.setSummary(true); pd.setOrder(0); pd.setAllowCustomEnumeratedValue(false); + pd.setDefaultValue(".");
RegexConstraint constraint = new RegexConstraint(); constraint.setDetails(PROP_FILTER_PATH_REGEX_PATTERN); @@ -539,7 +540,7 @@ public class DriftConfigurationDefinition implements Serializable {
private static PropertyDefinitionSimple createIncludePattern(boolean readOnly) { String name = PROP_PATTERN; - String description = "Pathname pattern that must match for the items in the directory path to be included. '*' matches zero or more characters, '?' matches one character. For example, '*.txt' (no quotes) will match text files in the filter's path directory. '**/*.txt' will match text files in any subdirectory below the filter's path directory"; + String description = "Pathname pattern that must match for the items in the directory path to be included. '*' matches zero or more characters, '?' matches one character. For example, '*.txt' (no quotes) will match text files in the filter's path directory. '**/*.txt' will match text files in any subdirectory below the filter's path directory."; boolean required = false; PropertySimpleType type = PropertySimpleType.STRING;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDefinition.java index a104843..92015ab 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDefinition.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDefinition.java @@ -149,7 +149,7 @@ public class DriftDefinition implements Serializable { name = (null != name) ? name.trim() : name;
if (null == name || "".equals(name)) { - throw new IllegalArgumentException("Drift congig name can not be null or empty"); + throw new IllegalArgumentException("Drift definition name can not be null or empty"); }
this.name = name; @@ -534,7 +534,7 @@ public class DriftDefinition implements Serializable { List<Filter> filters = new ArrayList<Filter>(); for (Property property : filtersListProperty.getList()) { PropertyMap filter = (PropertyMap) property; - filters.add(new Filter(filter.getSimpleValue(DriftConfigurationDefinition.PROP_PATH, ""), filter + filters.add(new Filter(filter.getSimpleValue(DriftConfigurationDefinition.PROP_PATH, "."), filter .getSimpleValue(DriftConfigurationDefinition.PROP_PATTERN, ""))); }
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/Filter.java b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/Filter.java index 96797ca..b57eb32 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/Filter.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/Filter.java @@ -42,7 +42,7 @@ public class Filter implements Serializable {
public void setPath(String path) { if (path == null) { - this.path = ""; + this.path = "."; } else { this.path = path; }