### Question:
SystemCapabilities implements SystemCapabilitiesLoader { public MeasurableCapability[] getMeasurableCapabilities(Configuration config) { if(config==null) throw new IllegalArgumentException("config is null"); List<MeasurableCapability> measurables = new ArrayList<>(); MeasurableCapability memory = new Memory(config); if(memory.isEnabled()) measurables.add(memory); MeasurableCapability systemMemory = new SystemMemory(config); if(systemMemory.isEnabled()) measurables.add(systemMemory); try { MeasurableCapability[] pools = (MeasurableCapability[])config.getEntry(COMPONENT+".memory.pool", "memoryPools", MeasurableCapability[].class, null, config); if(pools!=null) measurables.addAll(Arrays.asList(pools)); } catch(ConfigurationException e) { logger.warn("Loading CPU MeasurableCapability", e); } MeasurableCapability cpu = new CPU(config); if(cpu.isEnabled()) measurables.add(cpu); MeasurableCapability jvmCpu = new CPU(config, SystemWatchID.PROC_CPU, true); if(jvmCpu.isEnabled()) measurables.add(jvmCpu); MeasurableCapability diskSpace = getDiskSpace(config); if(diskSpace.isEnabled()) measurables.add(diskSpace); try { MeasurableCapability[] mCaps = (MeasurableCapability[])config.getEntry(COMPONENT, "measurableCapabilities", MeasurableCapability[].class, null); if(mCaps!=null) { measurables.addAll(Arrays.asList(mCaps)); } } catch (ConfigurationException e) { logger.warn("Loading MeasurableCapability array", e); } return measurables.toArray(new MeasurableCapability[0]); }  MeasurableCapability[] getMeasurableCapabilities(Configuration config); PlatformCapability[] getPlatformCapabilities(Configuration config); Map<String, String> getPlatformCapabilityNameTable(); String getPlatformConfigurationDirectory(Configuration config); static final String COMPONENT; static final String CAPABILITY; static final String NATIVE_LIBS; static final String PROCESSOR; static final String OPSYS; static final String TCPIP; static final String J2SE; static final String MEMORY; static final String SYSTEM_MEMORY; static final String STORAGE; static final String NATIVE_LIB_CLASS; static final String RIO; }### Answer:
@Test public void testGetMeasurableCapabilities() throws Exception { MeasurableCapability[] mCaps = systemCapabilities.getMeasurableCapabilities(new DynamicConfiguration()); int expected = 5; for(MeasurableCapability m : mCaps) System.out.println("===> "+m.getId()); Assert.assertEquals("Expected "+expected, expected, mCaps.length); org.rioproject.impl.system.measurable.memory.Memory memory = getCapability(org.rioproject.impl.system.measurable.memory.Memory.class, mCaps); Assert.assertNotNull(memory); log(memory); CPU cpu = getCapability(CPU.class, "CPU", mCaps); Assert.assertNotNull(cpu); log(cpu); CPU cpuProc = getCapability(CPU.class, "CPU (Proc)", mCaps); Assert.assertNotNull(cpuProc); log(cpuProc); DiskSpace diskSpace = getCapability(DiskSpace.class, mCaps); Assert.assertNotNull(diskSpace); log(diskSpace); }