return this;
}
@SuppressWarnings("unchecked")
public void addDefaultExpectations(Expectations expectations) throws Exception {
ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();
//only import the apache servers we actually care about - we can't assume another apache won't be present
//on the machine running the test...
final ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server");
expectations.allowing(ss.getDiscoveryServerService()).mergeInventoryReport(
expectations.with(Expectations.any(InventoryReport.class)));
expectations.will(fakeInventory.mergeInventoryReport(new FakeServerInventory.InventoryStatusJudge() {
@Override
public InventoryStatus judge(Resource resource) {
if (serverResourceType.equals(resource.getResourceType())) {
return deploymentConfig.serverRoot.equals(resource.getPluginConfiguration().getSimpleValue(
ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)) ? InventoryStatus.COMMITTED
: InventoryStatus.IGNORED;
} else {
return InventoryStatus.COMMITTED;
}
}
}));
expectations.allowing(ss.getDiscoveryServerService()).getResourceSyncInfo(
expectations.with(Expectations.any(Integer.class)));
expectations.will(fakeInventory.getResourceSyncInfo());
expectations.allowing(ss.getDiscoveryServerService()).upgradeResources(
expectations.with(Expectations.any(Set.class)));
expectations.will(fakeInventory.upgradeResources());
expectations.allowing(ss.getDiscoveryServerService()).getResources(
expectations.with(Expectations.any(Set.class)), expectations.with(Expectations.any(boolean.class)));
expectations.will(fakeInventory.getResources());
expectations.allowing(ss.getDiscoveryServerService()).setResourceError(expectations.with(Expectations.any(ResourceError.class)));
expectations.will(fakeInventory.setResourceError());
expectations.allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport(
expectations.with(Expectations.any(AvailabilityReport.class)));
expectations.allowing(ss.getDiscoveryServerService()).postProcessNewlyCommittedResources(
expectations.with(Expectations.any(Set.class)));
expectations.allowing(ss.getDiscoveryServerService()).clearResourceConfigError(
expectations.with(Expectations.any(int.class)));
expectations.allowing(ss.getDiscoveryServerService()).setResourceEnablement(
expectations.with(Expectations.any(int.class)), expectations.with(Expectations.any(boolean.class)));
expectations.allowing(ss.getDiscoveryServerService()).updateResourceVersion(
expectations.with(Expectations.any(int.class)), expectations.with(Expectations.any(String.class)));
expectations.allowing(ss.getDriftServerService()).getDriftDefinitions(expectations.with(Expectations.any(Set.class)));
expectations.will(Expectations.returnValue(Collections.emptyMap()));
expectations.allowing(ss.getDiscoveryServerService()).getResourcesAsList(expectations.with(Expectations.any(Integer[].class)));
expectations.will(fakeInventory.getResourcesAsList());
expectations.ignoring(ss.getBundleServerService());
expectations.ignoring(ss.getConfigurationServerService());
expectations.ignoring(ss.getContentServerService());
expectations.ignoring(ss.getCoreServerService());
expectations.ignoring(ss.getEventServerService());
expectations.ignoring(ss.getMeasurementServerService());
expectations.ignoring(ss.getOperationServerService());
expectations.ignoring(ss.getResourceFactoryServerService());
}