int loadCount = 300;
HashSet<String> parsedNames = new HashSet<String>();
for (int i = 0; i < loadCount; i++) {
String name = "fakeProperty_" + i;
initialDefinition
.put(new PropertyDefinitionSimple(name, "fake_" + i, false, PropertySimpleType.BOOLEAN));
parsedNames.add(name);
}
newResource1Type.setResourceConfigurationDefinition(initialDefinition);
newResource1Type = em.merge(newResource1Type);
em.flush(); // so that slsb calls below will see the change reflected in the db
ConfigurationDefinition configurationDefinition = newResource1Type.getResourceConfigurationDefinition();
assert configurationDefinition != null : "Configuration Definition could not be located.";
//retrieve the options for ConfigurationDefinition
ConfigurationDefinition options = configurationManager.getOptionsForConfigurationDefinition(overlord,
newResource1.getId(), -1, configurationDefinition);
assert options != null : "Unable able to retrieve options for resource with id [" + newResource1.getId()
+ "].";
assert !options.getPropertyDefinitions().entrySet().isEmpty() : "No PropertyDefinitionSimple instances found.";
PropertyDefinitionSimple locatedPropertyDefSimple = null;
int locatedCount = 0;
for (Map.Entry<String, PropertyDefinition> entry : options.getPropertyDefinitions().entrySet()) {
PropertyDefinition pd = entry.getValue();
if (pd instanceof PropertyDefinitionSimple) {
locatedPropertyDefSimple = (PropertyDefinitionSimple) pd;
locatedCount++;
parsedNames.remove(locatedPropertyDefSimple.getName());
}
}
assert locatedPropertyDefSimple != null : "PropertyDefinitionSimple was not located!";
assert locatedCount != loadCount : "All expected properties were not loaded. Found '" + locatedCount + "'.";
assert parsedNames.isEmpty() : "Not all loaded options were parsed.";