assert bundleBasedir.getValueContext().equals(BUNDLE_BASEDIR_CONTEXT);
assert bundleBasedir.getValueName().equals(BUNDLE_BASEDIR_VALUE);
}
private void assertVersion2(ResourceType resourceType) {
PropertyDefinition prop;
Set<String> seen = new HashSet<String>(2); // we use to this remember names of the things that we've seen
assert resourceType.getChildSubCategories() == null;
seen.clear();
ConfigurationDefinition pcDef = resourceType.getPluginConfigurationDefinition();
assert pcDef.getGroupDefinitions().size() == 2;
for (PropertyGroupDefinition group : pcDef.getGroupDefinitions()) {
seen.add(group.getName());
if (group.getName().equals(CHANGED_PC_GROUP)) {
assert group.isDefaultHidden() == CHANGED_PC_GROUP_HIDDEN;
} else if (group.getName().equals(NEW_PC_GROUP)) {
assert group.isDefaultHidden() == NEW_PC_GROUP_HIDDEN;
} else {
assert false : "Unexpected group [" + group.getName() + "]:" + group;
}
}
if (seen.size() != 2) {
assert false : "did not see what we expected to see: " + seen;
}
prop = pcDef.get(CHANGED_PC_PROP);
assert prop != null;
assert prop.getName().equals(CHANGED_PC_PROP);
assert prop.isRequired() == CHANGED_PC_PROP_REQUIRED;
assert prop.getPropertyGroupDefinition().getName().equals(CHANGED_PC_GROUP);
prop = pcDef.get(NEW_PC_PROP);
assert prop != null;
assert prop.getName().equals(NEW_PC_PROP);
assert prop.isRequired() == NEW_PC_PROP_REQUIRED;
assert prop.getPropertyGroupDefinition().getName().equals(NEW_PC_GROUP);
seen.clear();
assert resourceType.getProcessScans().size() == 2;
for (ProcessScan processScan : resourceType.getProcessScans()) {
seen.add(processScan.getName());
if (processScan.getName().equals(CHANGED_PROCESS_SCAN_NAME)) {
assert processScan.getQuery().equals(CHANGED_PROCESS_SCAN_QUERY);
} else if (processScan.getName().equals(NEW_PROCESS_SCAN_NAME)) {
assert processScan.getQuery().equals(NEW_PROCESS_SCAN_QUERY);
} else {
assert false : "Unexpected process scan[" + processScan.getName() + "]:" + processScan;
}
}
if (seen.size() != 2) {
assert false : "did not see what we expected to see: " + seen;
}
seen.clear();
assert resourceType.getOperationDefinitions().size() == 2;
for (OperationDefinition op : resourceType.getOperationDefinitions()) {
seen.add(op.getName());
if (op.getName().equals(CHANGED_OP_NAME)) {
assert op.getTimeout().intValue() == CHANGED_OP_TIMEOUT;
assert op.getDescription().equals(CHANGED_OP_DESC);
} else if (op.getName().equals(NEW_OP_NAME)) {
assert op.getTimeout().intValue() == NEW_OP_TIMEOUT;
assert op.getDescription().equals(NEW_OP_DESC);
} else {
assert false : "Unexpected operation [" + op.getName() + "]:" + op;
}
}
if (seen.size() != 2) {
assert false : "did not see what we expected to see: " + seen;
}
seen.clear();
assert resourceType.getMetricDefinitions().size() == 3; // include built-in Availability metric
for (MeasurementDefinition metric : resourceType.getMetricDefinitions()) {
if (metric.getName().equals(MeasurementDefinition.AVAILABILITY_NAME)) {
// expected, ignore
continue;
}
seen.add(metric.getName());
if (metric.getName().equals(CHANGED_METRIC_PROP)) {
// even though our _v2 plugin set this to something different, our upgrade doesn't change it because
// we don't want to overwrite changes a user possibly made to the defaut interval (aka metric template)
assert metric.getDefaultInterval() == METRIC_DEFAULT_INTERVAL;
} else if (metric.getName().equals(NEW_METRIC_PROP)) {
assert metric.getDefaultInterval() == NEW_METRIC_DEFAULT_INTERVAL;
} else {
assert false : "Unexpected metric [" + metric.getName() + "]:" + metric;
}
}
if (seen.size() != 2) {
assert false : "did not see what we expected to see: " + seen;
}
seen.clear();
assert resourceType.getEventDefinitions().size() == 2;
for (EventDefinition event : resourceType.getEventDefinitions()) {
seen.add(event.getName());
if (event.getName().equals(CHANGED_EVENT_NAME)) {
assert event.getDescription().equals(CHANGED_EVENT_DESC);
} else if (event.getName().equals(NEW_EVENT_NAME)) {
assert event.getDescription().equals(NEW_EVENT_DESC);
} else {
assert false : "Unexpected event [" + event.getName() + "]:" + event;
}
}
if (seen.size() != 2) {
assert false : "did not see what we expected to see: " + seen;
}
assert resourceType.getResourceConfigurationDefinition().getGroupDefinitions().size() == 0;
prop = resourceType.getResourceConfigurationDefinition().get(CHANGED_RC_PROP);
assert prop != null;
assert prop.getName().equals(CHANGED_RC_PROP);
assert prop.isRequired() == CHANGED_RC_PROP_REQUIRED;
prop = resourceType.getResourceConfigurationDefinition().get(NEW_RC_PROP);
assert prop != null;
assert prop.getName().equals(NEW_RC_PROP);
assert prop.isRequired() == NEW_RC_PROP_REQUIRED;
seen.clear();
assert resourceType.getDriftDefinitionTemplates().size() == 2;
for (DriftDefinitionTemplate drift : resourceType.getDriftDefinitionTemplates()) {
DriftDefinition def = drift.getTemplateDefinition();