@Test public void testInitializeWithValidConfig() { when(resourceConfig.getName()).thenReturn("foo"); when(resourceConfig.getUnit()).thenReturn(MemoryUnit.MB); when(resourceConfig.getValue()).thenReturn(BigInteger.valueOf(2)); when(configuration.getResource()).thenReturn(singletonList(resourceConfig)); OffHeapResourcesProvider provider = new OffHeapResourcesProvider(configuration); assertThat(provider.getOffHeapResource(identifier("foo")), notNullValue()); assertThat(provider.getOffHeapResource(identifier("foo")).available(), is(2L * 1024 * 1024)); }
@Override public OffHeapResourceImpl getOffHeapResource(OffHeapResourceIdentifier identifier) { return resources.get(identifier); }
OffHeapResourcesProvider implements OffHeapResources, ManageableServerComponent, StateDumpable, AutoCloseable { @Override public OffHeapResourceImpl getOffHeapResource(OffHeapResourceIdentifier identifier) { return resources.get(identifier); } }
OffHeapResourcesProvider implements OffHeapResources, ManageableServerComponent, StateDumpable, AutoCloseable { @Override public OffHeapResourceImpl getOffHeapResource(OffHeapResourceIdentifier identifier) { return resources.get(identifier); } OffHeapResourcesProvider(OffheapResourcesType configuration);  OffHeapResourcesProvider(Map<String, Measure<org.terracotta.common.struct.MemoryUnit>> resources); }
OffHeapResourcesProvider implements OffHeapResources, ManageableServerComponent, StateDumpable, AutoCloseable { @Override public OffHeapResourceImpl getOffHeapResource(OffHeapResourceIdentifier identifier) { return resources.get(identifier); } OffHeapResourcesProvider(OffheapResourcesType configuration);  OffHeapResourcesProvider(Map<String, Measure<org.terracotta.common.struct.MemoryUnit>> resources); @Override Set<OffHeapResourceIdentifier> getAllIdentifiers(); @Override OffHeapResourceImpl getOffHeapResource(OffHeapResourceIdentifier identifier); @Override boolean addOffHeapResource(OffHeapResourceIdentifier identifier, long capacityInBytes); @Override void onManagementRegistryCreated(EntityManagementRegistry registry); @Override void onManagementRegistryClose(EntityManagementRegistry registry); @Override void addStateTo(StateDumpCollector dump); @Override void close(); }
OffHeapResourcesProvider implements OffHeapResources, ManageableServerComponent, StateDumpable, AutoCloseable { @Override public OffHeapResourceImpl getOffHeapResource(OffHeapResourceIdentifier identifier) { return resources.get(identifier); } OffHeapResourcesProvider(OffheapResourcesType configuration);  OffHeapResourcesProvider(Map<String, Measure<org.terracotta.common.struct.MemoryUnit>> resources); @Override Set<OffHeapResourceIdentifier> getAllIdentifiers(); @Override OffHeapResourceImpl getOffHeapResource(OffHeapResourceIdentifier identifier); @Override boolean addOffHeapResource(OffHeapResourceIdentifier identifier, long capacityInBytes); @Override void onManagementRegistryCreated(EntityManagementRegistry registry); @Override void onManagementRegistryClose(EntityManagementRegistry registry); @Override void addStateTo(StateDumpCollector dump); @Override void close();  }