@Test
  public void readVariables() {
    String xml =
        "<hazelcast>\n"
            + "    <semaphore name=\"${name}\">\n"
            + "        <initial-permits>${initial.permits}</initial-permits>\n"
            + "        <backup-count>${backupcount.part1}${backupcount.part2}</backup-count>\n"
            + "        <async-backup-count>${notreplaced}</async-backup-count>\n"
            + "    </semaphore>"
            + "</hazelcast>";
    ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes());
    XmlConfigBuilder configBuilder = new XmlConfigBuilder(bis);

    Properties properties = new Properties();
    properties.setProperty("name", "s");
    properties.setProperty("initial.permits", "25");
    properties.setProperty("backupcount.part1", "1");
    properties.setProperty("backupcount.part2", "0");
    configBuilder.setProperties(properties);

    Config config = configBuilder.build();
    SemaphoreConfig semaphoreConfig = config.getSemaphoreConfig("s");
    assertEquals(25, semaphoreConfig.getInitialPermits());
    assertEquals(10, semaphoreConfig.getBackupCount());
    assertEquals(0, semaphoreConfig.getAsyncBackupCount());
  }
 @Test
 public void readSemaphoreConfig() {
   String xml =
       "<hazelcast>\n"
           + "    <semaphore name=\"default\">\n"
           + "        <initial-permits>1</initial-permits>\n"
           + "    </semaphore>"
           + "    <semaphore name=\"custom\">\n"
           + "        <initial-permits>10</initial-permits>\n"
           + "        <semaphore-factory enabled=\"true\">"
           + "             <class-name>com.acme.MySemaphore</class-name>\n"
           + "        </semaphore-factory>"
           + "    </semaphore>"
           + "</hazelcast>";
   Config config = buildConfig(xml);
   SemaphoreConfig defaultConfig = config.getSemaphoreConfig("default");
   SemaphoreConfig customConfig = config.getSemaphoreConfig("custom");
   assertEquals(1, defaultConfig.getInitialPermits());
   assertEquals(10, customConfig.getInitialPermits());
 }