Search in sources :

Example 11 with MemorySize

use of com.hazelcast.memory.MemorySize in project hazelcast by hazelcast.

the class TestFullApplicationContext method testDevice.

@Test
public void testDevice() {
    String deviceName0 = "device0";
    String deviceName1 = "device1";
    File baseDir0 = new File("/dev/devices/tiered_store_device0");
    File baseDir1 = new File("/dev/devices/tiered_store_device1");
    int blockSize = 8192;
    int readIOThreadCount = 16;
    int writeIOThreadCount0 = 8;
    int writeIOThreadCount1 = 16;
    assertEquals(2, config.getDeviceConfigs().size());
    LocalDeviceConfig localDeviceConfig = config.getDeviceConfig(deviceName0);
    assertEquals(deviceName0, localDeviceConfig.getName());
    assertEquals(baseDir0, localDeviceConfig.getBaseDir());
    assertEquals(blockSize, localDeviceConfig.getBlockSize());
    assertEquals(readIOThreadCount, localDeviceConfig.getReadIOThreadCount());
    assertEquals(writeIOThreadCount0, localDeviceConfig.getWriteIOThreadCount());
    assertEquals(new MemorySize(9321, MemoryUnit.MEGABYTES), localDeviceConfig.getCapacity());
    localDeviceConfig = config.getDeviceConfig(deviceName1);
    assertEquals(deviceName1, localDeviceConfig.getName());
    assertEquals(baseDir1, localDeviceConfig.getBaseDir());
    assertEquals(blockSize, localDeviceConfig.getBlockSize());
    assertEquals(readIOThreadCount, localDeviceConfig.getReadIOThreadCount());
    assertEquals(writeIOThreadCount1, localDeviceConfig.getWriteIOThreadCount());
    assertEquals(LocalDeviceConfig.DEFAULT_CAPACITY, localDeviceConfig.getCapacity());
}
Also used : MemorySize(com.hazelcast.memory.MemorySize) LocalDeviceConfig(com.hazelcast.config.LocalDeviceConfig) File(java.io.File) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 12 with MemorySize

use of com.hazelcast.memory.MemorySize in project hazelcast by hazelcast.

the class PhoneHomeDifferentConfigTest method testHdStorage.

@Test
public void testHdStorage() {
    NativeMemoryConfig nativeMemoryConfig = new NativeMemoryConfig().setEnabled(true).setSize(new MemorySize(64L, MEGABYTES));
    Config config = new Config().setNativeMemoryConfig(nativeMemoryConfig);
    HazelcastInstance hazelcastInstance = createHazelcastInstance(config);
    Node node = getNode(hazelcastInstance);
    PhoneHome phoneHome = new PhoneHome(node);
    Map<String, String> parameters = phoneHome.phoneHome(true);
    assertThat(parameters.get(PhoneHomeMetrics.HD_MEMORY_ENABLED.getRequestParameterName())).isEqualTo("true");
    assertThat(parameters.get(PhoneHomeMetrics.MEMORY_USED_HEAP_SIZE.getRequestParameterName())).isGreaterThan("0");
    assertThat(parameters.get(PhoneHomeMetrics.MEMORY_USED_NATIVE_SIZE.getRequestParameterName())).isEqualTo("0");
    assertThat(parameters.get(PhoneHomeMetrics.TIERED_STORAGE_ENABLED.getRequestParameterName())).isEqualTo("false");
    assertThat(parameters.get(PhoneHomeMetrics.DATA_MEMORY_COST.getRequestParameterName())).isEqualTo("0");
}
Also used : NativeMemoryConfig(com.hazelcast.config.NativeMemoryConfig) MemorySize(com.hazelcast.memory.MemorySize) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) TieredStoreConfig(com.hazelcast.config.TieredStoreConfig) Config(com.hazelcast.config.Config) JetConfig(com.hazelcast.jet.config.JetConfig) NativeMemoryConfig(com.hazelcast.config.NativeMemoryConfig) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MemorySize (com.hazelcast.memory.MemorySize)12 QuickTest (com.hazelcast.test.annotation.QuickTest)10 Test (org.junit.Test)10 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 CPSubsystemConfig (com.hazelcast.config.cp.CPSubsystemConfig)5 FencedLockConfig (com.hazelcast.config.cp.FencedLockConfig)5 SemaphoreConfig (com.hazelcast.config.cp.SemaphoreConfig)5 KerberosAuthenticationConfig (com.hazelcast.config.security.KerberosAuthenticationConfig)5 KerberosIdentityConfig (com.hazelcast.config.security.KerberosIdentityConfig)5 LdapAuthenticationConfig (com.hazelcast.config.security.LdapAuthenticationConfig)5 RealmConfig (com.hazelcast.config.security.RealmConfig)5 SimpleAuthenticationConfig (com.hazelcast.config.security.SimpleAuthenticationConfig)5 NativeMemoryConfig (com.hazelcast.config.NativeMemoryConfig)4 TokenIdentityConfig (com.hazelcast.config.security.TokenIdentityConfig)4 JetConfig (com.hazelcast.jet.config.JetConfig)4 JaasAuthenticationConfig (com.hazelcast.config.security.JaasAuthenticationConfig)3 TlsAuthenticationConfig (com.hazelcast.config.security.TlsAuthenticationConfig)3 File (java.io.File)3 RaftAlgorithmConfig (com.hazelcast.config.cp.RaftAlgorithmConfig)2 MemoryUnit (com.hazelcast.memory.MemoryUnit)2