myPluginConfig.put(new PropertySimple("test", "value"));
ResourceType resourceType = pluginContainer.getPluginManager().getMetadataManager()
.getType("Manual Add Server", "test");
MergeResourceResponse response = inventoryManager.manuallyAddResource(resourceType, platform.getId(),
myPluginConfig, -1);
assertFalse(response.resourceAlreadyExisted(), "The manual add resource shouldn't have existed");
assertNotEquals(response.getResourceId(), 0, "The manual add resource should have had its resource id set");
ResourceContainer resourceContainer = inventoryManager.getResourceContainer(response.getResourceId());
ResourceContext<?> resourceContext = resourceContainer.getResourceContext();
assertEquals(resourceContext.getPluginConfiguration(), myPluginConfig,
"The manual add resource doesn't have the expected plugin config.");
assertTrue(resourceContext.getAvailabilityContext() instanceof AvailabilityContextImpl,
"Unexpected implementation clas of the AvailabilityContext, please fix this test.");
assertEquals(((AvailabilityContextImpl) resourceContext.getAvailabilityContext()).getResource().getId(),
response.getResourceId(),
"Availability subsystem isn't aware of the correct resource id for manual add resource");
assertTrue(resourceContext.getContentContext() instanceof ContentContextImpl,
"Unexpected implementation class of ContentContext, please fix this test");
assertEquals(((ContentContextImpl) resourceContext.getContentContext()).getResourceId(),
response.getResourceId(),
"Content subsystem isn't aware of the correct resource id for manual add resource");
assertTrue(resourceContext.getEventContext() instanceof EventContextImpl,
"Unexpected implementation clas of the EventContext, please fix this test.");
assertEquals(((EventContextImpl) resourceContext.getEventContext()).getResource().getId(),
response.getResourceId(), "Event subsystem isn't aware of the correct resource id for manual add resource");
assertTrue(resourceContext.getOperationContext() instanceof OperationContextImpl,
"Unexpected implementation clas of the OperationContext, please fix this test.");
assertEquals(((OperationContextImpl) resourceContext.getOperationContext()).getResourceId(),
response.getResourceId(),
"Operation subsystem isn't aware of the correct resource id for manual add resource");
}