typeResourceMap.put(serverTypeFS, serverFS);
typeResourceMap.put(serverTypePC, serverPC);
typeResourceMap.put(serverTypeRC, serverRC);
typeResourceMap.put(serverTypeMT, serverMT);
ResourceContainer platformContainer = new ResourceContainer(platform, null);
ResourceContainer bundleHandlerContainer = new ResourceContainer(bundleHandler, null);
ResourceContainer serverContainerFS = new ResourceContainer(serverFS, null);
ResourceContainer serverContainerPC = new ResourceContainer(serverPC, null);
ResourceContainer serverContainerRC = new ResourceContainer(serverRC, null);
ResourceContainer serverContainerMT = new ResourceContainer(serverMT, null);
idResourceContainerMap.put(platform.getId(), platformContainer);
idResourceContainerMap.put(bundleHandler.getId(), bundleHandlerContainer);
idResourceContainerMap.put(serverFS.getId(), serverContainerFS);
idResourceContainerMap.put(serverPC.getId(), serverContainerPC);
idResourceContainerMap.put(serverRC.getId(), serverContainerRC);
idResourceContainerMap.put(serverMT.getId(), serverContainerMT);
bundleHandlerContainer.setResourceContext(new MockResourceContext(bundleHandler));
// each different resource type that supports bundle deployments needs to define its
// bundle configuration to denote where the base directory location is found.
// Today we support four ways: via plugin config property, resource config property,
// measurement trait value, or strictly on the root file system (using no resource specific value)
ResourceTypeBundleConfiguration rtbc = new ResourceTypeBundleConfiguration(new Configuration());
rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_FS, Context.fileSystem.name(),
BUNDLE_CONFIG_CONTEXT_VALUE_FS, null);
serverTypeFS.setResourceTypeBundleConfiguration(rtbc);
rtbc = new ResourceTypeBundleConfiguration(new Configuration());
rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_PC, Context.pluginConfiguration.name(),
BUNDLE_CONFIG_CONTEXT_VALUE_PC, null);
serverTypePC.setResourceTypeBundleConfiguration(rtbc);
rtbc = new ResourceTypeBundleConfiguration(new Configuration());
rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_RC, Context.resourceConfiguration.name(),
BUNDLE_CONFIG_CONTEXT_VALUE_RC, null);
serverTypeRC.setResourceTypeBundleConfiguration(rtbc);
rtbc = new ResourceTypeBundleConfiguration(new Configuration());
rtbc.addBundleDestinationBaseDirectory(BUNDLE_CONFIG_NAME_MT, Context.measurementTrait.name(),
BUNDLE_CONFIG_CONTEXT_VALUE_MT, null);
serverTypeMT.setResourceTypeBundleConfiguration(rtbc);
// each different resource needs to specify where exactly it wants the bundles deployed
// using the different contexts that are supported.
Configuration pluginConfiguration = new Configuration();
pluginConfiguration.put(new PropertySimple(BUNDLE_CONFIG_CONTEXT_VALUE_PC, BUNDLE_CONFIG_LOCATION_PC));
serverPC.setPluginConfiguration(pluginConfiguration);
Configuration resourceConfiguration = new Configuration();
resourceConfiguration.put(new PropertySimple(BUNDLE_CONFIG_CONTEXT_VALUE_RC, BUNDLE_CONFIG_LOCATION_RC));
serverRC.setResourceConfiguration(resourceConfiguration);
MeasurementDefinition definition = new MeasurementDefinition(serverTypeMT, BUNDLE_CONFIG_CONTEXT_VALUE_MT);
definition.setDataType(DataType.TRAIT);
definition.setId(123);
MeasurementSchedule schedule = new MeasurementSchedule(definition, serverMT);
schedule.setId(123123);
MeasurementScheduleRequest scheduleRequest = new MeasurementScheduleRequest(schedule);
Set<MeasurementScheduleRequest> schedules = new HashSet<MeasurementScheduleRequest>(1);
schedules.add(scheduleRequest);
serverContainerMT.setMeasurementSchedule(schedules);
}