try {
// this is simulating what the UI would be doing, build the config and call the server-side API
// we'll pretend the user is the overlord - another test will check a real user to see permission errors
ResourceType newResource1Type = resource.getResourceType();
ConfigurationDefinition initialDefinition = newResource1Type.getResourceConfigurationDefinition();
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());