@SuppressWarnings("deprecation")
@Test
public void calculateNetworkBufMixed() throws Exception {

	Configuration config = new Configuration();
	config.setInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS, 1);
	final Float defaultFrac = TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION.defaultValue();
	final Long defaultMin = TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN.defaultValue();
	final Long defaultMax = TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.defaultValue();
	// old + 1 new parameter = new:
	Configuration config1 = config.clone();
	config1.setFloat(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION, 0.1f);
	assertEquals(enforceBounds((long) (0.1f * (10L << 20)), defaultMin, defaultMax),
		TaskManagerServices.calculateNetworkBufferMemory((64L << 20 + 1), config1));
	assertEquals(enforceBounds((long) (0.1f * (10L << 30)), defaultMin, defaultMax),
		TaskManagerServices.calculateNetworkBufferMemory((10L << 30), config1));
	config1 = config.clone();
	long newMin = TaskManagerOptions.MEMORY_SEGMENT_SIZE.defaultValue(); // smallest value possible
	config1.setLong(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN, newMin);
	assertEquals(enforceBounds((long) (defaultFrac * (10L << 20)), newMin, defaultMax),
		TaskManagerServices.calculateNetworkBufferMemory((10L << 20), config1));
	assertEquals(enforceBounds((long) (defaultFrac * (10L << 30)), newMin, defaultMax),
		TaskManagerServices.calculateNetworkBufferMemory((10L << 30), config1));
	config1 = config.clone();
	long newMax = Math.max(64L << 20 + 1, TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN.defaultValue());
	config1.setLong(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX, newMax);
	assertEquals(enforceBounds((long) (defaultFrac * (10L << 20)), defaultMin, newMax),
		TaskManagerServices.calculateNetworkBufferMemory((64L << 20 + 1), config1));
	assertEquals(enforceBounds((long) (defaultFrac * (10L << 30)), defaultMin, newMax),
		TaskManagerServices.calculateNetworkBufferMemory((10L << 30), config1));
	assertTrue(TaskManagerServicesConfiguration.hasNewNetworkBufConf(config1));
	// old + any new parameter = new:
	calculateNetworkBufNew(config);
}