Search in sources :

Example 6 with PersistentMemoryDirectoryConfig

use of com.hazelcast.config.PersistentMemoryDirectoryConfig in project hazelcast by hazelcast.

the class XmlClientConfigBuilderTest method testPersistentMemoryDirectoryConfiguration_simpleAndAdvancedPasses.

@Override
@Test
public void testPersistentMemoryDirectoryConfiguration_simpleAndAdvancedPasses() {
    String xml = HAZELCAST_CLIENT_START_TAG + "<native-memory>\n" + "  <persistent-memory-directory>/mnt/optane</persistent-memory-directory>\n" + "  <persistent-memory enabled=\"false\">\n" + "    <directories>\n" + "      <directory>/mnt/pmem0</directory>\n" + "      <directory>/mnt/pmem1</directory>\n" + "    </directories>\n" + "  </persistent-memory>\n" + "</native-memory>\n" + HAZELCAST_CLIENT_END_TAG;
    ClientConfig config = buildConfig(xml);
    PersistentMemoryConfig pmemConfig = config.getNativeMemoryConfig().getPersistentMemoryConfig();
    assertFalse(pmemConfig.isEnabled());
    assertEquals(MOUNTED, pmemConfig.getMode());
    List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
    assertEquals(3, directoryConfigs.size());
    PersistentMemoryDirectoryConfig dir0Config = directoryConfigs.get(0);
    PersistentMemoryDirectoryConfig dir1Config = directoryConfigs.get(1);
    PersistentMemoryDirectoryConfig dir2Config = directoryConfigs.get(2);
    assertEquals("/mnt/optane", dir0Config.getDirectory());
    assertFalse(dir0Config.isNumaNodeSet());
    assertEquals("/mnt/pmem0", dir1Config.getDirectory());
    assertFalse(dir1Config.isNumaNodeSet());
    assertEquals("/mnt/pmem1", dir2Config.getDirectory());
    assertFalse(dir2Config.isNumaNodeSet());
}
Also used : PersistentMemoryConfig(com.hazelcast.config.PersistentMemoryConfig) PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest) Test(org.junit.Test)

Example 7 with PersistentMemoryDirectoryConfig

use of com.hazelcast.config.PersistentMemoryDirectoryConfig in project hazelcast by hazelcast.

the class YamlClientConfigBuilderTest method testPersistentMemoryDirectoryConfiguration_simpleAndAdvancedPasses.

@Override
@Test
public void testPersistentMemoryDirectoryConfiguration_simpleAndAdvancedPasses() {
    String yaml = "" + "hazelcast-client:\n" + "  native-memory:\n" + "    persistent-memory-directory: /mnt/optane\n" + "    persistent-memory:\n" + "      enabled: false\n" + "      directories:\n" + "        - directory: /mnt/pmem0\n" + "        - directory: /mnt/pmem1\n";
    ClientConfig config = buildConfig(yaml);
    PersistentMemoryConfig pmemConfig = config.getNativeMemoryConfig().getPersistentMemoryConfig();
    assertFalse(pmemConfig.isEnabled());
    assertEquals(MOUNTED, pmemConfig.getMode());
    List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
    assertEquals(3, directoryConfigs.size());
    PersistentMemoryDirectoryConfig dir0Config = directoryConfigs.get(0);
    PersistentMemoryDirectoryConfig dir1Config = directoryConfigs.get(1);
    PersistentMemoryDirectoryConfig dir2Config = directoryConfigs.get(2);
    assertEquals("/mnt/optane", dir0Config.getDirectory());
    assertFalse(dir0Config.isNumaNodeSet());
    assertEquals("/mnt/pmem0", dir1Config.getDirectory());
    assertFalse(dir1Config.isNumaNodeSet());
    assertEquals("/mnt/pmem1", dir2Config.getDirectory());
    assertFalse(dir2Config.isNumaNodeSet());
}
Also used : PersistentMemoryConfig(com.hazelcast.config.PersistentMemoryConfig) PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) YamlConfigBuilderTest(com.hazelcast.config.YamlConfigBuilderTest) Test(org.junit.Test)

Example 8 with PersistentMemoryDirectoryConfig

use of com.hazelcast.config.PersistentMemoryDirectoryConfig in project hazelcast by hazelcast.

the class XmlClientConfigBuilderTest method testPersistentMemoryDirectoryConfiguration.

@Override
@Test
public void testPersistentMemoryDirectoryConfiguration() {
    String xml = HAZELCAST_CLIENT_START_TAG + "<native-memory>\n" + "  <persistent-memory>\n" + "    <directories>\n" + "      <directory numa-node=\"0\">/mnt/pmem0</directory>\n" + "      <directory numa-node=\"1\">/mnt/pmem1</directory>\n" + "    </directories>\n" + "  </persistent-memory>\n" + "</native-memory>\n" + HAZELCAST_CLIENT_END_TAG;
    ClientConfig xmlConfig = buildConfig(xml);
    List<PersistentMemoryDirectoryConfig> directoryConfigs = xmlConfig.getNativeMemoryConfig().getPersistentMemoryConfig().getDirectoryConfigs();
    assertEquals(2, directoryConfigs.size());
    PersistentMemoryDirectoryConfig dir0Config = directoryConfigs.get(0);
    PersistentMemoryDirectoryConfig dir1Config = directoryConfigs.get(1);
    assertEquals("/mnt/pmem0", dir0Config.getDirectory());
    assertEquals(0, dir0Config.getNumaNode());
    assertEquals("/mnt/pmem1", dir1Config.getDirectory());
    assertEquals(1, dir1Config.getNumaNode());
}
Also used : PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest) Test(org.junit.Test)

Example 9 with PersistentMemoryDirectoryConfig

use of com.hazelcast.config.PersistentMemoryDirectoryConfig in project hazelcast by hazelcast.

the class ClientConfigXmlGenerator method nativeMemory.

private static void nativeMemory(XmlGenerator gen, NativeMemoryConfig nativeMemory) {
    gen.open("native-memory", "enabled", nativeMemory.isEnabled(), "allocator-type", nativeMemory.getAllocatorType()).node("size", null, "value", nativeMemory.getSize().getValue(), "unit", nativeMemory.getSize().getUnit()).node("min-block-size", nativeMemory.getMinBlockSize()).node("page-size", nativeMemory.getPageSize()).node("metadata-space-percentage", nativeMemory.getMetadataSpacePercentage());
    PersistentMemoryConfig pmemConfig = nativeMemory.getPersistentMemoryConfig();
    List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
    gen.open("persistent-memory", "enabled", pmemConfig.isEnabled(), "mode", pmemConfig.getMode().name());
    if (!directoryConfigs.isEmpty()) {
        gen.open("directories");
        for (PersistentMemoryDirectoryConfig dirConfig : directoryConfigs) {
            if (dirConfig.isNumaNodeSet()) {
                gen.node("directory", dirConfig.getDirectory(), "numa-node", dirConfig.getNumaNode());
            } else {
                gen.node("directory", dirConfig.getDirectory());
            }
        }
        gen.close();
    }
    gen.close().close();
}
Also used : PersistentMemoryConfig(com.hazelcast.config.PersistentMemoryConfig) PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig)

Example 10 with PersistentMemoryDirectoryConfig

use of com.hazelcast.config.PersistentMemoryDirectoryConfig in project hazelcast by hazelcast.

the class XmlClientConfigBuilderTest method testPersistentMemoryDirectoryConfigurationSimple.

@Override
@Test
public void testPersistentMemoryDirectoryConfigurationSimple() {
    String xml = HAZELCAST_CLIENT_START_TAG + "<native-memory>\n" + "  <persistent-memory-directory>/mnt/pmem0</persistent-memory-directory>\n" + "</native-memory>\n" + HAZELCAST_CLIENT_END_TAG;
    ClientConfig xmlConfig = buildConfig(xml);
    PersistentMemoryConfig pmemConfig = xmlConfig.getNativeMemoryConfig().getPersistentMemoryConfig();
    assertTrue(pmemConfig.isEnabled());
    List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
    assertEquals(1, directoryConfigs.size());
    PersistentMemoryDirectoryConfig dir0Config = directoryConfigs.get(0);
    assertEquals("/mnt/pmem0", dir0Config.getDirectory());
    assertFalse(dir0Config.isNumaNodeSet());
}
Also used : PersistentMemoryConfig(com.hazelcast.config.PersistentMemoryConfig) PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest) Test(org.junit.Test)

Aggregations

PersistentMemoryDirectoryConfig (com.hazelcast.config.PersistentMemoryDirectoryConfig)14 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 PersistentMemoryConfig (com.hazelcast.config.PersistentMemoryConfig)7 NativeMemoryConfig (com.hazelcast.config.NativeMemoryConfig)3 XMLConfigBuilderTest (com.hazelcast.config.XMLConfigBuilderTest)3 YamlConfigBuilderTest (com.hazelcast.config.YamlConfigBuilderTest)3 Node (org.w3c.dom.Node)2 MemorySize (com.hazelcast.memory.MemorySize)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1